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