McGravity Proxy
HTTP-SSETool connecting multiple MCP servers into one unified service for scaling and reuse.
Tool connecting multiple MCP servers into one unified service for scaling and reuse.
McGravity is a tool that connects multiple MCP (Model Context Protocol) servers into one unified service. It lets you reuse the same MCP server and scale underlying MCP server connections almost infinitely.
The current version works as a basic CLI tool, but McGravity will grow to become a full-featured proxy for MCP servers - like Nginx but for modern Gen AI tools and servers.
Without McGravity:
┌─────────┐ ┌─────────┐
│ Client │────▶│MCP │
│ │ │Server 1 │
└─────────┘ └─────────┘
│
│ ┌─────────┐
└──────────▶│MCP │
│Server 2 │
└─────────┘
With McGravity:
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Client │────▶│McGravity│────▶│MCP │
│ │ │ │ │Server 1 │
└─────────┘ └─────────┘ └─────────┘
│
│ ┌─────────┐
└─────────▶│MCP │
│Server 2 │
└─────────┘
McGravity solves these problems:
# Install dependencies bun install # Build the project into a single executable bun build src/index.ts --compile --outfile mcgravity
McGravity is available on Docker Hub: tigranbs/mcgravity.
docker pull tigranbs/mcgravity # Basic usage docker run -p 3001:3001 tigranbs/mcgravity http://mcp1.example.com http://mcp2.example.com # With custom host and port docker run -p 4000:4000 tigranbs/mcgravity --host 0.0.0.0 --port 4000 http://mcp1.example.com
Basic command:
./mcgravity <mcp-server-address1> <mcp-server-address2> ...
With options:
./mcgravity --host localhost --port 3001 http://mcp1.example.com http://mcp2.example.com
Using configuration file:
./mcgravity --config config.yaml
--host <host>
: Host to bind the server to (default: localhost)--port <port>
: Port to bind the server to (default: 3001)--config <path>
: Path to the config file (default: config.yaml)--mcp-version <version>
: Version of the MCP server (default: 1.0.0)--mcp-name <name>
: Name of the MCP server (default: mcgravity)--help
: Show help informationMcGravity can be configured using a YAML file. See config.example.yaml
for a sample configuration:
name: mcgravity version: 1.0.0 description: A simple MCP server servers: echo-server: url: http://localhost:3000/sse name: echo-server version: 1.0.0 description: A simple echo server tags: - echo
You can run the included echo server example for testing:
# Start the echo server first bun examples/echo-server.ts # Then start McGravity pointing to the echo server ./mcgravity --config config.yaml
Start McGravity with default settings:
./mcgravity http://mcp1.example.com http://mcp2.example.com
Specify host and port:
./mcgravity --host 0.0.0.0 --port 4000 http://mcp1.example.com http://mcp2.example.com
To run all tests:
bun test
To run integration tests only:
bun run test:integration
The integration tests verify that McGravity can:
For more details about the test suite, see the test README.
The tests are automatically run in GitHub Actions CI on push and PR events.
McGravity will expand to include:
This project uses:
The configuration is optimized for Bun with appropriate TypeScript settings for the runtime environment.
Run the following commands:
# Format code with Prettier bun run format # Check if code is properly formatted bun run format:check # Lint code with ESLint bun run lint # Fix auto-fixable linting issues bun run lint:fix
VS Code is configured to format code on save and provide linting information when the recommended extensions are installed.
Contributions are welcome! Feel free to open issues or submit pull requests.