| 1 | <div align="center"> |
| 2 | <picture> |
| 3 | <source width="600" height="244" srcset="https://github.com/user-attachments/assets/9ca64651-b601-45e3-8ba1-f7bfb91625ab" media="(prefers-color-scheme: dark)"> |
| 4 | <source width="600" height="244" srcset="https://github.com/user-attachments/assets/5ee33450-f9ee-4e47-b0ed-0d302110c4ce"" media="(prefers-color-scheme: light)"> |
| 5 | <img src="https://github.com/user-attachments/assets/9ca64651-b601-45e3-8ba1-f7bfb91625ab" alt="Nexus logo"> |
| 6 | </picture> |
| 7 | </div> |
| 8 | |
| 9 | <p align="center"> |
| 10 | Plug in all your MCP servers, APIs, and LLM providers. Route everything through a unified endpoint. <br /> |
| 11 | Aggregate, govern, and control your AI stack. |
| 12 | </p> |
| 13 | |
| 14 | ## Features |
| 15 | |
| 16 | - **MCP Server Aggregation**: Connect multiple MCP servers (STDIO, SSE, HTTP) through a single endpoint |
| 17 | - **LLM Provider Routing**: Unified interface for OpenAI, Anthropic, Google, and AWS Bedrock LLM providers with full tool calling support |
| 18 | - **Context-Aware Tool Search**: Intelligent fuzzy search across all connected tools using natural language queries |
| 19 | - **Protocol Support**: Supports STDIO (subprocess), SSE (Server-Sent Events), and streamable HTTP MCP servers |
| 20 | - **Flexible Configuration**: TOML-based configuration with environment variable substitution |
| 21 | - **Security**: Built-in CORS, CSRF protection, OAuth2, and TLS support |
| 22 | - **Rate Limiting**: Multi-level rate limiting with in-memory or Redis backends |
| 23 | - **Docker Ready**: Available as a container image with minimal configuration needed |
| 24 | |
| 25 | ## Installation |
| 26 | |
| 27 | ### Quick Install (Linux/Windows (WSL)/macOS) |
| 28 | |
| 29 | ```bash |
| 30 | curl -fsSL https://nexusrouter.com/install | bash |
| 31 | ``` |
| 32 | |
| 33 | ### Docker |
| 34 | |
| 35 | Pull the latest image: |
| 36 | ```bash |
| 37 | docker pull ghcr.io/grafbase/nexus:latest |
| 38 | ``` |
| 39 | |
| 40 | Or use the stable version: |
| 41 | ```bash |
| 42 | docker pull ghcr.io/grafbase/nexus:stable |
| 43 | ``` |
| 44 | |
| 45 | Or use a specific version: |
| 46 | ```bash |
| 47 | docker pull ghcr.io/grafbase/nexus:X.Y.Z |
| 48 | ``` |
| 49 | |
| 50 | ### Build from Source |
| 51 | |
| 52 | ```bash |
| 53 | git clone https://github.com/grafbase/nexus |
| 54 | cd nexus |
| 55 | cargo build --release |
| 56 | ``` |
| 57 | |
| 58 | ## Running Nexus |
| 59 | |
| 60 | ### Using the Binary |
| 61 | |
| 62 | ```bash |
| 63 | nexus |
| 64 | ``` |
| 65 | |
| 66 | ### Using Docker |
| 67 | |
| 68 | ```bash |
| 69 | docker run -p 8000:8000 -v /path/to/config:/etc/nexus.toml ghcr.io/grafbase/nexus:latest |
| 70 | ``` |
| 71 | |
| 72 | ### Docker Compose Example |
| 73 | |
| 74 | ```yaml |
| 75 | services: |
| 76 | nexus: |
| 77 | image: ghcr.io/grafbase/nexus:latest |
| 78 | ports: |
| 79 | - "8000:8000" |
| 80 | volumes: |
| 81 | - ./nexus.toml:/etc/nexus.toml |
| 82 | environment: |
| 83 | - GITHUB_TOKEN=${GITHUB_TOKEN} |
| 84 | healthcheck: |
| 85 | test: ["CMD", "curl", "-f", "http://localhost:8000/health"] |
| 86 | interval: 30s |
| 87 | timeout: 10s |
| 88 | retries: 3 |
| 89 | ``` |
| 90 | |
| 91 | ## Configuration |
| 92 | |
| 93 | Create a `nexus.toml` file to configure Nexus: |
| 94 | |
| 95 | ```toml |
| 96 | # LLM Provider configuration |
| 97 | [llm.providers.openai] |
| 98 | type = "openai" |
| 99 | api_key = "{{ env.OPENAI_API_KEY }}" |
| 100 | forward_token = true |
| 101 | |
| 102 | # Model configuration (at least one model required per provider) |
| 103 | [llm.providers.openai.models.gpt-4] |
| 104 | [llm.providers.openai.models.gpt-3-5-turbo] |
| 105 | |
| 106 | [llm.providers.anthropic] |
| 107 | type = "anthropic" |
| 108 | api_key = "{{ env.ANTHROPIC_API_KEY }}" |
| 109 | |
| 110 | [llm.providers.anthropic.models.claude-3-5-sonnet-20241022] |
| 111 | |
| 112 | # MCP Server configuration |
| 113 | [mcp.servers.github] |
| 114 | url = "https://api.githubcopilot.com/mcp/" |
| 115 | auth.token = "{{ env.GITHUB_TOKEN }}" |
| 116 | |
| 117 | [mcp.servers.filesystem] |
| 118 | cmd = ["npx", "-y", "@modelcontextprotocol/server-filesystem", "/home/YOUR_USERNAME/Desktop"] |
| 119 | |
| 120 | [mcp.servers.python_server] |
| 121 | cmd = ["python", "-m", "mcp_server"] |
| 122 | env = { PYTHONPATH = "/opt/mcp" } |
| 123 | cwd = "/workspace" |
| 124 | ``` |
| 125 | |
| 126 | ### Configuration Options |
| 127 | |
| 128 | #### Server Configuration |
| 129 | |
| 130 | - `server.listen_address`: The address and port Nexus will listen on (default: `127.0.0.1:8000`) |
| 131 | - `server.health.enabled`: Enable health endpoint (default: `true`) |
| 132 | - `server.health.path`: Health check endpoint path (default: `/health`) |
| 133 | |
| 134 | #### LLM Configuration |
| 135 | |
| 136 | - `llm.enabled`: Enable LLM functionality (default: `true`) |
| 137 | - `llm.protocols.openai.enabled`: Enable OpenAI protocol endpoint (default: `true`) |
| 138 | - `llm.protocols.openai.path`: OpenAI endpoint path (default: `/llm/openai`) |
| 139 | - `llm.protocols.anthropic.enabled`: Enable Anthropic protocol endpo |