MongoDB MCP Server
AI 에이전트가 평범한 요청으로 MongoDB 데이터베이스와 MongoDB Atlas 클러스터를 다루도록 해 줍니다.
1.2k GitHub 스타제작 MongoDB라이선스 Apache-2.0업데이트 18일 전
설치 방법
이 MCP는 로컬 방식이에요. 내 컴퓨터에서 실행돼요.
PC에 설치한 앱(Claude Desktop, Claude Code, Cursor, VS Code 등)에서 쓸 수 있어요. 앱을 고르세요:
터미널에 붙여 넣기:
claude mcp add mongodb -- npx -y mongodb-mcp-server
채워야 할 것
| 이름 | 설명 | 필수 |
|---|---|---|
MDB_MCP_AGGREGATION_COUNT_MAX_TIME_MS_CAP | Deprecated. Use aggregationCountTimeoutMs instead. | 아니요 |
MDB_MCP_AGGREGATION_COUNT_TIMEOUT_MS | The maximum time in milliseconds for the count phase of aggregation operations. This is used to limit the time spent counting documents when determining if results were capped. | 아니요 |
MDB_MCP_ALLOW_REQUEST_OVERRIDES | When set to true, allows configuration values to be overridden via request headers and query parameters. | 아니요 |
MDB_MCP_API_CLIENT_ID | Atlas API client ID for authentication. Required for running Atlas tools. | 아니요 |
MDB_MCP_API_CLIENT_SECRET | Atlas API client secret for authentication. Required for running Atlas tools. | 아니요 |
MDB_MCP_ASSISTANT_BASE_URL | Base URL for the MongoDB Assistant API. | 아니요 |
MDB_MCP_ATLAS_TEMPORARY_DATABASE_USER_LIFETIME_MS | Time in milliseconds that temporary database users created when connecting to MongoDB Atlas clusters will remain active before being automatically deleted. | 아니요 |
MDB_MCP_CONFIRMATION_REQUIRED_TOOLS | Comma separated values of tool names that require user confirmation before execution. Requires the client to support elicitation. | 아니요 |
MDB_MCP_CONNECTION_IDLE_TIMEOUT_MS | Milliseconds a MongoDB connection may stay unused (no tool call touching it) before it is closed to release the underlying connection pool and its server-side state. Applied per connection regardless of its connection scope; the preconfigured connection is excluded, and the reaper runs on this cadence. Set to 0 to disable reaping; must not be negative. | 아니요 |
MDB_MCP_CONNECTION_SCOPE | Visibility scope for MongoDB connections created at runtime. With 'session' (the default), each MCP session only sees the connections it created (plus the shared 'preconfigured' one) and they are closed when the session ends. With 'global', connections are shared across all sessions and survive session rotation. Deprecated: the MCP protocol is moving to sessionless, so this option will soon be removed and the connection scope will default to 'global'. For shared-server use cases, use the Atlas-Managed MCP server or build an authenticated library using the @mongodb-js/mcp-cli package. Note: on the sessionless (2026-07-28) HTTP path, a request without an mcp-session-id falls back to the shared ('global') scope so it can still persist connections across requests; the legacy sessionful path always carries a server-issued session. | 아니요 |
MDB_MCP_CONNECTION_STRING | MongoDB connection string for direct database connections, exposed under the connectionId "preconfigured". Optional, if not set, you'll need to call the connect tool before interacting with MongoDB data. Deprecated: prefer the "preconfigured" entry of connectionStrings. | 아니요 |
MDB_MCP_CONNECTION_STRINGS | MongoDB connection strings keyed by name, as a JSON object (e.g. {"preconfigured": "mongodb://...", "analytics": "mongodb://..."}). Each name becomes a connectionId that the MongoDB tools can use directly, so one server can reach several deployments. Connections are opened on first use. Environment variable or config file only. | 아니요 |
MDB_MCP_DANGEROUS_HOST_BINDING | When set to true, allows binding the HTTP server (and monitoring server) to a non-loopback host such as 0.0.0.0, a LAN IP, or an empty host (all interfaces). Binding to a non-loopback host exposes the server to the entire network and can allow unauthorized access. Off by default: the server refuses to start on a non-loopback host unless this is true. | 아니요 |
MDB_MCP_DISABLE_SERVER_SIDE_JS | When set to true, disallows the use of server-side JavaScript operators (such as $where, $function, and $accumulator) in query filters and aggregation pipelines. | 아니요 |
MDB_MCP_DISABLE_UNTRUSTED_DATA_WARNING | When set to true, tool responses include potentially untrusted data (such as documents or query results) as-is, without wrapping it in delimiters and a prompt-injection warning. | 아니요 |
MDB_MCP_DISABLED_TOOLS | Comma separated values of tool names, operation types, and/or categories of tools that will be disabled. | 아니요 |
MDB_MCP_DRY_RUN | When true, runs the server in dry mode: dumps configuration and enabled tools, then exits without starting the server. | 아니요 |
MDB_MCP_ELICITATION_TIMEOUT_MS | Time in milliseconds the user has to respond to an elicitation request (such as a tool confirmation prompt) before it fails. | 아니요 |
MDB_MCP_EVICTION_IDLE_GRACE_M_S | How long a session must be idle before it becomes eligible for least-recently-used eviction when the HTTP transport is at its maxSessions cap (only used when transport is 'http'). Swept back to idleTimeoutMs when larger. | 아니요 |
MDB_MCP_EXPORT_CLEANUP_INTERVAL_MS | Time in milliseconds between export cleanup cycles that remove expired export files. | 아니요 |
MDB_MCP_EXPORT_TIMEOUT_MS | Time in milliseconds after which an export is considered expired and eligible for cleanup. | 아니요 |
MDB_MCP_EXPORTS_PATH | Folder to store exported data files. | 아니요 |
MDB_MCP_EXTERNALLY_MANAGED_SESSIONS | When true, the 2025-era HTTP transport accepts a session ID supplied externally through the 'mcp-session-id' header. When an external ID is supplied, the initialization request is optional, and an implicitly re-initialized session restores the client's previously negotiated capabilities from the session store. | 아니요 |
MDB_MCP_HEALTH_CHECK_HOST | Deprecated. Use monitoringServerHost instead. Host address to bind the healthCheck HTTP server to (only used when transport is 'http'). If provided, healthCheckPort must also be set. | 아니요 |
MDB_MCP_HEALTH_CHECK_PORT | Deprecated. Use monitoringServerPort instead. Port number for the healthCheck HTTP server (only used when transport is 'http'). If provided, healthCheckHost must also be set. | 아니요 |
MDB_MCP_HTTP_BODY_LIMIT | Maximum size of the HTTP request body in bytes (only used when transport is 'http'). This value is passed as the optional limit parameter to the Express.js json() middleware. | 아니요 |
MDB_MCP_HTTP_HEADERS | Header that the HTTP server will validate when making requests (only used when transport is 'http'). | 아니요 |
MDB_MCP_HTTP_HOST | Host address to bind the HTTP server to (only used when transport is 'http'). | 아니요 |
MDB_MCP_HTTP_PORT | Port number for the HTTP server (only used when transport is 'http'). Use 0 for a random port. | 아니요 |
MDB_MCP_HTTP_RESPONSE_TYPE | The HTTP response type for tool responses: 'sse' for Server-Sent Events, 'json' for standard JSON responses. | 아니요 |
MDB_MCP_IDLE_TIMEOUT_MS | Idle timeout for a client to disconnect (only applies to http transport). | 아니요 |
MDB_MCP_INDEX_CHECK | When set to true, enforces that query operations must use an index, rejecting queries that perform a collection scan. | 아니요 |
MDB_MCP_LOG_PATH | Folder to store logs. | 아니요 |
MDB_MCP_LOGGERS | Comma separated values of logger types. | 아니요 |
MDB_MCP_MAX_ACTIVE_CONNECTIONS | Maximum number of MongoDB connections a single scope (an MCP session by default, see connectionScope) can hold open. When exceeded, the scope's least-recently-used connection is closed and its connectionId revoked. The preconfigured connection does not count towards the limit. | 아니요 |
MDB_MCP_MAX_BYTES_PER_QUERY | The maximum size in bytes for results from a find or aggregate tool call. This serves as an upper bound for the responseBytesLimit parameter in those tools. | 아니요 |
MDB_MCP_MAX_DOCUMENTS_PER_QUERY | The maximum number of documents that can be returned by a find or aggregate tool call. For the find tool, the effective limit will be the smaller of this value and the tool's limit parameter. | 아니요 |
MDB_MCP_MAX_SESSIONS | Maximum number of concurrent sessions the HTTP transport will hold in memory (only used when transport is 'http'). Each session holds a full server instance, transport, and timers, so choose a value based on your deployment's available memory; the default is a conservative safety net rather than a recommended production value. | 아니요 |
MDB_MCP_MAX_TIME_M_S | Deprecated. Use timeoutMs instead. The maximum time in milliseconds that operations are allowed to run on the MongoDB server. | 아니요 |
MDB_MCP_MCP_CLIENT_LOG_LEVEL | Minimum severity level for log messages forwarded to the MCP client. | 아니요 |
MDB_MCP_MONITORING_SERVER_FEATURES | Features to expose on the monitoring server: health-check, metrics, and process-metrics. process-metrics exposes /metrics with Node.js process metrics (only used when transport is 'http' and monitoringServerHost/monitoringServerPort are set). | 아니요 |
MDB_MCP_MONITORING_SERVER_HOST | Host address to bind the monitoring HTTP server to (only used when transport is 'http'). If provided, monitoringServerPort must also be set. | 아니요 |
MDB_MCP_MONITORING_SERVER_PORT | Port number for the monitoring HTTP server (only used when transport is 'http'). If provided, monitoringServerHost must also be set. | 아니요 |
MDB_MCP_NOTIFICATION_TIMEOUT_MS | Notification timeout for a client to be aware of disconnect (only applies to http transport). | 아니요 |
MDB_MCP_PREVIEW_FEATURES | Comma separated values of preview features that are enabled. | 아니요 |
MDB_MCP_QUERY_COUNT_MAX_TIME_MS_CAP | Deprecated. Use queryCountTimeoutMs instead. | 아니요 |
MDB_MCP_QUERY_COUNT_TIMEOUT_MS | The maximum time in milliseconds for the count phase of find operations. This is used to limit the time spent counting documents when determining if results were capped. | 아니요 |
MDB_MCP_READ_ONLY | When set to true, only allows read, connect, and metadata operation types, disabling create/update/delete operations. | 아니요 |
MDB_MCP_TELEMETRY | When set to disabled, disables telemetry collection. | 아니요 |
MDB_MCP_TIMEOUT_MS | The maximum time in milliseconds that MongoDB operations are allowed to run, applied as the driver's timeoutMS (client-side operation timeout, CSOT) on each connection. It bounds the entire operation, including server selection and network round trips. | 아니요 |
MDB_MCP_TRANSPORT | Either 'stdio' or 'http'. | 아니요 |
MDB_MCP_VOYAGE_API_KEY | API key for Voyage AI embeddings service (required for creating Atlas Local deployments with auto-embed vector search capabilities). | 아니요 |
준비 끝! 이제 테스트해 보세요
앱을 다시 시작하고 아래 요청 중 하나를 채팅에 붙여 넣으세요:
myDatabase 데이터베이스의 컬렉션을 보여 주세요.
orders 컬렉션에서 가장 최근 문서 10개를 찾아 주세요.
무엇인가요
이 서버는 AI 에이전트를 MongoDB에 연결합니다. 연결 문자열만 있으면 로컬이든 Atlas든 모든 MongoDB 배포판에서 작동하며, Atlas API 자격 증명이 있으면 Atlas도 관리할 수 있습니다. README는 기본적으로 읽기 전용 모드를 권장하므로, 에이전트가 데이터를 바꾸지 않고 살펴볼 수 있습니다.
할 수 있는 일
- 연결 문자열로 MongoDB 데이터베이스에 연결합니다
- 서비스 계정 API 자격 증명으로 Atlas 도구를 씁니다
--readOnly로 읽기 전용 모드에서 실행합니다npx -y mongodb-mcp-server@latest setup명령으로 안내된 설정을 합니다- mongodb-atlas 플러그인으로 OAuth를 통해 MongoDB가 호스팅하는 Atlas MCP 서버에 연결합니다
언제 쓰나요
- ›에이전트가 MongoDB 컬렉션을 살펴보고 무엇이 들어 있는지 설명하게 하고 싶을 때
- ›채팅으로 Atlas 클러스터를 관리하고 싶을 때
- ›쓰기를 할 수 없는 데이터베이스 접근이 필요해서 --readOnly를 추가할 때
필요한 것
함께 쓰면 좋은 스킬
MCP일까, 스킬일까?
MCP는 에이전트에게 손을 주고, 스킬은 그 손을 제대로 쓰는 법을 알려 줘요. 함께 쓰면 결과가 좋아지고 토큰도 덜 들어요.
azure-mgmt-mongodbatlas-dotnet에이전트가 Azure 리소스로 MongoDB Atlas를 관리하도록 돕고, 요금 청구를 통합합니다.nocobase-app-plugin-database-explorer에이전트가 읽기 전용 모드로 NocoBase 앱의 데이터베이스 연결, 컬렉션, 필드를 살펴보고, 다른 역할의 접근 권한을 설정하도록 돕습니다.prisma-database-setup에이전트가 PostgreSQL, MySQL, SQLite, MongoDB 등 여러 데이터베이스에 Prisma를 설정하고 연결 문제를 해결하도록 돕습니다.자주 묻는 질문
무료이고 오픈소스인가요?
서버는 MongoDB가 게시하고 npx나 Docker로 실행합니다. README는 서버 자체의 가격을 언급하지 않습니다.
데이터를 바꿀 수 있나요?
허용했을 때만 가능합니다. README 예시에는 모두 --readOnly가 들어 있으며, 쓰기 작업을 켜려면 이를 제거하세요.
비밀 정보는 어떻게 넘겨야 하나요?
README는 명령줄 인수 대신 환경 변수를 권장합니다. 인수는 프로세스 목록과 로그에 나타날 수 있기 때문입니다.
어떤 자격 증명이 필요한가요?
MongoDB 연결 문자열이나 서비스 계정의 Atlas API 자격 증명 중 하나가 필요합니다. Atlas 도구는 서비스 계정 자격 증명이 필요합니다.
Atlas용 호스팅 옵션이 있나요?
네. mongodb-atlas 플러그인은 OAuth로 MongoDB가 호스팅하는 Atlas MCP 서버에 연결하므로 로컬에서 아무것도 실행할 필요가 없습니다.
Docker에서 실행할 수 있나요?
네. 이미지는 mongodb/mongodb-mcp-server:latest이며, 연결 문자열은 환경 변수로 넘깁니다.
작동하지 않을 때
- ›node -v가 22.13 이상인지 확인하세요. Node 20 지원은 중단되었습니다.
- ›연결 문자열에 올바른 사용자 이름과 비밀번호가 있는지 확인하세요.
- ›Atlas 도구를 쓰려면 서비스 계정에 필요한 최소 권한이 있고, client id와 secret이 모두 설정되어 있는지 확인하세요.
매주 새 스킬 5개. 읽는 데 1분.