mongo_mcp_server

mongo_mcp_server

3.1

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"
    }
    

์„ค์น˜ ๋ฐ ์‹คํ–‰

  1. ์˜์กด์„ฑ ์„ค์น˜:

    npm install
    
  2. ๋นŒ๋“œ:

    npm run build
    
  3. ์„œ๋ฒ„ ์‹คํ–‰:

    node dist/index.js "mongodb://localhost:27017"
    

Claude Desktop ์„ค์ •

macOS์—์„œ Claude Desktop๊ณผ ํ•จ๊ป˜ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์„ค์ •ํ•˜์„ธ์š”:

  1. ์„ค์ • ํŒŒ์ผ ์œ„์น˜: ~/Library/Application Support/Claude/claude_desktop_config.json

  2. MCP ์„œ๋ฒ„ ์„ค์ • ์ถ”๊ฐ€:

    {
      "mcp": {
        "servers": [
          {
            "name": "mongodb",
            "command": "node /path/to/mongo-mcp-server/dist/index.js mongodb://localhost:27017/test"
          }
        ]
      }
    }
    
  3. Claude Desktop ์žฌ์‹œ์ž‘

๊ฐœ๋ฐœ

ํ”„๋กœ์ ํŠธ ๊ตฌ์กฐ

src/
โ”œโ”€โ”€ index.ts          # ๋ฉ”์ธ ์„œ๋ฒ„ ์ฝ”๋“œ
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ generateErd.ts    # ERD ์ƒ์„ฑ ๋„๊ตฌ
โ”‚   โ””โ”€โ”€ generateQuery.ts  # ์ฟผ๋ฆฌ ์ƒ์„ฑ ๋„๊ตฌ

์ƒˆ๋กœ์šด ๋„๊ตฌ ์ถ”๊ฐ€

  1. src/tools ๋””๋ ‰ํ† ๋ฆฌ์— ์ƒˆ ๋„๊ตฌ ํŒŒ์ผ ์ƒ์„ฑ
  2. ๋„๊ตฌ ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌํ˜„:
    export const newTool = {
      parameters: {
        // ํŒŒ๋ผ๋ฏธํ„ฐ ์ •์˜
      },
      async execute(params: any, context: { client: MongoClient }) {
        // ๋„๊ตฌ ๋กœ์ง ๊ตฌํ˜„
      },
    };
    
  3. src/index.ts์— ๋„๊ตฌ ๋“ฑ๋ก