A Model Context Protocol (MCP) server written in Go for debugging Vector Packet Processing (VPP) instances running in Kubernetes pods or as standalone daemons.
This MCP server provides tools to interact with VPP instances for debugging purposes. It supports dual execution modes: Kubernetes (CalicoVPP pods) and Standalone (local VPP daemon). It exposes VPP functionality through MCP tools that can be used by AI agents and other MCP clients.
- Dual Execution Modes:
- Kubernetes: Executes VPP commands on Kubernetes pods running CalicoVPP
- Standalone: Executes VPP commands on a local VPP daemon via vppctl socket
- Multiple Transport Modes:
- Stdio for local client-server communication
- HTTP/SSE for remote network access between machines
- 4 Broad Tools — lightweight MCP surface that leverages agent/LLM intelligence:
list: Discover all available commands across categoriescluster: Kubernetes cluster operations (pods, nodes, configmaps, daemonsets, logs)vppctl: Run any vppctl command on VPP (1000++ commands supported)gobgp: Run any gobgp command in the CalicoVPP agent container
- Official MCP Go SDK: Uses the official Model Context Protocol Go SDK maintained by Google
- Go Implementation: Fast, efficient, and easy to deploy
- Extensible Architecture: Easy to add more VPP debugging tools
- Remote Access: Connect from any machine to debug VPP instances on remote servers
- Go 1.24+
- Kubernetes mode: kubectl installed and configured with access to your Kubernetes cluster; VPP running in Kubernetes pods (e.g., Calico VPP dataplane)
- Standalone mode: VPP running as a local daemon with vppctl accessible (default socket:
/var/run/vpp/cli.sock) - MCP client (like Claude Desktop, Cline, or other MCP-compatible tools)
- Clone or navigate to the project directory:
cd /home/aritrbas/vpp/vpp-mcp- Download Go dependencies:
go mod tidy- Build the server:
go build -o vpp-mcp-server main.goThe server supports two transport modes: stdio (local) and http (network).
Start the server using stdio transport (default):
./vpp-mcp-serverOr with explicit flag:
./vpp-mcp-server --transport=stdioOr run directly with Go:
go run main.goStart the server with HTTP transport for remote access:
./vpp-mcp-server --transport=http --port=8080This exposes the following endpoints:
http://localhost:8080/sse- MCP SSE endpoint for client connectionshttp://localhost:8080/health- Health check endpointhttp://localhost:8080/- Server information page
For remote access, replace localhost with the server's IP address or hostname.
The server exposes 4 broad tools that leverage agent/LLM intelligence to decide which specific commands to run. Use the list tool to discover all available commands.
- Description: Returns a comprehensive command reference for all tool categories, including the complete 1000++ vppctl command catalog (embedded at compile time via
//go:embed), full gobgp command reference, and all cluster commands with kubectl mappings. - Parameters: None
- Output size: ~75KB (includes full vppctl command catalog from
vppctl-cmds/vppctl-commands-summary.md)
- Description: Run Kubernetes cluster commands for CalicoVPP troubleshooting
- Parameters:
command(required): Operation to run —get_pods,get_nodes,get_configmap,get_daemonset,get_events,get_deployments,get_services,get_endpoints,get_replicaset,get_ippool,get_namespaces,top_pods,top_nodes,logs,describe_pod,describe_node,execnamespace(optional): Kubernetes namespace (default:calico-vpp-dataplane)pod_name(optional): Pod name (forlogs,describe_pod,exec)container(optional): Container name (forlogs,exec; defaults:agentfor logs,vppfor exec)resource_name(optional): Resource name (forget_configmap,get_daemonset,get_endpoints,describe_node) or command to execute (forexec)tail_lines(optional): Number of log lines (default: 200, max: 5000)
- Note: The
execcommand only allows read-only operations (e.g.,ls,cat,ip a). Mutating commands are blocked.
- Description: Run any vppctl command on VPP. Passes the command string directly to the VPP CLI.
- Parameters:
command(required): The vppctl command (e.g.,show version,show int addr,show ip fib index 0 10.0.0.0/24)pod_name(Kubernetes mode, required): Pod running VPPmode(optional):kubernetes(default) orstandalonesock_path(Standalone mode, optional): VPP socket pathcount/timeout/interface(optional): For capture commands (trace,pcap,dispatch)
- Common commands:
show version,show int,show int addr,show hardware-interfaces,show errors,show run,clear errors,clear run,show logging,show ip table,show ip fib,show session verbose 2,show tcp stats,show npol rules/policies/ipset/interfaces,show cnat translation/session,show ipip tunnel,show vxlan tunnel,show tun,trace,pcap,dispatch,capture_cleanup
- Description: Run any gobgp command in the agent container of a CalicoVPP pod
- Parameters:
command(required): The gobgp command (e.g.,neighbor,global rib -a ipv4,neighbor 10.0.0.1 adj-in)pod_name(required): Pod running the agent container
- Common commands:
neighbor,neighbor <ip>,neighbor <ip> adj-in/adj-out,global,global rib -a ipv4/ipv6,global rib <prefix>,vrf,policy prefix/community/as-path/statement
This workflow mirrors the upstream troubleshooting guide and is adapted to this MCP server's toolset:
- Upstream reference: https://github.com/projectcalico/vpp-dataplane/blob/master/docs/bgp/troubleshooting.md
- Local runbook: skills/BGP_TROUBLESHOOTING_WORKFLOW.md
The server executes VPP commands on existing Kubernetes pods:
- Connects to specified pods via kubectl
- Executes vppctl commands in the VPP container
- Executes gobgp commands in the agent container
- Returns results via MCP protocol
To use this server with an MCP client on the same machine, add it to your client's configuration. For example, with Claude Desktop, add to your claude_desktop_config.json:
{
"mcpServers": {
"vpp-debug": {
"command": "/home/aritrbas/vpp/vpp-mcp/vpp-mcp-server",
"cwd": "/home/aritrbas/vpp/vpp-mcp"
}
}
}For remote access from Machine Y to Machine X:
On Machine X (Server):
- Start the server with HTTP transport:
./vpp-mcp-server --transport=http --port=8080- Ensure the port is accessible (check firewall rules):
# Example: Allow port 8080 on Ubuntu/Debian
sudo ufw allow 8080/tcpOn Machine Y (Client): Configure your MCP client to connect to the HTTP endpoint. For example, with Claude Desktop:
{
"mcpServers": {
"vpp-debug-remote": {
"url": "http://<machine-x-ip>:8080/sse",
"transport": "sse"
}
}
}Replace <machine-x-ip> with the actual IP address or hostname of Machine X.
Security Considerations:
- The HTTP transport does not include authentication by default
- For production use, consider adding:
- Reverse proxy with TLS (nginx, Apache)
- API authentication (API keys, OAuth)
- Network security (VPN, SSH tunneling)
- Firewall rules to restrict access
Example with SSH Tunnel (Secure Alternative):
# On Machine Y, create SSH tunnel
ssh -L 8080:localhost:8080 user@machine-x
# Then configure client to use localhost:8080You can modify the constants in main.go to:
- Change default namespace
- Change default container name
- Add additional VPP commands as tools
vpp-mcp/
├── main.go # Main MCP server implementation
├── go.mod # Go module definition
├── go.sum # Go module checksums
├── Makefile # Build automation
├── README.md # This file
├── .gitignore # Git ignore rules
├── vpp-mcp-server # Compiled binary
├── docs/ # Documentation
│ ├── QUICK_START.md # Quick reference
│ ├── REMOTE_ACCESS.md # Remote access guide
│ └── TEST_SUMMARY.md # Test results
├── skills/ # LLM workflow skills
│ └── bgp-troubleshoot.md # BGP triage runbook
│ └── cluster-healthcheck.md # Cluster health check
├── tests/ # Test scripts
│ ├── test_mcp_server.sh # Test MCP server setup in stdio transport
│ ├── demo_test.sh # Demo all tools
│ ├── test_tool.sh # Test individual tools
│ └── test_http_server.sh # Test MCP server setup in HTTP transport
└── examples/ # Example files
└── example_mcp_requests.json # JSON-RPC examples
Build the server:
go build -o vpp-mcp-server main.goBuild for different platforms:
# Linux
GOOS=linux GOARCH=amd64 go build -o vpp-mcp-server-linux main.go
# macOS
GOOS=darwin GOARCH=amd64 go build -o vpp-mcp-server-macos main.go
# Windows
GOOS=windows GOARCH=amd64 go build -o vpp-mcp-server.exe main.goWith the 4-tool architecture, adding support for new commands is straightforward:
- New vppctl commands: Simply pass any valid vppctl command string to the
vppctltool. No code changes needed. - New gobgp commands: Simply pass any valid gobgp command string to the
gobgptool. No code changes needed. - New cluster operations: Add a new
casein thehandleClusterswitch statement inmain.go. - Update the list: Add the new command to
handleListso agents can discover it.
- Test server functionality:
# stdio transport
./tests/test_mcp_server.sh
# HTTP transport
./tests/test_http_server.sh- Demo all tools:
./tests/demo_test.sh <pod-name>- Test individual tool:
./tests/test_tool.sh <pod-name> vppctl "show int"This project uses:
github.com/modelcontextprotocol/go-sdk- Official Model Context Protocol Go SDK maintained in collaboration with Google- Standard Go libraries for command execution
k8s.io/client-go- Kubernetes client library for pod discovery and ConfigMap access
-
kubectl access fails:
- Verify kubectl is installed and configured
- Check you have access to the VPP namespace
- Ensure proper RBAC permissions for pod exec
-
vppctl commands fail:
- Verify VPP is running in the target pod
- Check if the pod name is correct
-
MCP connection issues:
- Verify the binary is built correctly (
go build) - Check MCP client configuration
- Review server logs for errors
- Verify the binary is built correctly (
-
Build issues:
- Ensure Go 1.24+ is installed
- Run
make depsto download dependencies - Check for any compilation errors
The server logs important events to help with debugging:
- Container lifecycle events
- Command execution results
- Error conditions
View logs by running the server and monitoring stdout/stderr output.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Planned features:
- More VPP debugging tools
- Configuration management tools
- Log analysis capabilities
- Performance monitoring tools
- Configuration file support
- Workflow support
- Workflow visualization tools
- Automated workflow execution engine