About
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.
Why McGravity?
Without McGravity:
┌─────────┐ ┌─────────┐
│ Client │────▶│MCP │
│ │ │Server 1 │
└─────────┘ └─────────┘
│
│ ┌─────────┐
└──────────▶│MCP │
│Server 2 │
└─────────┘With McGravity:
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Client │────▶│McGravity│────▶│MCP │
│ │ │ │ │Server 1 │
└─────────┘ └─────────┘ └─────────┘
│
│ ┌─────────┐
└─────────▶│MCP │
│Server 2 │
└─────────┘McGravity solves these problems:
- Connect to multiple MCP servers through one endpoint
- Balance load between MCP servers
- Provide a single point of access for your applications
Installation
bun install
bun build src/index.ts --compile --outfile mcgravityDocker
McGravity is available on Docker Hub: tigranbs/mcgravity.
docker pull tigranbs/mcgravity
docker run -p 3001:3001 tigranbs/mcgravity http://mcp1.example.com http://mcp2.example.com
docker run -p 4000:4000 tigranbs/mcgravity --host 0.0.0.0 --port 4000 http://mcp1.example.comUsage
Basic command:
./mcgravity <mcp-server-address1> <mcp-server-address2> ...With options:
./mcgravity --host localhost --port 3001 http://mcp1.example.com http://mcp2.example.comUsing configuration file:
./mcgravity --config config.yamlOptions
--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 information
Configuration
McGravity 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:
- echoYou can run the included echo server example for testing:
bun examples/echo-server.ts
./mcgravity --config config.yamlExamples
Start McGravity with default settings:
./mcgravity http://mcp1.example.com http://mcp2.example.comSpecify host and port:
./mcgravity --host 0.0.0.0 --port 4000 http://mcp1.example.com http://mcp2.example.comRunning Tests
To run all tests:
bun testTo run integration tests only:
bun run test:integrationIntegration Tests
The integration tests verify that McGravity can:
- Connect to an MCP server (the example echo server)
- Correctly proxy capabilities from the target MCP server
- Pass requests from clients to the target MCP server and return responses
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.
Future Plans
McGravity will expand to include:
- Web interface for monitoring
- Advanced load balancing
- MCP server health checks
- Authentication and access control
- Plugin system for custom integrations
Development
TypeScript and Code Style
This project uses:
- TypeScript with Bun runtime
- ESLint for code linting with TypeScript-specific rules
- Prettier for code formatting
The configuration is optimized for Bun with appropriate TypeScript settings for the runtime environment.
Run the following commands:
bun run format
bun run format:check
bun run lint
bun run lint:fixVS Code is configured to format code on save and provide linting information when the recommended extensions are installed.
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.