Chatgpt Mongodb
БесплатноНе проверенConnect ChatGPT to a free MongoDB database in the cloud via MCP — persistent memory across chats
Описание
Connect ChatGPT to a free MongoDB database in the cloud via MCP — persistent memory across chats
README
Give ChatGPT a real MongoDB database it can read from and write to, over MCP, without running a server or paying for a cluster.
ChatGPT is very good at reasoning over documents and very bad at remembering them. Close the tab and the
notes you dictated are gone. This repository shows how to hand it a document store instead: a free
MongoDB 7 instance from freebase.cloud exposed as an
MCP server, so anything ChatGPT writes in one conversation is still there three weeks later, in a different
chat, on a different device — and readable by mongosh and your application code too.
The examples in examples/ build a small recipe box. It is deliberately unglamorous: a collection of
documents with nested arrays, exactly the shape of thing people actually want an assistant to keep track of.
60-second quickstart
1. Create the database. Sign up at freebase.cloud — free, no card — and create a session with the MongoDB engine selected. There is no cluster tier to choose and nothing to provision.
2. Mint an MCP token. In the dashboard go to Settings → MCP → New Token, pick your MongoDB connection, and copy the URL. It looks like this:
https://freebase.cloud/api/mcp/YOUR_TOKEN
The token lives in the path, which is why nothing below ever sets an Authorization header.
3. Name your connection. Whatever you called the connection becomes the prefix on every tool name. This
README assumes you called it mongo.
4. Add it to ChatGPT. Settings → Apps → Advanced settings → turn on developer mode. Then Apps → Create, paste the URL, set Auth: None, press Scan Tools, and Create. (See the plan situation before you get frustrated — OpenAI's docs disagree with themselves about where this lives.)
5. Say something. In a new chat, enable the app from the + menu and try:
Save a recipe called "Sunday chili" to the recipes collection — 2 cans kidney beans, 500g beef mince, smoked paprika, 90 minutes, serves 6. Tag it weeknight and freezer.
Expected reply, roughly:
Called mongo_store → inserted 1 document into "recipes"
{ "acknowledged": true, "insertedId": "66f1a2c4e8b3d90a1c4f7e21" }
Saved. "Sunday chili" is in your recipes collection with tags ["weeknight", "freezer"].
Now open a brand-new conversation tomorrow and ask "what freezer recipes do I have?". It answers from the database, not from context.
The four tools you get
freebase.cloud exposes four MCP tools per connection, prefixed with your connection name:
| Tool | Purpose | Typical prompt that triggers it |
|---|---|---|
mongo_query |
Read — find, filter, aggregate | "which recipes take under 30 minutes?" |
mongo_store |
Write — insert and upsert documents | "add tonight's dinner to the recipes collection" |
mongo_list_tables |
Enumerate collections | "what collections exist in this database?" |
mongo_annotate_table |
Attach a description to a collection | "note that recipes.minutes is total time, not active time" |
mongo_query speaks real MongoDB. Filters, projections, and the aggregation pipeline ($match, $group,
$lookup, $unwind, $project, $sort) all work, so the model can compute an answer server-side instead
of dragging every document into its context window.
Which ChatGPT plans can actually do this
This is the part most write-ups get wrong, so here it is plainly.
OpenAI publishes two pages that describe the same feature and they do not agree on the path. Check both before concluding your account is broken:
- Settings → Apps → Advanced settings — where developer mode is documented.
- Settings → Connectors — the other location OpenAI's documentation points at.
Whichever one your build shows, the pasting flow is the same. On plans: developer mode for custom MCP
servers is documented for Pro, Plus, Business, Enterprise and Edu. Full write access is currently
rolling out to Business, Enterprise and Edu workspaces. If your account can list and read but the model
refuses to call mongo_store, that is the rollout, not your configuration.
Two things worth knowing while you wait:
- The Responses API path has no such restriction. Same MCP URL, same four tools, full read and write today.
- The same URL also works in Claude, Cursor, VS Code and anything else that speaks streamable HTTP, so the database is not stranded behind one vendor's rollout schedule.
ChatGPT requires streamable HTTP transport. That is what this endpoint serves; the deprecated HTTP+SSE transport is not involved.
A worked session: the recipe box
What follows is the shape of a real conversation against a single free MongoDB instance, not a demo script. Prompts are yours, the bracketed lines are the tool calls ChatGPT makes.
Seeding it.
Here's what I cooked this month, save each as a document in
recipeswith fields title, minutes, serves, tags, ingredients: [pasted list of eight]
[mongo_store × 8 → recipes]
Inserted 8 documents.
Asking a real question. This is where the aggregation pipeline earns its place:
Across my recipes, which ingredients show up most often?
[mongo_query → recipes]
aggregate: $unwind ingredients → $group by ingredient, $sum 1 → $sort desc → $limit 5
olive oil 7
garlic 6
smoked paprika 4
tinned tomatoes 4
lemon 3
Eight documents is trivial; eight hundred is where it matters. The $unwind/$group runs on the server and
only five rows travel back into the model's context.
Correcting the record. Documents are mutable, so is the conversation:
The chili is actually 75 minutes not 90, and it freezes for three months.
[mongo_store → recipes] upsert on title "Sunday chili"
Updated: minutes 90 → 75, added freezerMonths: 3
Weeks later, new chat, no context.
What can I make tonight in under 40 minutes with what's tagged pantry?
It queries, filters on minutes and tags, and answers. Nothing was carried in the conversation — it all
came out of the collection.
Driving it from the Responses API
If you are building rather than chatting, the same MCP URL drops into a tools block. No client library
for the database, no connection pooling, no schema layer:
{
"model": "gpt-5.6",
"tools": [{
"type": "mcp",
"server_label": "mongo",
"server_description": "Recipe box — a MongoDB collection of recipes with ingredients and tags.",
"server_url": "https://freebase.cloud/api/mcp/YOUR_TOKEN",
"require_approval": "never"
}],
"input": "Which recipes in my collection serve 6 or more? Return title and minutes."
}
require_approval: "never" is fine for a database you own and a token you minted. If your application lets
end users phrase the prompts, leave approvals on — the model can write, and a persuasive user can persuade
it to write something you did not intend.
Runnable versions in examples/: Node.js (recipe_box.mjs), Python (seed_recipes.py), and a dependency-free
curl script (ask_recipe_box.sh).
Annotating collections so the model stops guessing
MongoDB has no fixed schema, which is liberating for you and disorienting for a language model. minutes
could be prep time or total time; serves could be portions or people. mongo_annotate_table writes that
context onto the collection itself, where the model reads it before querying:
Annotate the recipes collection: minutes is total wall-clock time including resting, serves is adult portions, tags are lowercase single words, and ingredients is an array of free-text strings with no quantities parsed out.
Do this once per collection, and again for any collection you add later on the same instance. It costs one prompt and removes an entire category of confidently wrong answers, especially in fresh conversations where the model has no history to lean on.
The same database, from your own code
Because MongoDB is one of the three engines freebase.cloud exposes over its native TCP wire protocol (OP_MSG), your existing tooling connects unmodified — no SDK, no proxy:
mongosh "mongodb://HOST:27017/mydb"
import { MongoClient } from "mongodb";
const client = new MongoClient(process.env.MONGODB_URI);
await client.connect();
const recipes = client.db("mydb").collection("recipes");
await recipes.createIndex({ tags: 1, minutes: 1 });
const quick = await recipes.find({ minutes: { $lte: 30 } }).sort({ minutes: 1 }).toArray();
Mongoose, PyMongo, Motor, the native driver, mongodump/mongorestore — all standard. So the assistant and
your application are looking at one dataset, not two copies that drift apart. That is the actual argument
for this setup over a chat-memory feature.
Multi-document transactions, JSON Schema validators via db.createCollection(), time-series collections,
and compound/text/wildcard indexes all behave as the MongoDB 7.0 manual describes.
Honest limits
- The free tier is for development, prototyping and small production workloads. No SLA, uptime figure,
or backup guarantee is claimed here, because none is published. Anything you would be upset to lose should
be dumped periodically with
mongodump. - The token is a bearer credential in a URL. Anyone holding it has your four tools. Do not paste it into a public issue, a screenshot, or a committed config file. Rotate it in Settings → MCP if you suspect it leaked.
- The model will sometimes write when you meant "tell me". Phrase destructive intent explicitly and keep approvals on for anything shared.
- Write access in the ChatGPT UI depends on the rollout described above. Read paths work more widely.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| "Scan Tools" returns nothing | URL truncated, or token revoked | Re-copy the full path from Settings → MCP |
| Tools appear but never fire | App not enabled in this conversation | + in the composer → enable the app |
| Model reads but refuses to write | Write-access rollout (see above) | Use the Responses API, or a Business/Enterprise/Edu workspace |
| Can't find developer mode | Docs disagree on the path | Check Settings → Apps → Advanced settings and Settings → Connectors |
| Model invents field names | Empty collection, no annotation | Insert one document, then run mongo_annotate_table |
| Aggregation returns nothing | Field name case or type mismatch | Ask it to mongo_list_tables and show one raw document first |
Repository contents
examples/
recipe_box.mjs Node 18+ — Responses API + MCP tool block, reads the collection
seed_recipes.py Python — seeds documents through mongo_store via the openai SDK
ask_recipe_box.sh bash — the same request as raw curl, no dependencies
README.md how to run all three
See also
- Free MongoDB cloud instance — engine details and signup
- How to connect Claude to MongoDB — same token, different client
- Model Context Protocol specification — transport and tool semantics
- MongoDB 7.0 aggregation reference — what
mongo_queryaccepts - OpenAI Responses API — the
mcptool type
MIT licensed. Issues and pull requests welcome, particularly better annotation wording — that is where most of the answer quality lives.
freebase.cloud is an independent service and is not affiliated with OpenAI, MongoDB, Inc., Anthropic, Microsoft or Cursor.
Установка Chatgpt Mongodb
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/freebase-cloud/chatgpt-mongodb-mcpFAQ
Chatgpt Mongodb MCP бесплатный?
Да, Chatgpt Mongodb MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Chatgpt Mongodb?
Нет, Chatgpt Mongodb работает без API-ключей и переменных окружения.
Chatgpt Mongodb — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Chatgpt Mongodb в Claude Desktop, Claude Code или Cursor?
Открой Chatgpt Mongodb на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
wenb1n-dev/SmartDB_MCP
A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
автор: wenb1n-devPostgres Server
This server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
автор: madhurprashPostgres
Query your database in natural language
автор: AnthropicPostgreSQL
Read-only database access with schema inspection.
автор: modelcontextprotocolRedis
Interact with Redis key-value stores.
автор: modelcontextprotocolSQLite
Database interaction and business intelligence capabilities.
автор: modelcontextprotocolmxcp
Open-source framework for building enterprise-grade MCP servers using just YAML, SQL, and Python, with built-in auth, monitoring, ETL and policy enforcement.
автор: raw-labstadas-github/a2asearch-mcp
MCP server to search 4,800+ MCP servers, AI agents, CLI tools and agent skills. Install: npx -y a2asearch-mcp. Ask Claude: "Find MCP servers for database access
автор: tadas-githubjulien040/anyquery
Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by desi
автор: julien040drakonkat/wizzy-mcp-tmdb
A MCP server for The Movie Database API that enables AI assistants to search and retrieve movie, TV show, and person information.
автор: drakonkatCompare Chatgpt Mongodb with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории data
