{
  "markdown": "# Mongo Scout MCP\n\nScout your MongoDB databases with AI - A production-ready Model Context Protocol server with built-in safety features, live monitoring, and data quality tools.\n\n[![npm](https://img.shields.io/npm/v/mongo-scout-mcp)](https://www.npmjs.com/package/mongo-scout-mcp) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n\n## What You Get\n\nYou ask:\n\n> *\"Anything unusual happening with order volume this month?\"*\n\nMongo Scout returns:\n\n---\n\n### Volume Analysis: `orders`\n\n**Statistics** (last 30 days)\n| Metric | Value |\n|--------|-------|\n| Daily Average | 2,847 documents |\n| Standard Deviation | 412 |\n| Min / Max | 1,923 / 3,601 |\n\n**Anomalies Detected**\n- **Feb 14** — 5,892 documents (+7.4σ) — Valentine's Day spike\n- **Feb 22** — 847 documents (-4.9σ) — Payment gateway outage window\n- **Mar 1** — 4,201 documents (+3.3σ) — Month-start subscription renewals\n\n**Recommendations**\n- Feb 22 drop warrants investigation — possible data loss during outage\n- Consider auto-scaling rules for predictable spikes (month boundaries, holidays)\n- Set up alerts for volumes exceeding ±3σ from rolling average\n\n---\n\nThat's `detectVolumeAnomalies` — one of 50 tools covering exploration, querying, diagnostics, monitoring, data quality, and safe writes.\n\n## Quick Start\n\n### Claude Code\n\n```bash\nclaude mcp add mongo-scout -- npx -y mongo-scout-mcp mongodb://localhost:27017 mydb\n```\n\nThen ask: *\"What collections do I have and what do their schemas look like?\"*\n\n<details>\n<summary>Claude Desktop</summary>\n\nAdd to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):\n\n```json\n{\n  \"mcpServers\": {\n    \"mongo-scout\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongo-scout-mcp\", \"mongodb://localhost:27017\", \"mydb\"],\n      \"type\": \"stdio\"\n    }\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Cursor / VS Code</summary>\n\nAdd to your MCP settings:\n\n```json\n{\n  \"mongo-scout\": {\n    \"command\": \"npx\",\n    \"args\": [\"-y\", \"mongo-scout-mcp\", \"mongodb://localhost:27017\", \"mydb\"]\n  }\n}\n```\n\n</details>\n\n<details>\n<summary>Read-Only vs Read-Write</summary>\n\nThe server runs in **read-only mode by default**. For write operations, run a separate instance:\n\n```json\n{\n  \"mcpServers\": {\n    \"mongo-scout-readonly\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongo-scout-mcp\", \"--read-only\", \"mongodb://localhost:27017\", \"mydb\"],\n      \"type\": \"stdio\"\n    },\n    \"mongo-scout-readwrite\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"mongo-scout-mcp\", \"--read-write\", \"mongodb://localhost:27017\", \"mydb_dev\"],\n      \"type\": \"stdio\"\n    }\n  }\n}\n```\n\n- **mongo-scout-readonly**: Safe exploration, no risk of data modification\n- **mongo-scout-readwrite**: Write operations when explicitly needed\n\n</details>\n\n## Tools\n\n### Explore — understand your database\n\n- `listDatabases` — all databases in the instance\n- `getDatabaseStats` — storage and performance statistics\n- `listCollections` — collections in the current database\n- `getCollectionStats` — size, document count, index details\n- `inferSchema` — schema inference from sampled documents\n\n### Query — find and analyze documents\n\n- `find` — query documents with filtering, sorting, projection\n- `aggregate` — run aggregation pipelines\n- `count` — count documents matching a query\n- `distinct` — unique values for a field\n- `textSearch` — full-text search across indexed fields\n- `explainQuery` — query execution plan analysis\n\n### Diagnose — spot problems early\n\n- `detectVolumeAnomalies` — unusual patterns in document volume\n- `analyzeQueryPerformance` — query optimization using explain plans\n\n### Monitor — watch it live\n\n- `getServerStatus` — server performance metrics\n- `getCurrentOperations` — currently running operations\n- `getConnectionPoolStats` — connection pool health\n- `getProfilerStats` — profiler data and slow operations\n- `getLiveMetrics` — real-time metrics with continuous updates\n- `getHottestCollections` — collections with highest activity\n- `getCollectionMetrics` — detailed per-collection metrics\n- `getSlowestOperations` — slow query tracking\n- `runAdminCommand` — execute admin commands\n\n### Data Quality — trust your data\n\n- `findDuplicates` — duplicate documents by field combination\n- `findOrphans` — orphaned references across collections\n- `findMissingFields` — documents missing required fields\n- `findInconsistentTypes` — type inconsistencies across documents\n- `validateDocuments` — custom validation with MongoDB `$expr`\n\n### Relationships — follow the references\n\n- `exploreRelationships` — multi-hop relationship traversal\n\n### Time Series — temporal analysis\n\n- `findRecent` — documents within a time window\n- `findInTimeRange` — date range queries with optional grouping\n\n### Indexes — manage your indexes\n\n- `listIndexes` — all indexes for a collection\n- `createIndex` — create new indexes\n- `dropIndex` — remove indexes\n\n### Export — get data out\n\n- `exportCollection` — JSON, JSONL, or CSV\n- `cloneCollection` — clone with filtering and index copying\n\n### Preview — dry-run before changing anything\n\n- `previewUpdate` / `previewDelete` — see what would change before committing\n- `previewBulkWrite` — preview bulk operations\n\n### Write (read-write only) — safe modifications\n\n- `insertOne` / `insertMany` — insert documents\n- `updateOne` / `updateMany` — update with dryRun and maxDocuments limits\n- `replaceOne` — replace a single document\n- `findOneAndUpdate` — find and update atomically\n- `deleteOne` / `deleteMany` — delete with dryRun and maxDocuments limits\n- `bulkWrite` — multiple write operations in one call\n- `renameField` — rename fields with dry-run and index migration\n- `createCollection` / `dropCollection` — collection management\n\n## Security\n\n- **Read-only by default** — write operations must be explicitly enabled\n- All queries are validated and sanitized\n- MongoDB operator injection protection\n- Connection string credential redaction in logs\n- Rate limiting on all operations\n- Response size limits to prevent memory exhaustion\n\n## Examples\n\n> *\"What collections do I have and what's the schema of users?\"*\n\n```\nlistCollections()\ninferSchema({ collection: \"users\", sampleSize: 50 })\n```\n\n> *\"Find duplicate emails in the users collection.\"*\n\n```\nfindDuplicates({ collection: \"users\", fields: [\"email\"], options: { limit: 100 } })\n```\n\n> *\"Show me order volume anomalies over the last month.\"*\n\n```\ndetectVolumeAnomalies({ collection: \"orders\", timestampField: \"createdAt\", options: { groupBy: \"day\", lookbackPeriods: 30 } })\n```\n\n> *\"What's happening on the server right now?\"*\n\n```\ngetServerStatus()\ngetCurrentOperations()\ngetHottestCollections({ limit: 5, sampleDuration: 5000 })\n```\n\n> *\"Find orders that reference deleted users.\"*\n\n```\nfindOrphans({ collection: \"orders\", localField: \"userId\", foreignCollection: \"users\", foreignField: \"_id\" })\n```\n\n> *\"Export the products collection as CSV.\"*\n\n```\nexportCollection({ collection: \"products\", options: { format: \"csv\", flatten: true } })\n```\n\n## Configuration\n\n| Variable | Default | Description |\n|----------|---------|-------------|\n| `ENABLE_LOGGING` | `false` | Enable file logging |\n| `LOG_DIR` | `./logs` | Log file directory |\n\nCLI flags: `--read-only` (default), `--read-write`, `--mode <mode>`\n\n## Logging\n\nFile logging is disabled by default. Set `ENABLE_LOGGING=true` to enable. Two log files are created in `LOG_DIR`:\n\n- **tool-usage.log** — every tool call with timestamp, name, and arguments\n- **error.log** — errors with stack traces\n\nConnection strings are automatically redacted in all output.\n\n## ObjectId Format\n\nBoth formats accepted:\n\n```json\n{ \"_id\": { \"$oid\": \"507f1f77bcf86cd799439011\" } }\n{ \"_id\": \"507f1f77bcf86cd799439011\" }\n```\n\n## Development\n\n```bash\ngit clone https://github.com/bluwork/mongo-scout-mcp.git\ncd mongo-scout-mcp\npnpm install\npnpm build\npnpm test\n```\n\n## License\n\nApache-2.0\n",
  "bytes": 7872,
  "sha": "8bcaf2546e3ad5e1e38d851e800da2acf40cab47d675d918a76211e18beb1f36",
  "repo_slug": "bluwork/mongo-scout-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_bluwork_mongo_scout_mcp_725a65e3/readme"
}