connect
Connect to a MongoDB instance
connectionString
io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 7, 2026
MongoDB tools: query, aggregate, index, and administer collections and databases.
本地 MCP 服务器,为助手提供完整的 MongoDB 工具:浏览数据库、查询与聚合、写入文档,以及管理集合和索引。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
参照 仓库 中的启动说明。
docbase gives an agent — or you, at a terminal — a complete set of MongoDB database tools: browse databases and collections, run find queries and aggregation pipelines, insert, update, and delete documents, manage indexes and collections, read database statistics and server logs, and ask the server to explain a query plan.
There is no bundled MongoDB driver. Every tool call is first mapped to
a plain MongoDB command document ({ find: ... }, { aggregate: ... },
{ createIndexes: ... }), and the default executor runs that document
through the mongosh command-line client with
db.runCommand(...). A machine that wants live answers therefore needs
mongosh on its PATH and a reachable MongoDB instance. Without
either, the server still starts and lists its tools; only the call
itself reports the problem, in plain language.
Or run the container image:
The container defaults to the MCP server (see below). Note the stock
image bundles no mongosh binary, so containerised live queries need
a mongosh provided on the host or mounted into the image.
Exit codes: 0 on success, 1 when the tool call, the connection, or
mongosh itself fails (the error says which), 2 for usage errors.
The connection string is a normal MongoDB URL (mongodb:// or
mongodb+srv://). For both mcp and call it can be left off the
command line and supplied through the MDB_MCP_CONNECTION_STRING
environment variable. The connect tool also accepts a
connectionString argument, which is validated and used for that
call's ping.
update-many becomes
{ update: <collection>, updates: [{ q: filter, u: update, multi: true }] }.collection-schema samples 25 documents ($sample) and infers a
field-to-types map from them; mongodb-logs runs getLog and
applies the requested limit to the returned lines; export runs
a find and returns the matching documents under the requested
export title.One bin serves both faces. The mcp subcommand starts a stdio MCP
server:
MCP client configuration:
All command construction, validation, schema inference, and log
limiting are covered by tests that drive the core through a fake
executor — no MongoDB server and no mongosh binary are needed to run
the suite.
MIT — see LICENSE.
来源:README.md,提交 bf9c374
Connect to a MongoDB instance
connectionStringList all databases in the connected MongoDB instance
无需输入参数。
List collections in a MongoDB database
database必填Describe the schema for a collection
database必填collection必填List indexes for a collection
database必填collection必填Get the storage size of a collection
database必填collection必填Run a find query against a MongoDB collection
sortlimitfilterdatabase必填collection必填projectionRun an aggregation pipeline against a MongoDB collection
database必填pipeline必填collection必填Count documents in a MongoDB collection
querydatabase必填collection必填Insert documents into a MongoDB collection
database必填documents必填collection必填Update documents in a MongoDB collection
filter必填update必填database必填collection必填Delete documents from a MongoDB collection
filter必填database必填collection必填Create a new collection in a MongoDB database
database必填collection必填Drop a collection from a MongoDB database
database必填collection必填Drop a MongoDB database
database必填Rename a MongoDB collection
newName必填database必填collection必填Create an index on a MongoDB collection
keys必填database必填collection必填Drop an index from a MongoDB collection
database必填indexName必填collection必填Get the execution plan for a MongoDB query
methoddatabase必填collection必填methodArgsExport a MongoDB collection to a file
filterdatabase必填collection必填exportTitleGet statistics for a MongoDB database
database必填Retrieve MongoDB log entries
typelimit已满足适用检查项的 90%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
npx @reneturcios/docbase call list-databasesdocker run -i ghcr.io/cloudcorprecords/docbase# Run one tool; the JSON-args argument is optional for no-arg toolsdocbase call list-databasesdocbase call find '{"database":"shop","collection":"users","filter":{"active":true},"limit":5}'docbase call db-stats '{"database":"shop"}'
# Start the MCP server (connection string optional, see below)docbase mcp mongodb://alice@localhost:27017/shop
docbase --versionnpx -y @reneturcios/docbase mcp mongodb://alice@localhost:27017/shop{ "mcpServers": { "docbase": { "command": "npx", "args": ["-y", "@reneturcios/docbase", "mcp"], "env": { "MDB_MCP_CONNECTION_STRING": "mongodb://alice@localhost:27017/shop" } } }}npm installnpm run build # tsc -> dist/npm test # node test runner over test/*.test.ts, no network, no live databasenpm run dev # run the CLI from source via tsx