Labsco
anirudhlath logo

Meta MCP Server

β˜… 2

from anirudhlath

An MCP server for intelligent tool routing, using a Qdrant vector database and LM Studio for embeddings.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeNeeds API keys

MCP Router

An intelligent MCP (Model Context Protocol) router that routes requests to child MCP servers using advanced tool selection strategies. This server acts as a smart proxy, optimizing context length and reducing LLM confusion by selectively exposing only the most relevant tools based on the current context.

Features

Intelligent Tool Selection

  • Vector Search: Fast semantic similarity using embeddings
  • LLM Selection: AI-powered tool selection using local LLMs
  • RAG-Based Selection: Context-augmented selection using retrieved documentation

Automatic Setup

  • Container Runtime Detection: Automatically uses Apple Container Framework on macOS or Docker
  • Dependency Management: Handles all Python dependencies and model downloads
  • Configuration Discovery: Auto-detects existing MCP server configurations
  • Infrastructure Setup: Starts Qdrant and other required services automatically

Web Management Interface

  • Real-time server monitoring and logs
  • Interactive configuration editor
  • Tool usage analytics and metrics
  • Child server status monitoring

Production Ready

  • Comprehensive logging and error handling
  • Performance monitoring and caching
  • Hot-reload configuration support
  • Docker deployment ready

Command Options

uvx mcp-router [OPTIONS]

Options:
  --config PATH              Path to configuration file (auto-detected)
  --mcp-servers-json PATH    Path to MCP servers JSON (auto-detected)
  --web-ui / --no-web-ui     Enable web UI (default: enabled)
  --host TEXT                Server host
  --port INTEGER             Server port
  --log-level TEXT           Log level (DEBUG, INFO, WARNING, ERROR)
  --setup / --no-setup       Auto-setup infrastructure (default: enabled)
  --help                     Show this message and exit

Tool Selection Strategies

1. Vector Search Strategy (Default)

  • Fast semantic similarity using embeddings
  • Suitable for most use cases
  • ~50ms response time

2. LLM Selection Strategy

  • AI-powered context-aware selection
  • Best for complex queries
  • Requires LM Studio (optional)
  • ~200-500ms response time

3. RAG-Based Strategy

  • Documentation-enhanced selection
  • Highest accuracy with good docs
  • ~100-200ms response time

Integration with Claude Code

MCP Router can automatically configure itself for Claude Code:

  1. Run uvx mcp-router once to start the server
  2. The server will create the necessary Claude Code configuration
  3. Restart Claude Code
  4. MCP Router will be available as an MCP server

The configuration is automatically added to:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux/Windows: ~/.config/claude/claude_desktop_config.json

Web Interface

Access the web interface at http://localhost:8080 to:

  • Monitor server status and performance
  • View real-time logs and metrics
  • Manage child server configurations
  • Explore available tools and their usage
  • Test tool selection strategies

Architecture

MCP Router consists of:

  • Server Core: Main MCP server handling client connections
  • Tool Router: Implements intelligent tool selection strategies
  • Child Server Manager: Manages lifecycle of child MCP servers
  • Vector Store: Qdrant-based embedding storage and similarity search
  • Web Interface: Real-time monitoring and configuration dashboard
  • Auto-Setup: Infrastructure detection and configuration

Security Considerations

  • Run child servers with minimal privileges
  • Use environment variables for sensitive configuration
  • Review child server configurations before use
  • Monitor logs for unusual activity
  • Keep dependencies updated with uvx auto-updates

Contributing

  1. Fork the repository

  2. Clone your fork and set up development environment:

    git clone https://github.com/yourusername/meta-mcp.git
    cd meta-mcp
    uv sync --dev  # Install dependencies
    uv run pre-commit install  # Set up pre-commit hooks
  3. Create a feature branch:

    git checkout -b feature/amazing-feature
  4. Make your changes with tests. Pre-commit hooks will automatically:

    • Format code with Ruff
    • Lint and fix issues
    • Check type annotations with mypy
    • Validate YAML/JSON files
  5. Run all quality checks manually:

    ./scripts/check-all.sh
    # Or individually:
    uv run ruff format src/ tests/
    uv run ruff check src/ tests/ --fix
    uv run mypy src/
    uv run pytest
  6. Run tests manually when needed:

    uv run pre-commit run pytest --hook-stage manual
  7. Submit a pull request with a clear description of changes

Development Setup

# Clone your fork
git clone https://github.com/yourusername/meta-mcp.git
cd meta-mcp

# Install dependencies
uv sync --extra dev --extra web

# Run tests
uv run pytest

# Run the development version
uv run mcp-router start --log-level DEBUG

Publishing

This project uses GitHub Actions for automated publishing to PyPI. To create a new release:

  1. Create a new tag: git tag v0.1.1
  2. Push the tag: git push origin v0.1.1
  3. GitHub Actions will automatically build and publish to PyPI

License

MIT License - see LICENSE file for details.