What is Hosted Stdio-based MCP Server?
Run a hosted MCP server via stdio and expose it through the AI Gateway. Hosted stdio MCP servers are now available as first-class MCP servers with built-in per-user or global credential support via environment variables. A hosted stdio-based MCP server speaks the MCP over standard input and standard output (typical for CLI-style servers started withnpx, uvx, or your own binary). TrueFoundry registers this pattern as a first-class MCP server: you provide the command, arguments, and environment variables for configuration and credentials, and the MCP Gateway runs and manages the process so clients use the same gateway URL as for remote MCP servers.
This is useful when you already rely on a stdio MCP package or script and want centralized access, auth, guardrails, and observability without standing up a separate HTTP wrapper yourself.
How It Works?
Create a Hosted Stdio-based MCP Server
Navigate to MCP Servers
Choose hosted stdio registration
Import from editor-style JSON (optional)
mcpServers map—the same shape as in Cursor or VS Code MCP config: one server id with command, args, and optional env. Only one server entry is allowed so the control plane can build one manifest.Set command and arguments
Configure environment variables and access
Create and test
Example manifests
Each example shows the editor-style JSON you can paste into the STDIO Configuration (JSON) box when adding the server in the UI, plus the equivalent full YAML manifest (type: mcp-server/stdio). Both examples run reference servers from the official modelcontextprotocol/servers repository and need no credentials. For servers that take API keys, add the variables under env (JSON) or auth_data.env (YAML).
The JSON carries only command, args, and env—after pasting, mark each environment variable as global or per-user and add collaborators in the form.
subject with a real user in your account. Do not commit real API keys—use a secret store or placeholder for global env values. For per-user env values, use one templatized placeholder per value and configure each caller in Auth Overrides.- Filesystem
- Everything
auth_data is omitted.Using Private Packages
Stdio MCP servers can run packages that are not published to the public npm registry or PyPI. No extra gateway configuration is needed: the environment variables you set inauth_data.env are available to the package manager (npx, uvx) when it installs the package inside the sandbox, so registry and repository credentials flow the same way as any other credential.
Two patterns are supported:
- npm: private registry
- npm: private git repository
- Python: private index
- Python: private git repository
@your-org/your-mcp-server from GitHub Packages. The --@your-org:registry argument routes the scope to the private registry, and npm reads the token from the npm_config_//<registry-host>/:_authToken environment variable.--@your-org:registry argument and the npm_config_//<registry-host>/:_authToken variable name with your registry’s host and path.Troubleshooting private package installs
Install failures do not surface as errors: the server stays in themcp_server_starting state indefinitely because the package manager never hands off to the MCP process. If your server is stuck starting, check these causes:
Git URL has no pinned ref
Git URL has no pinned ref
#ref (npm) or @ref (uv) can make the install run git checkout null and hang. Always pin a tag, branch, or commit in the package URL.Credentials embedded in the npm package URL
Credentials embedded in the npm package URL
git+https://user:token@github.com/... in args fails to authenticate. Inject the token with git’s insteadOf URL rewriting from an environment variable, as shown in the private git repository examples.A failed first install poisoned the npx cache
A failed first install poisoned the npx cache
npx run is killed or fails partway, the partial download in ~/.npm/_npx inside the sandbox makes subsequent starts fail the same way. Change something in the manifest args (for example, pin a different ref or add a flag): this re-keys the sandbox and starts from a clean cache.Server did not pick up a rotated token
Server did not pick up a rotated token
auth_data.env automatically creates a fresh sandbox with the new value on the next start; the old sandbox ages out. If the server still fails after rotation, verify the new token has read access to the package.Frequently Asked Questions
What MCP protocol features does the stdio proxy support?
What MCP protocol features does the stdio proxy support?
mcp-proxy library in a sandboxed environment in stateless mode, so the same per-request semantics as remote servers apply — see MCP Protocol Support for the full feature matrix.How is this different from a remote MCP server?
How is this different from a remote MCP server?
Can I combine a stdio MCP server with a Virtual MCP server?
Can I combine a stdio MCP server with a Virtual MCP server?
What templatized values are supported in environment variables?
What templatized values are supported in environment variables?
Can I run packages that are not publicly published?
Can I run packages that are not publicly published?
auth_data.env, or directly from a private git repository using a shell wrapper that injects the token through git configuration. See Using Private Packages for complete manifests and troubleshooting.Do guardrails and analytics apply to stdio MCP servers?
Do guardrails and analytics apply to stdio MCP servers?
Best Practices
Pin versions
args (for example pinned npx or uvx targets) so tool behavior does not change unexpectedly when upstream releases update.