AI

alex-ilgayev/mcpspy

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

521 stars 79 forks 质量 62 趋势 20Apache-2.0

使用eBPF进行MCP监控

概览

███╗ ███╗ ██████╗██████╗ ███████╗ ██████╗ ██╗ ██╗ ███████ ████████ █████ ████ ███ ́” ιικ███ ╔ ιικ██╗╚██ ██╝ ██╔████ ██╔████ ██████╔╝███████╗██████╔╝ ╚█████╝ ██╝ ██║ ╚██╔╝██║ ██╔ ╔ ║██ ╚ ╚ ╚ ╚ ╚ ╚ ╔ ╚██╔╝ ██║ ╚ ╚ ╚ ╚║ ████████║ ███████║██║ ╚ ╚ ╚ ╁ ╚ ╝╚ ╚═════╝╚ ╚ ╚══════╝╚ ╚ ╚ MCPSpy - 使用 eBPF 进行模型上下文协议通信实时监控 MCPSpy 是一款强大的命令行工具,利用 eBPF(扩展伯克利数据包过滤)技术监控内核层的模型上下文协议(MCP)通信。它通过连接低级别系统调用,实时可见 MCP 客户端与服务器之间交换的 JSON-RPC 2.0 消息。

概述(AI 翻译)

███╗ ███╗ ██████╗██████╗ ███████╗██████╗ ██╗ ██╗ ████╗ ████║██╔════╝██╔══██╗██╔════╝██╔══██╗╚██╗ ██╔╝ ██╔████╔██║██║ ██████╔╝███████╗██████╔╝ ╚████╔╝ ██║╚██╔╝██║██║ ██╔═══╝ ╚════██║██╔═══╝ ╚██╔╝ ██║ ╚═╝ ██║╚██████╗██║ ███████║██║ ██║ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚══════╝╚═╝ ╚═╝

MCPSpy - 使用eBPF进行模型上下文协议通信的实时监控

概述

MCPSpy 是一款强大的命令行工具,利用 eBPF(扩展伯克利数据包过滤)技术监控内核层的模型上下文协议(MCP)通信。它通过连接低级别系统调用,实时可见 MCP 客户端与服务器之间交换的 JSON-RPC 2.0 消息。

模型上下文协议支持三种传输协议进行通信:

  • Stdio:通过标准输入/输出流进行通信
  • 可流式HTTP:直接HTTP请求/响应通信,由服务器发送的事件
  • SSE(服务器发送事件):基于HTTP的流式通信(Deprecated)

MCPSpy 支持监控 Stdio 和 HTTP/HTTPS 传输(包括服务器发送事件),全面覆盖 MCP 通信通道。

为什么是MCPSpy?

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCPSpy - MCP Monitoring with eBPF 🕵️✨

Overview

MCPSpy is a powerful command-line tool that leverages eBPF (Extended Berkeley Packet Filter) technology to monitor Model Context Protocol (MCP) communication at the kernel level. It provides real-time visibility into JSON-RPC 2.0 messages exchanged between MCP clients and servers by hooking into low-level system calls.

The Model Context Protocol supports three transport protocols for communication:

  • Stdio: Communication over standard input/output streams
  • Streamable HTTP: Direct HTTP request/response communication with server-sent events
  • SSE (Server-Sent Events): HTTP-based streaming communication (Deprecated)

MCPSpy supports monitoring of both Stdio and HTTP/HTTPS transports (including Server-Sent Events), providing comprehensive coverage of MCP communication channels.

Why MCPSpy?

The Model Context Protocol is becoming the standard for AI tool integration, but understanding what’s happening under the hood can be challenging. MCPSpy addresses this by providing:

  • 🔒 Security Analysis: Monitor what data is being transmitted, detect PII leakage, and audit tool executions
  • 🛡️ Prompt Injection Detection: Real-time detection of prompt injection and jailbreak attempts using ML models
  • 🐛 Debugging: Troubleshoot MCP integrations by seeing the actual message flow
  • 📊 Performance Monitoring: Track message patterns and identify bottlenecks
  • 🔍 Compliance: Ensure MCP communications meet regulatory requirements
  • 🎓 Learning: Understand how MCP works by observing real communications

Installation

Prerequisites

  • Linux kernel version 5.15 or later
  • Root privileges (required for eBPF)

Download Pre-built Binary (Auto-detect OS + Arch)

Download the latest release from the release page:

# Set platform-aware binary name
BIN="mcpspy-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/')"

# Download the correct binary
wget "https://github.com/alex-ilgayev/mcpspy/releases/latest/download/${BIN}"
在 GitHub 查看完整 README

安装

docker run --rm -it --privileged ghcr.io/alex-ilgayev/mcpspy:latest
新手?先看 mcpskill.org 教程 →