MCP-Gateway
by qneville
README.md
# MCP Gateway
This is a simple gateway that connects to multiple child MCP servers and forwards tool calls to them.
## TL;WR; I just wanna try it
You can run this out of the box with a couple of terminals open.
### 0. Installing dependencies
```sh
npm install
```
### 1. Running the Gateway
To run the gateway and automatically include the `config.json` file
```sh
npm run gateway
```
-OR-
To run the inspector and connect to the gateway. Use the `🔑 Session token` from the output in `Configuration > Proxy Session Token` in the inspector to connect to the gateway.
```sh
npm run inspect
```
### 2. Running the demo client
The client is a simple CLI that can be used to interact with the gateway with a simple loop. You will need to provide an OpenAI API key in the `.env` file first.
```sh
npm run client
```
## Customizing the Gateway
To run the gateway, you need to provide a configuration file. An example configuration file is provided in the `config.json` file that should do the job out of the box.
```json
{
"server": {
"name": "mcp-gateway-server",
"version": "0.0.1"
},
"client": {
"name": "mcp-gateway-client",
"version": "0.0.1"
},
"servers": [
{
"name":"Friendly name for Canadian Weather server",
"transport": "stdio",
"stdio": {
"command": "node",
"args": ["./example_tools/canada_weather.js"]
},
"clientWhitelist": ["*"],
"prefix": "canada_weather_"
},
{
"name":"Friendly name for USA Weather server",
"transport": "stdio",
"stdio": {
"command": "node",
"args": ["./example_tools/usa_weather.js"]
},
"clientWhitelist": ["*"],
"prefix": "usa_weather_"
}
]
}
```
## Example Tools
The example tools are provided in the `example_tools` directory, which are simple MCP servers built with Fast MCP.
They are simple connectors for weather APIs for Canada and the United States, providing weather forecasts and alerts for the given location.
You can replace these and add connection details in the `config.json` file.
## Future stuff:
- Add a way to filter available tools based on the client's whitelist
- Add WebSocket and HTTP Transport supportThis server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues