py-code-agent-mcp-gateway
MCP Gateway plugin for Py Code Agent - connect MCP (Model Context Protocol) servers and expose their tools.
Features
- MCP Server Connection: Connect to MCP servers via stdio transport
- Tool Exposure: Automatically expose all MCP server tools as Py Code Agent tools
- Server Management: List and call tools across multiple MCP servers
- Dynamic Discovery: Auto-discover available tools on server initialization
Installation
# Install from PyPI
pip install py-code-agent-mcp-gateway
# Or install with extra dependencies
pip install py-code-agent-mcp-gateway[mcp]
Configuration
In your config.yaml:
plugins:
gateway:
mcp:
servers:
- name: filesystem
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
enabled: true
- name: brave-search
command: npx
args: ["-y", "@modelcontextprotocol/server-brave-search"]
env:
BRAVE_API_KEY: ${BRAVE_API_KEY}
enabled: true
- name: postgres
command: npx
args: ["-y", "@modelcontextprotocol/server-postgres", "postgresql://user:pass@host/db"]
enabled: true
Server Configuration Options
| Option | Type | Description |
|---|---|---|
name |
string | Server name (unique identifier) |
command |
string | Executable command (e.g., npx, node, python) |
args |
list | Command arguments |
env |
dict | Environment variables (supports ${ENV_VAR}) |
transport |
string | Transport type (stdio, http) - default: stdio |
url |
string | URL for HTTP transport |
headers |
dict | HTTP headers |
enabled |
bool | Enable/disable server |
Tools Provided
| Tool | Description |
|---|---|
mcp_list_servers |
List all connected MCP servers and their tools |
mcp_call_tool |
Call a specific MCP tool by server and tool name |
mcp_{server}_{tool} |
Auto-generated tools for each MCP server tool |
Usage
List Servers
> mcp_list_servers
Output:
## filesystem (3 tools)
- mcp_filesystem_read_directory: Read a directory
- mcp_filesystem_read_file: Read a file
- mcp_filesystem_write_file: Write to a file
## brave-search (1 tool)
- mcp_brave-search_search: Search the web
Call Tool Directly
> mcp_call_tool server_name=filesystem tool_name=read_file path="/path/to/file.txt"
Use Auto-generated Tool
> mcp_filesystem_read_file path="/path/to/file.txt"
MCP Servers
This plugin connects to MCP (Model Context Protocol) servers. Popular MCP servers:
@modelcontextprotocol/server-filesystem- File system operations@modelcontextprotocol/server-brave-search- Web search@modelcontextprotocol/server-postgres- PostgreSQL database@modelcontextprotocol/server-github- GitHub operations@modelcontextprotocol/server-slack- Slack integration
Requirements
- Python 3.9+
- Py Code Agent core
- MCP server packages (installed separately)
Troubleshooting
Server fails to initialize
Check that:
- The command (npx, node, etc.) is available
- The MCP server package is installed
- Required environment variables are set
Tools not appearing
MCP tools are discovered when the agent starts. Make sure:
- Server is enabled in config
- Agent has been started after config change
Related Links
Metadata
Release files for py-code-agent-mcp-gateway 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_code_agent_mcp_gateway-0.1.0.tar.gz | 6.9 kB | Without provenance | Details for py_code_agent_mcp_gateway-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_code_agent_mcp_gateway-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_code_agent_mcp_gateway-0.1.0-py3-none-any.whl |
Total release size: 14.1 kB
Release files / py_code_agent_mcp_gateway-0.1.0.tar.gz
| Download URL | py_code_agent_mcp_gateway-0.1.0.tar.gz |
|---|---|
| Size | 6.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da059166ef3167416ae306a3d9b1445d09783175583103afc40508f1129742da
|
|
BLAKE2b-256 checksum How to use checksums |
44c4f726fe9884d28c790f9d16672b939672fd535053859899ab304b94eac4b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Release files / py_code_agent_mcp_gateway-0.1.0-py3-none-any.whl
| Download URL | py_code_agent_mcp_gateway-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88cfc436ad1582fac26f214de4b9846503a4447fe1fb5dc68c80a2060d99f6d2
|
|
BLAKE2b-256 checksum How to use checksums |
0ee664b9e41c6ffdfe31906595e7ce94e56d060ab102a4a9729b0d1ab44b6b5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.5
|
Security for py-code-agent-mcp-gateway 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.