MCP Gateway
A TypeScript implementation of a Model Context Protocol (MCP) gateway that manages multiple MCP servers and provides a unified interface for tools.
Features
- Manages multiple MCP servers through a single gateway
- Supports both SSE and STDIO transports
- Configurable through JSON configuration
- Improved process management using spawn-rx
- TypeScript implementation for better type safety
Setup
- Clone the repository
- Install dependencies:
npm install
- Copy the example configuration:
cp config.json.example config.json
- Edit
config.json
to configure your MCP servers - Build the project:
npm run build
- Start the gateway:
npm start
Configuration
The gateway is configured through config.json
. Each MCP server needs:
command
: The command to run the serverargs
: Array of command argumentsenv
: (Optional) Environment variables for the server
Example configuration:
{
"mcp": {
"servers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/allowed/directory"
]
}
}
}
}
Development
npm run build
: Build the TypeScript codenpm start
: Start the gatewaynpm run dev
: Run TypeScript in watch modenpm run dev:watch
: Run both TypeScript watch and nodemon
License
ISC