Connect an MCP Client that only supports local (stdio) servers to a Remote MCP Server.
接入配置
选择客户端,复制配置,再按项目文档补齐环境变量。
claude mcp add remote --env SERVER_URL='<SERVER_URL>' -- npx mcp-remote '{{config.SERVER_URL}}'~/.codex/config.toml
[mcp_servers.remote]
command = "npx"
args = ["mcp-remote", "{{config.SERVER_URL}}"]
env = { SERVER_URL = "<SERVER_URL>" }
# codex mcp add remote --env SERVER_URL='<SERVER_URL>' -- npx mcp-remote '{{config.SERVER_URL}}'~/.cursor/mcp.json
{
"mcpServers": {
"remote": {
"command": "npx",
"args": [
"mcp-remote",
"{{config.SERVER_URL}}"
],
"env": {
"SERVER_URL": "<SERVER_URL>"
}
}
}
}.vscode/mcp.json
{
"servers": {
"remote": {
"type": "stdio",
"command": "npx",
"args": [
"mcp-remote",
"{{config.SERVER_URL}}"
],
"env": {
"SERVER_URL": "<SERVER_URL>"
}
}
}
}~/.gemini/settings.json
{
"mcpServers": {
"remote": {
"command": "npx",
"args": [
"mcp-remote",
"{{config.SERVER_URL}}"
],
"env": {
"SERVER_URL": "<SERVER_URL>"
}
}
}
}claude_desktop_config.json
{
"mcpServers": {
"remote": {
"command": "npx",
"args": [
"mcp-remote",
"{{config.SERVER_URL}}"
],
"env": {
"SERVER_URL": "<SERVER_URL>"
}
}
}
}.trae/mcp.json
{
"mcpServers": {
"remote": {
"command": "npx",
"args": [
"mcp-remote",
"{{config.SERVER_URL}}"
],
"env": {
"SERVER_URL": "<SERVER_URL>"
}
}
}
}需要的环境变量
SERVER_URL
把占位值换成你自己的密钥;不要把密钥提交到代码仓库。