A secure MCP server for eBPF, designed for AI integration, kernel introspection, and automation.
A secure, minimal, and schema-enforced MCP server for eBPF โ purpose-built for AI integration, kernel introspection, and automation.
ebpf-mcp
is a secure Model Context Protocol (MCP) server that exposes a minimal set of structured tools to interact with eBPF โ optimized for safe AI control, automation agents, and human operators.
It enables loading, attaching, introspecting, and streaming eBPF programs โ all through strict JSON Schema contracts validated at runtime. No REST APIs, no shell escapes, and no bpftool wrappers.
# Install ebpf-mcp server
curl -fsSL https://raw.githubusercontent.com/sameehj/ebpf-mcp/main/install.sh | sudo bash
# Start the service (runs on port 8080 by default)
sudo systemctl start ebpf-mcp
sudo systemctl enable ebpf-mcp
# Get your auth token
cat /etc/ebpf-mcp-token
# Check service status
sudo systemctl status ebpf-mcp
# View logs if needed
sudo journalctl -u ebpf-mcp -f
For air-gapped or development environments:
git clone https://github.com/sameehj/ebpf-mcp.git
cd ebpf-mcp
sudo ./install.sh v1.0.2
# Run the complete test suite
cd scripts/
chmod +x test-ebpf-mcp-server.sh
./test-ebpf-mcp-server.sh <your-token>
If no token is provided, the script will prompt for it interactively.
Once installed, connect Claude to your eBPF server (runs on port 8080):
# Add MCP server to Claude CLI
claude mcp add ebpf http://localhost:8080/mcp \
-t http \
-H "Authorization: Bearer $(cat /etc/ebpf-mcp-token)"
# Start Claude with eBPF tools
claude --debug
# Optional: Test with MCP Inspector (requires Node.js)
npx @modelcontextprotocol/inspector http://localhost:8080/mcp
Example prompts:
> Get system info and kernel version
> Load and attach a kprobe program to monitor sys_execve
> Show me all active eBPF programs and their types
> Stream events from ringbuffer maps for 10 seconds
> Trace kernel errors for the next 5 seconds
Method | Command | Use Case |
---|---|---|
One-liner | curl ... | sudo bash | Production systems |
Manual | git clone && sudo ./install.sh | Development/air-gapped |
Build from source | make build | Custom modifications |
Docker | Coming soon | Containerized environments |
Each tool is designed to be schema-validatable, AI-orchestrable, and safe-by-default. They cover 80%+ of real-world observability and control workflows.
Tool Name | Status | Description | Capabilities Required |
---|---|---|---|
info | โ | System introspection: kernel, arch, BTF | CAP_BPF or none (read-only) |
load_program | โ | Load and validate .o files (CO-RE supported) | CAP_BPF or CAP_SYS_ADMIN |
attach_program | โ | Attach program to XDP, kprobe, tracepoint hooks | Depends on type (e.g. CAP_NET_ADMIN for XDP) |
inspect_state | โ | List programs, maps, links, and tool metadata | CAP_BPF (read-only) |
stream_events | โ | Stream events from ringbuf/perfbuf maps | CAP_BPF (read-only) |
trace_errors | โ | Monitor kernel tracepoints for error conditions | CAP_BPF (read-only) |
All tools return structured JSON output โ AI-ready, streaming-compatible, and schema-validated.
๐ See
docs/TOOL_SPECS.md
for full schema definitions.
Layer | Controls |
---|---|
eBPF execution | Kernel verifier + resource caps |
Filesystem | No shell, no exec, path-validated |
Runtime isolation | Session-scoped cleanup, strict inputs |
AI safety | Capability-aware schemas + output limits |
Authentication | Bearer token + HTTPS ready |
๐งผ All resources are automatically cleaned up when a client disconnects (no manual unload/detach required unless pinned).
.
โโโ cmd/ # MCP server + CLI client
โโโ internal/ # Core logic: eBPF, tools, kernel adapters
โโโ pkg/types/ # JSON schema bindings + shared types
โโโ docs/ # Tool specs, design notes, schemas
โโโ scripts/ # Install script + test suite
โโโ schemas/ # JSON Schema files for each tool
/sys/fs/bpf/...
) for maps/programs/linkstool_version
verifier_log
(for debugging)error
with context
Future optional tools:
pin_object
/ unpin_object
detach_link
map_batch_op
These are omitted from the default for security and simplicity.
๐งช See scripts/test-ebpf-mcp-server.sh
for full validation suite.
Basic Architecture:
Claude / Ollama / AI Client
โ
MCP JSON-RPC
โ
ebpf-mcp server
โ
Kernel APIs
Component | License |
---|---|
internal/ebpf/ | GPL-2.0 |
Everything else | Apache-2.0 |
๐ฌ GitHub โ sameehj/ebpf-mcp ๐ Contributions, issues, and PRs welcome!
Structured. Safe. Schema-native.
ebpf-mcp
brings eBPF to the age of AI.
Manage Google Apps Script projects, including creation, editing, deployment, and execution. Requires Google Cloud credentials for authentication.
Access DevRev's APIs to manage work items, parts, search, and user information.
Extracts images from files, URLs, or base64 strings and converts them to base64 for LLM analysis.
Generate MCP servers using Smithery with Cursor IDE integration.
Tools to query latest Maven dependency information
A service framework supporting the Model Context Protocol (MCP) to integrate enterprise systems and AI platforms via RESTful, gRPC, and Dubbo protocols.
A reverse proxy gateway for managing and accessing multiple MCP servers through a single entry point, deployable via Docker.
An MCP server that provides control over Android devices through ADB. Offers device screenshot capture, UI layout analysis, package management, and ADB command execution capabilities.
Gentoro generates MCP Servers based on OpenAPI specifications.
Provides real-time access to Chainlink's decentralized on-chain price feeds.