MCP Environment Proxy
A dynamic MCP proxy that allows switching environment variables on-the-fly, enabling context switching for multiple AWS accounts or Kubernetes clusters without restarting the client.
README
MCP Environment Proxy
A dynamic MCP (Model Context Protocol) proxy that allows switching environment variables on-the-fly. Instead of configuring multiple MCP servers for different AWS accounts/regions, use a single proxy that can switch contexts dynamically.
Problem
When working with multiple AWS accounts or Kubernetes clusters, you typically need one MCP server per environment:
{
"mcpServers": {
"eks-production": { "env": { "AWS_PROFILE": "prod" } },
"eks-staging": { "env": { "AWS_PROFILE": "staging" } },
"eks-dev": { "env": { "AWS_PROFILE": "dev" } }
}
}
This consumes context and requires restarting Claude to switch environments.
Solution
MCP Environment Proxy provides a single MCP server that can switch between contexts on-demand:
{
"mcpServers": {
"mcp-env-proxy": {
"command": "uvx",
"args": ["mcp-env-proxy@latest", "-c", "~/.config/mcp-env-proxy/contexts.yaml"]
}
}
}
Then dynamically switch contexts:
> switch_context("eks-production")
> list_k8s_resources(...)
> switch_context("eks-staging")
> list_k8s_resources(...)
Installation
# With uvx (recommended)
uvx mcp-env-proxy@latest
# With pip
pip install mcp-env-proxy
# From source
git clone https://github.com/KamorionLabs/mcp-env-proxy.git
cd mcp-env-proxy
pip install -e .
Configuration
Create a contexts.yaml file:
# Default environment variables for all contexts
defaults:
FASTMCP_LOG_LEVEL: ERROR
# Define MCP server types
servers:
eks:
command: uvx
args: ["awslabs.eks-mcp-server@latest"]
ecs:
command: uvx
args: ["awslabs.ecs-mcp-server@latest"]
# Named contexts
contexts:
production:
server: eks
env:
AWS_PROFILE: WordPress-Production/AWSAdministratorAccess
AWS_REGION: eu-west-3
staging:
server: eks
env:
AWS_PROFILE: WordPress-Staging/AWSAdministratorAccess
AWS_REGION: eu-west-3
homebox-prod:
server: ecs
env:
AWS_PROFILE: homebox-production/AdministratorAccess
AWS_REGION: eu-west-3
# Default context on startup
current_context: production
Config file locations (in order of precedence):
MCP_ENV_PROXY_CONFIGenvironment variable./contexts.yaml(current directory)~/.config/mcp-env-proxy/contexts.yaml
Available Tools
list_contexts
List all available contexts with their configuration.
switch_context(context_name)
Switch to a different context. This loads the MCP server with the specified environment variables.
get_current_context
Get information about the currently active context.
list_proxied_tools
List all tools available from the current context's MCP server.
proxy_tool(tool_name, arguments)
Call a tool on the proxied MCP server.
Process Pool
The proxy maintains a pool of MCP server processes (default: 5). When you switch contexts:
- If the context was previously loaded, it reuses the existing process (fast)
- If it's a new context, it spawns a new process
- If the pool is full, it evicts the oldest unused process
This provides fast context switching while limiting memory usage.
Usage with Claude Code
Add to your Claude Code MCP configuration:
claude mcp add mcp-env-proxy -- uvx mcp-env-proxy@latest -c ~/.config/mcp-env-proxy/contexts.yaml
Then in conversation:
User: Switch to the production EKS cluster
Claude: [calls switch_context("production")]
User: List the pods in the wordpress namespace
Claude: [calls proxy_tool("list_k8s_resources", {"resource_type": "pods", "namespace": "wordpress"})]
Development
# Clone the repository
git clone https://github.com/KamorionLabs/mcp-env-proxy.git
cd mcp-env-proxy
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run locally
python -m mcp_env_proxy -c config/contexts.example.yaml -v
License
MIT License - see LICENSE for details.
Contributing
Contributions welcome! Please open an issue or PR on GitHub.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。