このページの情報を使用して、 MongoDB MCP Server の問題のトラブルシューティングに役立ちます。
ログファイル
MCP Server に問題がある場合は、問題のトラブルシューティングに役立つ情報については、 MCP Server ログ を確認してください。
デフォルトでは 、MCP サーバーはログをディスクに書込み、 MCPクライアントにもログを送信します。loggers オプションを変更して、ログが送信される場所を指定できます。MCP サーバー オプションの詳細については、MongoDB MCP サーバー構成オプション を参照してください。
次の表は、MCP サーバーがログファイルを保存するデフォルトのディレクトリを示しています。
オペレーティング システム | デフォルトのログディレクトリ |
|---|---|
Windows |
|
macOS と Linux |
|
ログパスを変更するには、次のいずれかを設定します。
logPathMCP サーバーを起動するときにJSON構成ファイルまたはコマンドラインで オプションをMDB_MCP_LOG_PATH環境変数
接続文字列の問題
構成ファイルが正しいこと、およびMongoDBデプロイに有効な接続文字列を使用していること を確認します。
接続文字列の形式と例については、接続文字列を参照してください。
HTTPトランスポートの問題
HTTPトランスポートを使用しており、接続の問題が発生している場合
クライアント接続URL に
/mcpエンドポイント パスが含まれていることを確認します。http://<server-address>:3000/mcp リモートサーバー(別のコンピューター、コンテナ、またはクラウドインスタンス)に接続する場合は、リモート接続を受け入れるためにサーバーが
--httpHost=0.0.0.0で起動されていることを確認してください。npx -y mongodb-mcp-server@latest --transport http --httpHost=0.0.0.0 --readOnly 指定されたポートがオープンで、クライアントコンピューターからアクセス可能であることを確認します。
Atlas Tools とDatabase Toolsの構成ガイド
Overview
MongoDB MCP Server は、Atlas インフラストラクチャを管理するための Atlas ツール、Atlas CLI が提供するのと同様にローカル配置を管理するための Local Atlas ツール、データ操作用の Database ツールという 3 つの主要なカテゴリのツールを提供します。次の表は、各ツールの構成を比較します。
構成比較テーブル
構成要素 | Atlas ツール | ローカル Atlas ツール | Database Tools |
|---|---|---|---|
認証要件 | Required: Atlas API credentials • apiClientId (Service Account ID)• apiClientSecret (Service Account Secret) | Required: Docker runtime • No additional credentials needed • Automatically manages local deployments | Optional: Multiple connection methods • Pre-configured connection string • Atlas credentials for atlas-connect-cluster• Runtime connection via connect tool• Local deployment via atlas-local-connect-deployment |
接続方法 | API-based connection to Atlas Management API • No direct database connection needed • Uses Atlas REST API endpoints | Local deployment management • Uses Docker containers • No external network access required | Direct connection to MongoDB database. Multiple options available: • Configured connection string • Runtime connection prompt • Atlas cluster discovery • Local deployment connection |
権限要件 | Service Account Roles (Atlas project-level): • Project Read Only (minimum for read operations)• Project Owner (for cluster creation/management)• Organization Owner (for project creation) | System Requirements: • Docker runtime permissions • Local file system access • Container management capabilities | Database User Roles (when applicable): • readAnyDatabase (read-only mode)• readWriteAnyDatabase (full operations)• Custom roles for specific databases/collections |
設定オプション | Environment Variables: MDB_MCP_API_CLIENT_ID orMDB_MCP_API_CLIENT_SECRETCommand Line: • --apiClientId• --apiClientSecret | Environment Variables: • DOCKER_HOST (optional)Command Line: • No specific MCP configuration required • Automatically detects Docker runtime | Environment Variables (optional): MDB_MCP_CONNECTION_STRINGCommand Line (optional): • Connection string as positional argument: --connectionStringRuntime Methods: • Interactive connection via LLM prompts • Atlas credential-based discovery |
読み取り専用モードの影響 | • Read operations: ✅ Available • Cluster inspection: ✅ Available • Cluster creation: ❌ Disabled • User management: ❌ Disabled | • Local deployment creation: ✅ Available • Deployment inspection: ✅ Available • Container management: ✅ Available • No read-only restrictions | • Read operations: ✅ Available • Query operations: ✅ Available • Aggregations: ✅ Available as long as they don't have a $out or $merge stage.• Insert/Update/Delete: ❌ Disabled • Index creation: ❌ Disabled |
ツールカテゴリ | Can be disabled with: --disabledTools atlas orMDB_MCP_DISABLED_TOOLS="atlas" | Can be disabled with: --disabledTools atlas orMDB_MCP_DISABLED_TOOLS="atlas" | Can be disabled with: --disabledTools mongodb orMDB_MCP_DISABLED_TOOLS="mongodb" |
ネットワーク要件 | Outbound HTTPS to Atlas API: • Standard internet connection | Local Docker Network: • Docker daemon access • Local port availability • No external network requirements | Connection to MongoDB cluster (when applicable): • Atlas: mongodb+srv:// (port 27017)• Sharded clusters (port 27016) • Self-managed: Custom host/port • Local deployments: Docker network • VPC/network access as required |
利用可能な操作 | • Organization management • Project management • Cluster lifecycle (create, inspect, delete) • Database user management • Access list configuration • Performance Advisor recommendations • Alert management | • Local deployment creation and management • Container lifecycle operations • Local cluster configuration • Development environment setup • Testing deployment management | • CRUD operations (find, insert, update, delete) • Aggregation pipelines • Index management • Collection and database administration • Schema inspection • Vector search operations • Data export |
エラーシナリオ | Missing API Credentials: Atlas tools return: "Atlas API credentials not configured" Insufficient Permissions: HTTP 403 errors from Atlas API | Docker Unavailable: "Docker daemon not running" or "Docker not installed" Container Issues: Port conflicts, resource constraints | Connection Failures (when configured): Network timeouts, authentication failures Missing Database Permissions: MongoDB authorization errors |
一時的な認証情報 | Not applicable: Uses persistent service account credentials | Not applicable: Local deployments use container-managed authentication | Auto-generated database users (when applicable): When using Atlas API credentials without connection string: • Random username/password • 4-hour expiration by default • Automatic role assignment |
データベース接続メソッド
Database ツールは、さまざまなユースケースとセキュリティ要件に対応するために 複数の接続 方法をサポートしています。
事前構成された接続文字列:
connectionStringCLI、環境変数、または永続的なデータベースアクセス用の構成ファイルを使用して を構成します。Atlas クラスター接続:
atlas-connect-clusterAtlas API認証情報とともに ツールを使用して、Atlas クラスターを自動的に検出して接続します。ランタイム接続:
connectツールを使用して、LVM の対話中に接続文字列を対話的に提供します。事前構成は必要ありません。ローカル配置接続:
atlas-local-connect-deploymentDockerと を使用してローカル Atlas 配置を作成し、接続します。Dockerは必要ですが、構成は必要ありません。
セキュリティ推奨事項:
本番環境データベース: 環境変数または Atlas API認証情報を介して事前構成された接続文字列を使用し、安全な自動接続を実現します。
開発/テスト: ランタイム接続またはローカル配置により、永続的な構成なしで柔軟性が向上します。
チャットのセキュリティ: チャット履歴が保存されたり、サードパーティと共有されたりしないと保証されない限り、ランタイム接続メソッドは使用されません。