Docbase

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.0更新於 Nov 7, 2026

MongoDB tools: query, aggregate, index, and administer collections and databases.

已驗證STDIO僅桌面資料庫資料與分析

概覽

AI 產生的概覽

本機 MCP 伺服器,為助理提供完整的 MongoDB 工具:瀏覽資料庫、查詢與聚合、寫入文件,以及管理集合與索引。

可以做什麼
  • 瀏覽資料庫、集合、索引、儲存大小與資料庫統計資訊
  • 執行 find 查詢、計數、聚合管線與執行計畫分析
  • 批次插入、更新與刪除文件
  • 建立、重新命名、刪除集合與資料庫,建立或刪除索引
  • 匯出符合的文件並讀取伺服器日誌行
適用情境
適合需要讓助理直接檢視或修改 MongoDB 執行個體的情境,例如探查集合結構、執行臨時查詢與聚合,或在對話中進行管理與資料變更操作。
執行需求
以本機 stdio 程序執行,可透過 npx 或 Docker 映像啟動。即時呼叫需要 PATH 中有 mongosh 用戶端,並能連線到 MongoDB 執行個體;官方映像未內含 mongosh。連線字串可在命令列傳入,或透過環境變數 MDB_MCP_CONNECTION_STRING 提供,也可傳給 connect 工具。
安裝前請注意
多個工具會寫入或銷毀資料:insert-many、update-many、delete-many、drop-collection、drop-database、rename-collection、drop-index 與 create-index 都會作用於真實資料庫。連線字串可能含有憑證,需以參數或環境變數傳入。若缺少 mongosh 或無法連線執行個體,伺服器仍會啟動,只在呼叫時回報錯誤。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Docbase,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

docbase

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.

Install

bash
npx @reneturcios/docbase call list-databases

Or run the container image:

bash
docker run -i ghcr.io/cloudcorprecords/docbase

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.

CLI

bash
# 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 --version

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.

How a call flows

  1. Arguments are validated (required database/collection names, object-shaped filters, non-empty document arrays, and so on). Invalid calls fail before anything reaches an executor.
  2. The call is mapped to its command document — for example update-many becomes { update: <collection>, updates: [{ q: filter, u: update, multi: true }] }.
  3. The executor runs the document. Three tools post-process the reply: 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.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/docbase mcp mongodb://alice@localhost:27017/shop

MCP client configuration:

json
{  "mcpServers": {    "docbase": {      "command": "npx",      "args": ["-y", "@reneturcios/docbase", "mcp"],      "env": { "MDB_MCP_CONNECTION_STRING": "mongodb://alice@localhost:27017/shop" }    }  }}

Tools

ToolRequiredOptionalWhat it does
connect—connectionStringPing the instance (validates a supplied connection string)
list-databases——List all databases (listDatabases)
list-collectionsdatabase—List a database's collections
collection-schemadatabase, collection—Infer field types from a 25-document sample
collection-indexesdatabase, collection—List a collection's indexes
collection-storage-sizedatabase, collection—Collection storage statistics (collStats)
finddatabase, collectionfilter, projection, limit, sortRun a find query
aggregatedatabase, collection, pipeline—Run an aggregation pipeline
countdatabase, collectionqueryCount matching documents
insert-manydatabase, collection, documents—Insert documents (ordered)
update-manydatabase, collection, filter, update—Update all matching documents
delete-manydatabase, collection, filter—Delete all matching documents
create-collectiondatabase, collection—Create a collection
drop-collectiondatabase, collection—Drop a collection
drop-databasedatabase—Drop a database
rename-collectiondatabase, collection, newName—Rename a collection (same database)
create-indexdatabase, collection, keys—Create an index; the name is derived from the keys
drop-indexdatabase, collection, indexName—Drop an index by name
explaindatabase, collectionmethod, methodArgsExplain a query plan (queryPlanner verbosity)
exportdatabase, collectionexportTitle, filterReturn matching documents under an export title
db-statsdatabase—Database statistics (dbStats)
mongodb-logs—limit, typeRead server log lines (getLog, default global)

Development

bash
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

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.

License

MIT — see LICENSE.

來源:README.md,提交 bf9c374

工具

22

connect

Connect to a MongoDB instance

輸入參數connectionString

list-databases

List all databases in the connected MongoDB instance

無需輸入參數。

list-collections

List collections in a MongoDB database

輸入參數database必填

collection-schema

Describe the schema for a collection

輸入參數database必填collection必填

collection-indexes

List indexes for a collection

輸入參數database必填collection必填

collection-storage-size

Get the storage size of a collection

輸入參數database必填collection必填

find

Run a find query against a MongoDB collection

輸入參數sortlimitfilterdatabase必填collection必填projection

aggregate

Run an aggregation pipeline against a MongoDB collection

輸入參數database必填pipeline必填collection必填

count

Count documents in a MongoDB collection

輸入參數querydatabase必填collection必填

insert-many

Insert documents into a MongoDB collection

輸入參數database必填documents必填collection必填

update-many

Update documents in a MongoDB collection

輸入參數filter必填update必填database必填collection必填

delete-many

Delete documents from a MongoDB collection

輸入參數filter必填database必填collection必填

create-collection

Create a new collection in a MongoDB database

輸入參數database必填collection必填

drop-collection

Drop a collection from a MongoDB database

輸入參數database必填collection必填

drop-database

Drop a MongoDB database

輸入參數database必填

rename-collection

Rename a MongoDB collection

輸入參數newName必填database必填collection必填

create-index

Create an index on a MongoDB collection

輸入參數keys必填database必填collection必填

drop-index

Drop an index from a MongoDB collection

輸入參數database必填indexName必填collection必填

explain

Get the execution plan for a MongoDB query

輸入參數methoddatabase必填collection必填methodArgs

export

Export a MongoDB collection to a file

輸入參數filterdatabase必填collection必填exportTitle

db-stats

Get statistics for a MongoDB database

輸入參數database必填

mongodb-logs

Retrieve MongoDB log entries

輸入參數typelimit

版本歷史

1
  1. v0.1.0最新Oct 31, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分