mcp-http-adapter

The MCP HTTP adapter is a tool that allows you to expose a stdio MCP server over HTTP, which is typically only runnable locally. By creating a configuration file that specifies the command, arguments, and environment variables, you can accept requests from MCP clients. This enables broader access to the MCP server for a wider audience.

GitHub Stars

1

User Rating

Not Rated

Favorites

0

Views

23

Forks

0

Issues

0

README
MCP HTTP adapter

Adapter that allows you to expose a stdio MCP server over streamable HTTP. Useful for exposing servers that can otherwise only be run locally with a broader audience.

graph LR
  server(MCP server)
	adapter[This adapter]
	client(MCP client)

	client -->|HTTP| adapter
  adapter -->|stdio| server
Usage
Creating the config file

Before running the adapter, you first need to create a configuration file (e.g. config.json) describing the command that should be run to start the stdio MCP server that we're going to proxy.

This config file requires the following fields:

  • command: The command to run.
  • args: List of arguments to pass to the command.
  • env: List of environment variables to include in the environment.

For example, for the Github MCP server this config would look like:

{
  "command": "github-mcp-server",
  "args": ["stdio"],
  "env": ["GITHUB_PERSONAL_ACCESS_TOKEN"]
}
Running using uv

Once you have the config file, you can run the adapter using:

CONFIG_PATH=config.json uv run fastmcp run main.py --transport streamable-http

Note that you'll also need to pass any variables listed in env here as well.

Running using Docker

Alternatively, you can also run the server using Docker. Note that in this case you'll need to make sure that the required MCP server binaries are also included in the image, together with your config file.

For an example involving the Github MCP server, see the docker/github folder. You can also run this example locally using:

docker run --rm -it -p 8000:8000 --env-file .env jrderuiter/mcp-stdio-adapter-github

where the .env file should contain the environment variable GITHUB_PERSONAL_ACCESS_TOKEN with a GitHub PAT token.

Contributing
  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request
Author

Julian de Ruiter