Handles configuration through environment variables stored in a .env file, specifically for storing sudo passwords needed for bpftrace execution
Enables tracing and monitoring of the Linux kernel using eBPF technology through bpftrace, allowing for performance analysis, debugging, and observability of kernel functions and system calls
bpftrace MCP Server: generate eBPF to trace linux kernel
A minimal MCP (Model Context Protocol) server that provides AI assistants with access to bpftrace kernel tracing capabilities.
Now implemented in Rust using the rmcp
crate for better performance and type safety. The Python implementation is still available in the git history.
Features
- list_probes: List available bpftrace probes with optional filtering
- list_helpers: Get information about bpftrace helper functions
- exec_program: Execute bpftrace programs with buffered output
- get_result: Retrieve execution results asynchronously
Installation
Prerequisites
- Install Rust (if not already installed):
- Ensure bpftrace is installed:
- Build the server:
Quick Setup
Use our automated setup scripts:
- Claude Desktop:
./setup/setup_claude.sh
- Claude Code:
./setup/setup_claude_code.sh
For detailed setup instructions and manual configuration, see setup/SETUP.md.
Running the Server
Direct Execution
Through Cargo
Manual Configuration
For manual setup instructions for Claude Desktop or Claude Code, see setup/SETUP.md.
Usage Examples
List System Call Probes
Get BPF System Information
Execute a Simple Trace
Get Results
Security Notes
- The server requires sudo access for bpftrace
- Password Handling: Create a
.env
file with your sudo password: - Alternative: Configure passwordless sudo for bpftrace:
- No script validation - trust the AI client to generate safe scripts
- Resource limits: 60s max execution, 10k lines buffer
- See SECURITY.md for detailed security configuration
Architecture
The Rust server uses:
- Tokio async runtime for concurrent operations
- Subprocess management for bpftrace execution
- DashMap for thread-safe in-memory buffering
- Automatic cleanup of old buffers
- rmcp crate for MCP protocol implementation
Limitations
- No real-time streaming (use get_result to poll)
- Simple password handling (improve for production)
- No persistent storage of executions
- Basic error handling
Documentation
- Setup Guide - Detailed installation and configuration
- Claude Code Setup - Claude Code specific instructions
- CLAUDE.md - Development guidance for AI assistants
- Design Document - Architecture and design details
Future Enhancements
- Add SSE transport for real-time streaming
- Implement proper authentication
- Add script validation and sandboxing
- Support for saving/loading trace sessions
- Integration with eBPF programs
This server cannot be installed
A minimal server that provides AI assistants with access to Linux kernel tracing capabilities through bpftrace, enabling dynamic tracing and performance analysis via the Model Context Protocol.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with Sentry for error tracking and monitoring, allowing retrieval and analysis of error data, project management, and performance monitoring through the Sentry API.Last updated -1019TypeScript
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI clients to interact with virtual Ubuntu desktops, allowing them to browse the web, run code, and control instances through mouse/keyboard actions and bash commands.Last updated -514JavaScriptMIT License
- AsecurityAlicenseAqualityA server that enables AI assistants to execute terminal commands and retrieve outputs via the Model Context Protocol (MCP).Last updated -313PythonMIT License
Sentry MCP Serverofficial
AsecurityFlicenseAqualityA Model Context Protocol server that lets AI assistants interact with the Sentry API to retrieve and analyze error data, manage projects, and monitor application performance.Last updated -116TypeScript