How It Works
From the AI client’s perspective,runlayer run <server-id> is the MCP server. From Runlayer’s perspective, the CLI is the controlled proxy for the local MCP.
The real local MCP can be:
- A
stdioprocess started by the Runlayer CLI, such asnpx,uvx, or a local binary - An HTTP/SSE MCP endpoint reachable from the user’s machine, on
localhostor a private network/VPN - A verified local application connector, such as a desktop app integration
Set Up a Local MCP
1
Create or select a local connector
In Runlayer, add a local connector from the catalog or create one manually.For
stdio, configure the command, arguments, and any shared environment variables the MCP needs.For local HTTP/SSE, configure the upstream URL, for example http://127.0.0.1:3333/mcp. Add any shared upstream credentials in the connector’s Headers field (see HTTP headers).2
Assign access
Add the connector to the right users or groups and configure policies as usual.Local connectors use the same policy model as hosted connectors.
3
Install into the AI client
From the connector page, use the client setup instructions, or run the Runlayer setup command for the client.The installed MCP entry points the client at
runlayer run <server-id>.4
Run the client
When the AI client starts the MCP server, it launches the Runlayer CLI locally. The CLI authenticates to Runlayer, starts or connects to the local MCP target, and proxies tool calls.
Example Client Config
Most users should install local MCPs from the Runlayer UI or setup command. A minimal MCP client entry looks like this:--secret <RUNLAYER_USER_TOKEN> explicitly, but runlayer login is preferred for normal user setup.
Headers for Local HTTP MCPs
For local Streaming HTTP or SSE connectors, enter literal upstream header values in the connector’s Headers field in Runlayer. The CLI sends them when connecting to the upstream MCP server.
A configured
Authorization header disables automatic OAuth discovery. Explicitly configured OAuth, manual OAuth setup, and OAuth Broker flows still apply.
Configured headers stay scoped to the upstream origin (scheme, hostname, and port). Redirects to a different origin do not receive them.
Runlayer stores these header values and sends them to the CLI for the connector. Use shared credentials suitable for the users and devices connecting locally. Local connectors require literal values; Runlayer placeholders such as {API_KEY} are unsupported. For user-specific secrets, use the local server’s environment or configuration.
This requires a CLI release that includes local HTTP header forwarding. Older CLI releases ignore configured HTTP headers; updating the Runlayer backend alone does not update the CLI on users’ machines. See Runlayer CLI for installation and fleet updates.
User-Specific Local Secrets
Local MCPs often need a token for an upstream service. Keep that token local to the user’s machine. Forstdio MCPs launched by Runlayer, the local MCP receives only the connector’s configured environment variables (set on the connector in Runlayer) plus a small proxy/TLS/locale allowlist from the surrounding environment — not the full runlayer run environment. An admin can also name specific variables to pass through from the user’s environment via the connector’s Inherit from the user’s environment setting (transport_config.inherit_env). Only the names are stored; values are never sent to Runlayer and are passed only to the local MCP process, and a value set in the connector’s env still wins. Set the upstream token as an environment variable on the connector in Runlayer; values placed in the AI client’s env block reach runlayer run but are not forwarded to the local MCP unless an admin lists them there.
The MCP code can then read it normally:
localhost, set the token in the environment of that local server process before it starts. Setting an environment variable on runlayer run will not change the environment of a separate process that is already running.
Troubleshooting
IdPs with exact redirect URI allowlists (e.g. Okta)
For local HTTP/SSE MCP OAuth, use a fixed callback port:RUNLAYER_OAUTH_CALLBACK_PORT=<port>. Allowlist http://localhost:<port>/callback in the IdP. Clear the cache first if a previous random-port attempt cached a client registration.
What Runlayer Sees
Runlayer receives:- The authenticated Runlayer user
- Connector and tool metadata
- Policy decisions
- Tool call audit events
- ToolGuard security scan results
stdio MCPs, set the upstream token as an environment variable on the connector in Runlayer.
Caveats
- Local MCPs require the Runlayer CLI to be installed on the user’s machine.
- Users must be authenticated with
runlayer loginor an explicit Runlayer user token. - The local MCP target must be available or reachable from the machine where the AI client runs.
- For
stdioMCPs, environment variables for the local MCP must be set on the connector in Runlayer; the surrounding shell environment is not inherited beyond a small proxy/TLS/locale allowlist and any variable names an admin lists under the connector’s Inherit from the user’s environment setting (transport_config.inherit_env). Names only — values are never sent to Runlayer and are passed only to the local MCP process, and the connector’senvwins on conflict. - For local HTTP/SSE MCPs, ensure the upstream is reachable before the AI client connects. For a server running on the user’s machine, start it with its required environment.
- Runlayer-managed per-user placeholder values are for hosted HTTP/SSE connectors and deploy-backed stdio servers in Runlayer. Local HTTP/SSE connectors require literal headers and can use the local server process’s environment or local config for user-specific secrets.
Related Resources
Connectors
Add and manage connectors, including local ones
Policies
Control access to local connectors and their tools
Custom MCP Servers
Deploy MCP servers to managed infrastructure instead
MCP Troubleshooting
Debug connection, auth, and CLI issues