Skip to main content

MCP Relay

Your AI in the cloud. Your MCP servers on your computer.

Connect your cloud AI agent to the local MCP servers you choose, through a single remote endpoint.

Windows, macOS & Linux · Outbound connection · Your choice of MCP servers

CI PyPI Docker image License: MIT Python 3.14+

How it works · Get started · Why MCP Relay? · Guides

MCP Relay demo: start the Server, start the Client, then an MCP client lists and calls a local tool through the relay

A real local run: Server, Client and a small stdio MCP server on one machine, called from a Python MCP client.

Your local MCP tools, available to your cloud AI

  • No inbound port. The Client on your computer connects out to the cloud Server and reconnects on its own after a network drop.
  • One endpoint for all your servers. Each local MCP server, stdio or Streamable HTTP, is published under a name you choose.
  • Native tools. Your servers' tools appear directly in your AI's tool list as <alias>_<tool>, such as localtools_read_file, and update when servers start, stop or change.
  • You decide what is exposed. Publish only the tools you allow per server; remote server management stays off unless you turn it on.

Alpha: one Server, one Client, one user. Configuration and the Server/Client contract may change between releases; see the release notes.

How it works

flowchart LR
    subgraph Cloud
        AI[Your AI agent] -->|MCP over HTTPS|Server[Relay Server]
    end
    subgraph Your computer
        Client[Relay Client] --> A[Local MCP server]
        Client --> B[Another MCP server]
    end
    Client -->|Outbound secure WebSocket|Server

Your AI agent calls one MCP endpoint on Relay Server. Relay Client, on your computer, carries each call to the right local MCP server and returns the result. The built-in relay_status tool reports the state of the whole chain.

Get started

You need a cloud AI agent that supports MCP over Streamable HTTP with an Authorization header, a cloud host reachable over HTTPS (a TLS reverse proxy or a secure tunnel), and your Windows, macOS or Linux computer. MCP Relay does not provide hosting, DNS or TLS.

1. Install

On the cloud host and on your computer:

uv tool install mcp-relay

No uv? The one-line installer sets it up first:

# Linux and macOS
curl -fsSL https://raw.githubusercontent.com/kxlion/mcp-relay/main/scripts/install.sh | bash
# Windows (PowerShell 5.1 or newer)
iex (irm https://raw.githubusercontent.com/kxlion/mcp-relay/main/scripts/install.ps1)

To read the installer before running it, or to pin a release, see Install and upgrade.

2. Create two tokens

Token Shared by
RELAY_CLIENT_TOKEN Server and Client
RELAY_MCP_TOKEN Server and your AI agent

Use two different random values of 32–256 printable ASCII characters without spaces, for example from openssl rand -hex 32. Put them in ~/.mcp-relay/.env (%USERPROFILE%\.mcp-relay\.env on Windows), readable only by your user. See credentials.

3. Start the Server

On the cloud host, run mcp-relay onboard and choose Server only. Then route these two addresses through your TLS proxy, keeping the Authorization header and allowing long-lived WebSocket connections:

Public address Internal destination
https://relay.example.com/mcp http://127.0.0.1:8000/mcp
wss://relay.example.com/ws http://127.0.0.1:8001/ws, with WebSocket Upgrade
mcp-relay config validate
mcp-relay server

For a proxy on another host or the Docker image, see the deployment guide.

4. Start the Client

On your computer, run mcp-relay onboard, choose Client connected to a remote Server and enter your wss://relay.example.com/ws address. MCP Relay bundles no MCP server: declare the ones you already use in ~/.mcp-relay/config.yaml:

mcp_servers:
  localtools:                   # an MCP server already running over HTTP
    url: http://127.0.0.1:9000/mcp
  browser:                      # a stdio MCP server launched by the Client
    command: [npx, "@example/browser-mcp"]  # placeholder package
    tools:                      # optional: publish only these tools
      navigate:
      screenshot:
        description: Capture the current page as a PNG.
mcp-relay config validate
mcp-relay client

Restart the Client after editing config.yaml.

5. Connect your AI agent

Setting Value
Transport Streamable HTTP
URL https://relay.example.com/mcp
Header Authorization: Bearer <RELAY_MCP_TOKEN>, kept in your agent's secret settings

Then ask it:

Call relay_status and tell me which MCP servers and tools are available on my computer.

A live Client and your servers listed as running confirm the whole chain works. If not:

Symptom Check
mcp-relay: command not found Open a new terminal to pick up the updated PATH
Your AI gets 401 or cannot reach /mcp The RELAY_MCP_TOKEN value and the proxy route to port 8000
client_unavailable The Client is running, with the same RELAY_CLIENT_TOKEN as the Server, and /ws reaches port 8001
A server is missing or unavailable Its error in relay_status, and client.log next to your configuration

mcp-relay config show prints the effective settings with secrets redacted. More in troubleshooting.

Want to try it first without a cloud host? Choose Local Server + Client during onboarding; see one computer.

Why MCP Relay?

You want to... With a plain tunnel With MCP Relay
Expose several MCP servers One public URL and one auth setup per server One endpoint; each server published under its own alias
Use stdio MCP servers Needs a separate stdio-to-HTTP bridge Launched and relayed by the local Client
Limit what the AI sees Everything the server offers is exposed Per-server tools: allowlist
Know whether your computer is reachable Guess from timeouts relay_status reports the whole chain
Survive network drops Depends on the tunnel The Client reconnects and the tool list updates itself

Tools such as mcp-remote solve the opposite problem, connecting a local MCP client to a remote server.

Security in brief

  • Both tokens stay out of YAML, command arguments and config show output.
  • The Server listens on loopback by default; keep it behind your TLS proxy.
  • Your AI can add, modify, enable, disable or delete server entries only after mcp-relay config set admin true on your computer.
  • MCP Relay relays the servers you configure; what their tools can do depends on those servers and their own permissions. Their results are relayed as is.

See the security policy to report a vulnerability.

Guides

Licensed under the MIT License.

Metadata

Release files for mcp-relay 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-relay 0.1.1
File Size Uploaded
mcp_relay-0.1.1.tar.gz 319.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcp-relay 0.1.1
File Interpreter ABI Platform
mcp_relay-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 431.5 kB

Release files / mcp_relay-0.1.1.tar.gz

Download URL mcp_relay-0.1.1.tar.gz
Size 319.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e6fbaed2461714be66ab1f660c6e1c53cf845e5545cfbc3ee9a2b74aaa5e9a6c
BLAKE2b-256 checksum
How to use checksums
f5ec1d8cc7acf01afa93f881ae8121810f39502f9124e59130c63a8f31d6c190
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mcp_relay-0.1.1-py3-none-any.whl

Download URL mcp_relay-0.1.1-py3-none-any.whl
Size 112.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eca6cc37ca26e0acb51fcf65bbfdd6dfd5ec213236ca96a5e7104161be62d31c
BLAKE2b-256 checksum
How to use checksums
645edbac15918accff1a2235983a5dafb574bcd76631aba83c3c5c669e1357d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page