MCP Configuration#
MCP (Model Context Protocol) enables agents to use external tool servers.
Configuration File#
MCP servers are configured in .pantheon/mcp.json:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "/path/to/workspace"]
},
"github": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
Server Configuration#
Each server entry has:
Field |
Description |
|---|---|
|
Executable to run (e.g., |
|
Command arguments as array |
|
Environment variables (supports |
|
Working directory for the server |
Common MCP Servers#
Filesystem Server#
Access local files:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "."]
}
}
}
GitHub Server#
GitHub operations:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-github"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}
PostgreSQL Server#
Database operations:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-postgres"],
"env": {
"DATABASE_URL": "${DATABASE_URL}"
}
}
}
}
Puppeteer Server#
Browser automation:
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-puppeteer"]
}
}
}
Custom Python Server#
{
"mcpServers": {
"custom": {
"command": "python",
"args": ["-m", "my_mcp_server"],
"cwd": "/path/to/server"
}
}
}
Using MCP in Templates#
In Agent Templates#
---
name: GitHub Assistant
model: openai/gpt-4o
mcp_servers:
- github
- filesystem
---
You are a GitHub assistant.
In Team Templates#
---
name: Dev Team
agents:
- name: developer
mcp_servers:
- github
- filesystem
instructions: Write and commit code.
---
Using MCP in Python API#
from pantheon.agent import Agent
from pantheon.providers import MCPProvider
# Create agent
agent = Agent(
name="assistant",
instructions="You are a helpful assistant."
)
# Add MCP provider at runtime
await agent.mcp(
name="filesystem",
provider=MCPProvider("npx -y @anthropic/mcp-server-filesystem .")
)
response = await agent.run("List files in current directory")
Environment Variables#
Use ${VAR} syntax for environment variable substitution:
{
"mcpServers": {
"database": {
"command": "python",
"args": ["-m", "db_server"],
"env": {
"DB_HOST": "${DB_HOST}",
"DB_USER": "${DB_USER}",
"DB_PASSWORD": "${DB_PASSWORD}"
}
}
}
}
Variables are resolved from:
Process environment
.envfile in project rootShell environment
Server Lifecycle#
MCP servers are:
Started on demand when an agent with that server is created
Kept running for the session duration
Stopped when the session ends or explicitly disconnected
Multiple Usage#
The same MCP server can be used by multiple agents:
{
"mcpServers": {
"shared-fs": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-filesystem", "."]
}
}
}
---
name: Team
agents:
- name: reader
mcp_servers: [shared-fs]
instructions: Read files.
- name: writer
mcp_servers: [shared-fs]
instructions: Write files.
---
Troubleshooting#
Server Not Starting#
Check:
Command is installed (
npx,python, etc.)Package exists (
npm install -g @anthropic/mcp-server-xxx)Environment variables are set
View Logs#
Enable debug logging:
export PANTHEON_LOG_LEVEL=DEBUG
pantheon cli
Connection Issues#
If a server fails to connect:
Test the command manually in terminal
Check for port conflicts
Verify environment variables
Check server-specific requirements
Finding MCP Servers#
Community servers on GitHub
Creating Custom Servers#
See the MCP Specification for creating your own servers.
Basic Python server:
from mcp import Server, Tool
server = Server("my-server")
@server.tool
def my_tool(param: str) -> str:
"""Tool description."""
return f"Result: {param}"
if __name__ == "__main__":
server.run()