Skip to main content
Glama

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 & Linux · Outbound connection · Your choice of MCP servers

CI PyPI Docker image License: MIT Python 3.14+

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

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

Bring your local MCP tools to your cloud AI

Your AI agent runs in the cloud. The MCP servers it needs run on your computer. MCP Relay connects them: a Server in the cloud receives the agent's requests, and a local Client relays them to your configured MCP servers.

No inbound port or port forwarding is needed on your computer. The local Client opens the connection to the cloud Server and reconnects automatically if that connection is interrupted.

MCP Relay works with MCP servers you supply, using stdio or Streamable HTTP. It does not bundle or guarantee any particular server. The actions your AI can perform depend on the servers you configure and their own permissions.

Project status: alpha. v0.1.0 is the first release; configuration and the Server/Client contract may still change between 0.x versions. The current setup supports one Relay Server, one Relay Client, one user and one computer.

Related MCP server: Brainstorm

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 cloud AI agent connects to one MCP endpoint.

  • Relay Server routes requests between the AI agent and your computer.

  • Relay Client connects your local MCP servers under names you choose.

The tools of your local MCP servers appear directly in your AI's tool list, named <alias>_<tool> (for example localtools_read_file), and the list updates itself when servers start, stop or change. relay_status reports the state of the whole chain. You can restrict each server to the tools you want your AI to see.

You can also let your AI manage the configured servers by explicitly enabling administration on the local Client. This is optional and disabled unless you set admin: true.

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

MCP Relay still needs a public HTTPS/WSS address for its Server: a cloud host behind a TLS reverse proxy, or a secure tunnel in front of the Server. Tools such as mcp-remote solve the opposite problem, connecting a local MCP client to a remote server.

Get started

You need a cloud AI agent supporting MCP over Streamable HTTP with an Authorization header, a cloud host for Relay Server, and your Windows or Linux computer. For remote access, provide an HTTPS/WSS address through a TLS reverse proxy or secure tunnel. MCP Relay does not provision hosting, DNS or TLS.

1. Install on the cloud host and your computer

MCP Relay is published on PyPI. With uv:

uv tool install mcp-relay

uv downloads Python 3.14 when it is not already available. Upgrade later with uv tool upgrade mcp-relay. To pin a release, for example in a script or CI job, install mcp-relay==0.1.0.

Without uv, the one-line installers set up uv, install the same package from PyPI for your user account and start guided setup when a terminal is available.

Linux - requires Bash and curl:

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)

These commands run a remote script that installs the latest release. In the installer's environment, set MCP_RELAY_VERSION=0.1.0 to pin a release and MCP_RELAY_SETUP=skip to skip guided setup.

Guided setup (mcp-relay onboard) is covered in steps 3 and 4: choose Server-only on your cloud host and Client connected to a remote Server on your computer, after preparing the credentials below. On the cloud host, you can run the Server from its Docker image instead; see Run the Server with Docker in step 3. You can cancel setup and rerun mcp-relay onboard when ready.

Linux:

curl -fsSL https://raw.githubusercontent.com/kxlion/mcp-relay/main/scripts/install.sh -o install-mcp-relay.sh
less install-mcp-relay.sh
bash install-mcp-relay.sh

Windows:

irm https://raw.githubusercontent.com/kxlion/mcp-relay/main/scripts/install.ps1 -OutFile .\install-mcp-relay.ps1
Get-Content .\install-mcp-relay.ps1
.\install-mcp-relay.ps1

2. Prepare your credentials

Create two different, randomly generated secrets and supply them through process environment variables or a private ~/.mcp-relay/.env file:

Credential

Where to supply it

RELAY_CLIENT_TOKEN

The cloud Server and your local Client, with the same value

RELAY_MCP_TOKEN

The cloud Server and your AI agent's MCP connection

Each token must contain 32–256 printable ASCII characters without spaces. Use a secure secret generator; length alone does not make a token secure. On Windows, the default directory is %USERPROFILE%\.mcp-relay. Restrict the .env file to your user account (0600 on Linux).

MCP Relay does not generate or save tokens for you. The Client token must be available before Client onboarding. Keep tokens out of YAML, command arguments and URLs, and transfer them between machines through a secure channel.

3. Start the cloud Server

On the cloud host, run guided setup and select Server-only:

mcp-relay onboard

