MCP ExplorerExplorer

Mcp Http Adapter

@jrderuiteron 13 days ago
1 MIT
FreeCommunity
AI Systems
Adapter that allows you to expose a stdio MCP server over streamable HTTP.

Overview

What is Mcp Http Adapter

mcp-http-adapter is an adapter that allows you to expose a stdio MCP server over streamable HTTP, making it accessible to a broader audience beyond local execution.

Use cases

Use cases for mcp-http-adapter include exposing a GitHub MCP server to allow multiple clients to access it over HTTP, integrating local services with web applications, and facilitating remote access to local MCP functionalities.

How to use

To use mcp-http-adapter, create a configuration file (e.g., config.json) that specifies the command to run the stdio MCP server. Then, run the adapter using the command ‘CONFIG_PATH=config.json uv run fastmcp run main.py --transport streamable-http’. Alternatively, it can be run using Docker with the appropriate setup.

Key features

Key features of mcp-http-adapter include the ability to expose local MCP servers over HTTP, support for configuration via JSON files, and compatibility with Docker for easy deployment.

Where to use

mcp-http-adapter can be used in scenarios where you need to make a local MCP server accessible over the internet, such as in web applications, APIs, or remote services.

Content

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

Tools

No tools

Comments