mongo_mcp_server
If you are the rightful owner of mongo_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MongoDB MCP Server is a Model Context Protocol server designed for MongoDB databases, providing features like ERD generation and AI-driven query creation.
MongoDB MCP Server
MongoDB ๋ฐ์ดํฐ๋ฒ ์ด์ค๋ฅผ ์ํ Model Context Protocol (MCP) ์๋ฒ์ ๋๋ค. ์ด ์๋ฒ๋ MongoDB ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ๊ตฌ์กฐ๋ฅผ ๋ถ์ํ๊ณ , AI๋ฅผ ํ์ฉํ์ฌ ์ฟผ๋ฆฌ๋ฅผ ์์ฑํ๋ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
๊ธฐ๋ฅ
1. ERD ์์ฑ (generateErd)
๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ปฌ๋ ์ ๊ตฌ์กฐ๋ฅผ ๋ถ์ํ์ฌ ERD(Entity Relationship Diagram)๋ฅผ ์์ฑํฉ๋๋ค.
-
์ ๋ ฅ ํ๋ผ๋ฏธํฐ:
{ "database": "string", "collections": ["string"], // ์ ํ์ "format": "mermaid" | "json" // ๊ธฐ๋ณธ๊ฐ: "mermaid" }
-
์ฌ์ฉ ์์:
{ "database": "test", "format": "mermaid" }
2. ์ฟผ๋ฆฌ ์์ฑ (generateQuery)
์์ฐ์ด ์ค๋ช ์ ๊ธฐ๋ฐ์ผ๋ก MongoDB ์ฟผ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค. ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ค์ ๊ตฌ์กฐ๋ฅผ ๋ถ์ํ์ฌ ์ ํํ ์ฟผ๋ฆฌ๋ฅผ ์์ฑํฉ๋๋ค.
-
์ ๋ ฅ ํ๋ผ๋ฏธํฐ:
{ "database": "string", "collection": "string", "description": "string", "type": "mongodb" | "mongoose", // ๊ธฐ๋ณธ๊ฐ: "mongodb" "includeExplanation": boolean // ๊ธฐ๋ณธ๊ฐ: true }
-
์ฌ์ฉ ์์:
{ "database": "test", "collection": "users", "description": "์ค๋ ๊ฐ์ ํ ์ฌ์ฉ์ ์ฐพ๊ธฐ", "type": "mongodb" }
์ค์น ๋ฐ ์คํ
-
์์กด์ฑ ์ค์น:
npm install
-
๋น๋:
npm run build
-
์๋ฒ ์คํ:
node dist/index.js "mongodb://localhost:27017"
Claude Desktop ์ค์
macOS์์ Claude Desktop๊ณผ ํจ๊ป ์ฌ์ฉํ๋ ค๋ฉด ๋ค์๊ณผ ๊ฐ์ด ์ค์ ํ์ธ์:
-
์ค์ ํ์ผ ์์น:
~/Library/Application Support/Claude/claude_desktop_config.json
-
MCP ์๋ฒ ์ค์ ์ถ๊ฐ:
{ "mcp": { "servers": [ { "name": "mongodb", "command": "node /path/to/mongo-mcp-server/dist/index.js mongodb://localhost:27017/test" } ] } }
-
Claude Desktop ์ฌ์์
๊ฐ๋ฐ
ํ๋ก์ ํธ ๊ตฌ์กฐ
src/
โโโ index.ts # ๋ฉ์ธ ์๋ฒ ์ฝ๋
โโโ tools/
โ โโโ generateErd.ts # ERD ์์ฑ ๋๊ตฌ
โ โโโ generateQuery.ts # ์ฟผ๋ฆฌ ์์ฑ ๋๊ตฌ
์๋ก์ด ๋๊ตฌ ์ถ๊ฐ
src/tools
๋๋ ํ ๋ฆฌ์ ์ ๋๊ตฌ ํ์ผ ์์ฑ- ๋๊ตฌ ์ธํฐํ์ด์ค ๊ตฌํ:
export const newTool = { parameters: { // ํ๋ผ๋ฏธํฐ ์ ์ }, async execute(params: any, context: { client: MongoClient }) { // ๋๊ตฌ ๋ก์ง ๊ตฌํ }, };
src/index.ts
์ ๋๊ตฌ ๋ฑ๋ก