The Server has two separate listeners. With a TLS proxy on the same host, keep both bound to loopback and route requests as follows:

Public address (replace the hostname)

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

Keep these internal ports private. The proxy must support long-lived WebSocket connections and preserve authentication headers. Onboarding configures listener settings; you configure the proxy separately.

Start the Server:

mcp-relay config validate
mcp-relay server

These settings belong in the Server environment or private .env, not YAML:

RELAY_SERVER_MCP_HOST=127.0.0.1
RELAY_SERVER_MCP_PORT=8000
RELAY_SERVER_CLIENT_HOST=127.0.0.1
RELAY_SERVER_CLIENT_PORT=8001

The listener addresses must be distinct. If the proxy is on another host, choose private bind addresses it can reach and restrict access with a firewall.

Each release publishes a Server image for linux/amd64 and linux/arm64 on GitHub Container Registry, tagged with its version (0.1.0, 0.1) and latest. It needs no configuration file: put both tokens in a private .env file as plain KEY=value lines, then run:

docker run -d --name mcp-relay --restart unless-stopped --env-file .env \
  -e RELAY_SERVER_MCP_HOST=0.0.0.0 -e RELAY_SERVER_CLIENT_HOST=0.0.0.0 \
  -p 127.0.0.1:8000:8000 -p 127.0.0.1:8001:8001 \
  ghcr.io/kxlion/mcp-relay:latest server

Inside the container the listeners bind every interface so that Docker can forward them; the 127.0.0.1 port mappings keep them reachable only from the host, for a TLS proxy on the same host. The repository's docker-compose.yml runs the same Server but publishes both ports on every host interface: restrict them with a firewall or change the mappings. The image is for the cloud Server; run the Client on your computer, next to your MCP servers.

4. Connect your local MCP servers

On your computer, run guided setup and choose Client connected to a remote Server:

mcp-relay onboard

Select Remote and enter your wss://relay.example.com/ws address. The Client reads the RELAY_CLIENT_TOKEN you supplied in step 2.

Declare your MCP servers under mcp_servers in the generated ~/.mcp-relay/config.yaml. For example, if you already run a local Streamable HTTP MCP server on port 9000, add:

mcp_servers:
  localtools:
    url: http://127.0.0.1:9000/mcp

Replace that URL with your server's address. For a server launched as a local process, use command with its executable and arguments instead of url. Registry-based declarations use source. Add tools: to publish only some of a server's tools. See the server configuration reference for the entry formats and per-server credentials.

You choose and configure the underlying MCP servers separately; Relay does not supply browser, desktop or terminal tools of its own.

Start the Client:

mcp-relay config validate
mcp-relay client

Keep the cloud Server and local Client running. Manual YAML edits take effect after restarting the Client. Use Ctrl+C in the corresponding terminal to stop either process.

5. Connect your cloud AI agent

Add an MCP connection to your agent:

Setting

Value

Transport

Streamable HTTP

URL

https://relay.example.com/mcp with your hostname

Authorization header

Bearer <your RELAY_MCP_TOKEN>

Supply the token through your AI host's secret settings. For clients using the following configuration format and supporting environment interpolation:

mcp_servers:
  mcp_relay:
    url: https://relay.example.com/mcp
    headers:
      Authorization: "Bearer ${RELAY_MCP_TOKEN}"
    supports_parallel_tool_calls: false

Ask your AI agent to:

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

A live Client report confirms the round trip to your computer. Your servers' tools are then called like any other MCP tool. See the tool guide for naming, filtering and error handling.

Choose whether your AI can manage servers

Your configured, enabled servers' tools are always available. Adding, modifying, deleting, enabling or disabling server entries remotely requires explicit permission on your local Client:

mcp-relay config set admin true

Restart the Client to apply the change. To lock administration again:

mcp-relay config unset admin

Restart once more. Without it, the administration tools are not listed. This setting controls server administration, not the actions of tools exposed by your MCP servers. Configure those servers' permissions accordingly. Third-party results are relayed without scanning them for secrets.

Need help?

Problem

Start here

Command not found after installation

Open a new terminal to pick up the updated PATH

Startup rejects a token

Check the named variable, the 32–256 character requirement and the absence of spaces

Cloud AI cannot connect

Check the HTTPS URL, MCP token and proxy route to port 8000

client_unavailable

Keep the local Client running; check its token, WSS URL and proxy route to port 8001

