MongoDB MCP Server
OfficialMongoDB MCP サーバー
MongoDBデータベースへの読み取り専用アクセスを提供するモデルコンテキストプロトコルサーバー。このサーバーにより、LLMはコレクションスキーマを検査し、集計パイプラインを実行できます。
コンポーネント
ツール
集計
接続されたデータベースに対してMongoDB集計パイプラインを実行する
入力:
collection(文字列): クエリするコレクションpipeline(配列):MongoDB 集約パイプラインのステージoptions(オブジェクト): オプションの集計設定allowDiskUse(boolean): ディスク使用を必要とする操作を許可するmaxTimeMS(数値): 最大実行時間(ミリ秒)comment(文字列): 操作を識別するためのコメント
制限ステージが指定されていない場合、デフォルトの制限は 1000 ドキュメントです
デフォルトのタイムアウトは30秒です
説明する
集計パイプラインの実行プランを取得する
入力:
collection(文字列):分析するコレクションpipeline(配列):MongoDB 集約パイプラインのステージverbosity(文字列):説明の詳細レベルオプション: 「queryPlanner」、「executionStats」、「allPlansExecution」
デフォルト: "queryPlanner"
リソース
サーバーは、データベース内の各コレクションのスキーマ情報を提供します。
コレクションスキーマ(
mongodb://<host>/<collection>/schema)各コレクションの推論されたJSONスキーマ情報
フィールド名とデータ型が含まれます
スキーマはサンプルコレクション文書から派生されます
Related MCP server: legacy-mongodb-mcp
Claude Desktopでの使用
このサーバーを Claude Desktop アプリで使用するには、 claude_desktop_config.jsonの「mcpServers」セクションに次の構成を追加します。
"mongodb": {
"command": "npx",
"args": [
"-y" ,
"@pash1986/mcp-server-mongodb"
],
"env" : {
"MONGODB_URI" : "mongodb+srv://<yourcluster>" // 'mongodb://localhost:27017'
}
}mydbデータベース名に置き換え、必要に応じて接続文字列を調整します。
使用例
基本的な集計
{
"collection": "users",
"pipeline": [
{ "$match": { "age": { "$gt": 21 } } },
{ "$group": {
"_id": "$city",
"avgAge": { "$avg": "$age" },
"count": { "$sum": 1 }
}},
{ "$sort": { "count": -1 } },
{ "$limit": 10 }
],
"options": {
"allowDiskUse": true,
"maxTimeMS": 60000,
"comment": "City-wise user statistics"
}
}クエリの説明
{
"collection": "users",
"pipeline": [
{ "$match": { "age": { "$gt": 21 } } },
{ "$sort": { "age": 1 } }
],
"verbosity": "executionStats"
}安全機能
パイプラインで制限が指定されていない場合は、1000 ドキュメントの自動制限が適用されます。
すべての操作のデフォルトのタイムアウトは30秒です
読み取り専用操作のみ
コレクションサンプルからの安全なスキーマ推論
ライセンス
このMCPサーバーはMITライセンスに基づいてライセンスされています。つまり、MITライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。詳細については、プロジェクトリポジトリのLICENSEファイルをご覧ください。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to query and introspect MongoDB databases through find, aggregate, and schema discovery operations. Supports read-only default mode with optional write capabilities and works with any MCP-compatible client via stdio or HTTP transports.
- FlicenseNot gradedqualityCmaintenanceProvides read-only access to legacy MongoDB instances (<4.0) via the Model Context Protocol, enabling AI models to query databases, collections, and run aggregations safely.2
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with MongoDB databases through natural language, supporting document CRUD, aggregation, collection listing, and statistics.74,685Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to interact with MongoDB databases and MongoDB Atlas, supporting read-only and write operations, Atlas cluster management, and data exploration.74,685Apache 2.0
Related MCP Connectors
Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.
Read-only MCP server for Muovi, Argentina's trust-first local services marketplace (6 tools).
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/mongodb-developer/mongodb-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server