JSPM

  • Created
  • Published
  • Downloads 69
  • Score
    100M100P100Q68235F
  • License MIT

MongoDB Documentation MCP Server with Semantic Search using Atlas Vector Search

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mongodocs-mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    MongoDB + Voyage AI Docs MCP Server

    🎯 MongoDB Acquired Voyage AI! This MCP server combines documentation from both MongoDB and Voyage AI, providing unified semantic search across both ecosystems.

    First-of-its-kind multi-source documentation MCP (Model Context Protocol) server with semantic search powered by MongoDB Atlas Vector Search and Voyage AI's contextualized embeddings.

    Features

    • 🔍 Unified Search: Search across MongoDB AND Voyage AI documentation
    • 🚀 MongoDB Atlas Vector Search: Leverages MongoDB's native vector capabilities
    • 🧠 Voyage Context-3: Latest contextualized embeddings with 32K context window
    • 🔗 Cross-Reference Intelligence: Understands relationships between MongoDB and Voyage docs
    • 📚 Multi-Source Support: MongoDB docs, Voyage docs, Python SDK, TypeScript SDK
    • 💻 Code Intelligence: SDK-aware code examples from both ecosystems
    • 🔄 Incremental Updates: Efficient refresh from multiple GitHub repos
    • 📊 Analytics: Track popular searches and improve results over time

    Why This MCP Server?

    Powered by Voyage Context-3 - The latest breakthrough in contextualized embeddings:

    • 14.24% better than OpenAI-v3-large
    • Cross-chunk reasoning - Understands relationships between document sections
    • First 200M tokens FREE - Get started without cost
    • Context-aware - Chunks from same document are encoded together

    Unlike traditional keyword-based documentation search, this server understands:

    • Intent: "How to make queries faster" finds optimization guides, indexing docs, and performance tips
    • Context: Understands relationships between concepts
    • Learning Paths: Suggests prerequisites and next steps
    • Code Examples: Finds relevant code snippets with explanations

    Prerequisites

    • Node.js 18+
    • MongoDB Atlas account (free tier works)
    • Voyage AI API key (free tier available)
    • Claude Desktop (for MCP integration)

    Installation

    1. Install globally via npm

    npm install -g mongodocs-mcp

    2. Set up environment variables

    Create a .env file:

    # MongoDB Atlas
    MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/
    MONGODB_DB_NAME=mongodocs_mcp
    
    # Voyage AI (voyage-context-3)
    VOYAGE_API_KEY=your_voyage_ai_api_key_here
    VOYAGE_MODEL=voyage-context-3  # Latest contextualized model
    VOYAGE_DIMENSION=1024  # Options: 256, 512, 1024, 2048

    3. Initialize the server

    mongodocs-mcp init

    This will:

    • Test MongoDB and Voyage AI connections
    • Create necessary directories
    • Generate configuration files

    4. Build the search index

    mongodocs-mcp index

    This process:

    • Clones documentation from multiple sources:
      • MongoDB official docs
      • Voyage AI Python SDK
      • Voyage AI TypeScript SDK
      • Voyage AI web documentation
    • Parses and chunks documents intelligently
    • Generates contextualized embeddings using voyage-context-3
    • Creates cross-references between MongoDB and Voyage docs
    • Stores everything in MongoDB Atlas with vector indexes

    Note: Initial indexing takes 45-90 minutes depending on your internet speed.

    5. Configure Claude Desktop

    Add to your claude_desktop_config.json:

    {
      "mcpServers": {
        "mongodb-docs": {
          "command": "mongodocs-mcp",
          "args": ["start"],
          "env": {
            "MONGODB_URI": "your_mongodb_uri",
            "VOYAGE_API_KEY": "your_voyage_api_key"
          }
        }
      }
    }

    Or generate the config automatically:

    mongodocs-mcp config

    Usage

    Once configured in Claude Desktop, you can:

    Search Documentation

    MongoDB Queries:

    • "How do I create compound indexes in MongoDB?"
    • "Explain aggregation pipeline with examples"
    • "Show me transaction best practices"

    Voyage AI Queries:

    • "How to use contextualized embeddings?"
    • "Explain voyage-context-3 model"
    • "Show me reranking examples"

    Cross-Ecosystem Queries:

    • "How to implement vector search with MongoDB and Voyage?"
    • "Best practices for embeddings in Atlas Vector Search"
    • "Compare embedding models for MongoDB"

    Find Code Examples

    • "Find Python examples for aggregation"
    • "Show me JavaScript code for bulk operations"

    Explore Concepts

    • "What are the prerequisites for learning sharding?"
    • "Find related topics to change streams"

    CLI Commands

    # Initialize the server
    mongodocs-mcp init
    
    # Build or update search index
    mongodocs-mcp index [--full]
    
    # Test search functionality
    mongodocs-mcp search "your query"
    
    # Show statistics
    mongodocs-mcp stats
    
    # Refresh documentation
    mongodocs-mcp refresh
    
    # Generate Claude config
    mongodocs-mcp config
    
    # Start server (for testing)
    mongodocs-mcp start

    Documentation Sources

    Included Documentation

    1. MongoDB Documentation (github.com/mongodb/docs)

      • Complete MongoDB manual
      • Tutorials and guides
      • API references
    2. Voyage AI Python SDK (github.com/voyage-ai/voyageai-python)

      • Python client documentation
      • Code examples
      • API integration guides
    3. Voyage AI TypeScript SDK (github.com/voyage-ai/typescript-sdk)

      • TypeScript/JavaScript client
      • React integration examples
      • Node.js guides
    4. Voyage AI Web Docs (docs.voyageai.com)

      • Conceptual guides
      • Model documentation
      • Best practices

    Architecture

    Multi-Source Processing

    ┌─────────────────────────────────────┐
    │     Documentation Sources           │
    ├─────────────────────────────────────┤
    │  MongoDB Docs  │  Voyage Python SDK  │
    │  Voyage TS SDK │  Voyage Web Docs    │
    └──────┬──────────────────┬───────────┘
           │                  │
           ▼                  ▼
    ┌─────────────────────────────────────┐
    │    Multi-Source Parser              │
    │  • Extract cross-references         │
    │  • Identify SDK examples            │
    │  • Tag with source metadata        │
    └──────────────┬──────────────────────┘
                   │
                   ▼
    ┌─────────────────────────────────────┐
    │  Contextualized Embeddings          │
    │  • voyage-context-3                 │
    │  • Document-aware encoding          │
    │  • Cross-source relationships       │
    └──────────────┬──────────────────────┘
                   │
                   ▼
    ┌─────────────────────────────────────┐
    │    MongoDB Atlas Vector Search      │
    │  • Unified search index             │
    │  • Source filtering                 │
    │  • Cross-reference navigation       │
    └─────────────────────────────────────┘

    MongoDB Schema

    {
      // Content
      content: "Document content...",
      embedding: [0.123, ...], // 2048-dim vector
      
      // Rich Metadata
      metadata: {
        title: "Compound Indexes",
        section: "Indexes",
        docType: "guide",
        version: "7.0",
        difficulty: "intermediate",
        tags: ["performance", "indexes"]
      },
      
      // Relationships
      relationships: {
        prerequisites: [...],
        related: [...],
        nextSteps: [...]
      },
      
      // Code Examples
      codeExamples: [{
        language: "javascript",
        code: "...",
        description: "..."
      }],
      
      // Search Optimization
      searchMetadata: {
        keywords: [...],
        concepts: [...],
        popularity: 0.85
      }
    }

    Vector Search Pipeline

    1. Query Processing: Convert natural language to embedding
    2. Hybrid Search: Combine vector similarity with text search
    3. Contextual Ranking: Consider relationships and popularity
    4. Result Enrichment: Add related topics and examples

    Advanced Features

    Semantic Search Modes

    • Semantic: Pure vector similarity search using contextualized embeddings
    • Hybrid: Combines vector and text search (default)
    • Exact: Traditional text matching

    Contextualized Embeddings

    This server uses voyage-context-3 which encodes document chunks together, preserving:

    • Inter-chunk context within documents
    • Section relationships and flow
    • Better understanding of references and dependencies

    Filtering

    {
      version: "7.0",
      docType: ["guide", "tutorial"],
      difficulty: "beginner",
      tags: ["aggregation"]
    }

    Relationship Traversal

    The server understands document relationships:

    • Prerequisites (what to read first)
    • Related topics (similar concepts)
    • Next steps (learning progression)

    Performance

    • Search latency: < 200ms (p95)
    • Indexing speed: ~1000 docs/minute
    • Memory usage: < 512MB
    • Concurrent users: 100+

    Development

    Setup

    # Clone repository
    git clone https://github.com/yourusername/mongodocs-mcp
    cd mongodocs-mcp
    
    # Install dependencies
    npm install
    
    # Run in development
    npm run dev

    Testing

    # Run tests
    npm test
    
    # Test search
    npm run cli search "test query"

    Building

    # Build TypeScript
    npm run build
    
    # Package for distribution
    npm pack

    Troubleshooting

    MongoDB Connection Issues

    • Ensure your IP is whitelisted in Atlas
    • Check connection string format
    • Verify database user permissions

    Voyage AI Issues

    • Verify API key is valid
    • Check rate limits (free tier: 50 req/min)
    • Ensure model name is correct

    Indexing Issues

    • Ensure sufficient disk space for docs cache
    • Check network connectivity to GitHub
    • Verify MongoDB Atlas has vector search enabled

    Contributing

    Contributions are welcome! Please:

    1. Fork the repository
    2. Create a feature branch
    3. Add tests for new features
    4. Submit a pull request

    License

    MIT

    Acknowledgments

    • MongoDB for excellent documentation
    • Voyage AI for powerful embeddings
    • Anthropic for the MCP protocol

    Support


    Built with ❤️ for the MongoDB community