A local server is unavailable

Check its launcher or URL, dependencies and credentials; other servers can keep running

Administration returns permission_denied

Set admin: true locally and restart the Client if you want to allow it

Use mcp-relay config show to inspect effective settings with secrets redacted. Logs are written to ~/.mcp-relay/server.log and client.log. The CLI guide covers configuration and diagnostics.

Yes. Choose Local Server + Client during onboarding. The MCP endpoint defaults to http://127.0.0.1:8000/mcp, and the Client connects to ws://127.0.0.1:8001/ws. Both tokens are still required. A cloud AI agent cannot reach your computer through these loopback addresses.

Stop the Relay processes on the machine, then run:

uv tool uninstall mcp-relay

Your configuration, private .env and workspace under ~/.mcp-relay are preserved. Data removal is a separate manual step.

Guides

CLI and configuration · Tools and server management · Security policy

Licensed under the MIT License.

Available Tools

2 tools
relay_statusRelay StatusA
Read-only

Report the Relay Server, the connected Client and its MCP servers.

Call it first to check that the Client is connected and which server aliases run, when a tool is missing or fails, and after an administration change. Read-only. Client details come from a short live probe; when the Client is busy or unreachable the last good answer is returned as cached with its age. To discover servers that are not configured yet, use relay_registry_search.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
clientYes
serverYes
mcp_serversYes
disk_differsYes

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover the read-only safety profile, and the description goes further by disclosing the live-probe mechanism and the degraded-mode behavior: when the Client is busy or unreachable, a stale answer is returned flagged as ``cached`` with its age. That failure-mode/fallback semantics is exactly the context an agent cannot get from structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the purpose, then triggers, then caveats, then the sibling pointer — a sensible order with no wasted padding. The standalone 'Read-only.' sentence slightly duplicates the readOnlyHint annotation, a minor redundancy in an otherwise tight description.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need no prose explanation. Coverage of purpose, invocation timing, degraded behavior, and the sibling alternative is complete for a no-argument status tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool takes zero parameters, so there is nothing for the description to disambiguate; the baseline for a 0-param tool applies. No parameter guidance is missing or needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and three concrete resources it reports on: the Relay Server, the connected Client, and its MCP servers. It also distinguishes itself from the sibling by contrasting configured server aliases with servers not yet configured.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives explicit triggers: call first to confirm the Client is connected, when a tool is missing or fails, and after an administration change. It also names the alternative and the different need it serves ('To discover servers that are not configured yet, use relay_registry_search').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.1.1
    • Changedrelay_registry_search6 fields changed
      • addedInput schema / properties / cursor / description
        Added value: +"The next_cursor of a previous result; omit for the first page."
      • addedInput schema / properties / include_deleted / description
        Added value: +"Also return servers deleted from the registry."
      • addedInput schema / properties / limit / description
        Added value: +"Results per page, 1-50."
      • addedInput schema / properties / query / description
        Added value: +"Text matched against server names, 1-200 characters."
      • addedInput schema / properties / updated_since / description
        Added value: +"RFC 3339 timestamp: only servers updated since then, deleted entries included."
      • addedInput schema / properties / version / description
        Added value: +"'latest' or an exact server version."
  2. 2 tool updatesv0.1.0
    • First observedrelay_registry_search
    • First observedrelay_status

TDQS

A4.1/5.0

Scored across 2 tools

Disambiguation4/5

relay_status (report configured Client/servers) and relay_registry_search (discover unconfigured servers) have clearly distinct purposes, and each description explicitly redirects to the other for the complementary case. Only minor overlap in that both are read-only discovery/observability operations, but boundaries are unambiguous.

Naming Consistency4/5

Both tools use a consistent snake_case 'relay_' prefix, forming a predictable namespace. The suffix pattern is not strictly verb_noun (status vs registry_search), a minor deviation, but naming is coherent and readable.

Tool Count2/5

Only two tools for a server whose purpose (relaying/managing an MCP Client and its servers) implies administrative capability; the surface feels notably thin. Descriptions even reference actions like 'administration change' that no tool exposes.

Completeness2/5

A clear dead end exists: relay_registry_search returns a 'name' described as 'the source for adding that server,' yet there is no tool to add, remove, or invoke anything. Status and discovery are covered, but the core lifecycle implied by the domain is missing.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers