- Notifications
You must be signed in to change notification settings - Fork 7.6k
feat: Add MCP (Model Context Protocol) base protocol implementation with Netty #3039
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive MCP (Model Context Protocol) base protocol implementation using Netty for Arthas. The purpose is to enable Arthas to expose its diagnostic capabilities through a standardized protocol that can be consumed by AI models and other clients.
Key changes include:
- Implements MCP 2024-11-05 protocol specification with JSON-RPC message handling
- Provides HTTP/SSE transport layer using Netty for real-time communication
- Integrates 20+ Arthas diagnostic tools (JVM, class loading, memory analysis) as MCP tools
- Establishes layered architecture with transport, session, server, and features layers
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pom.xml | Adds new arthas-mcp-server module to the build |
| McpSchema.java | Comprehensive MCP protocol schema definitions and JSON-RPC message types |
| McpServer.java | Main server interface and builder for configuring MCP server instances |
| McpRequestHandler.java | HTTP request handler managing SSE connections and message routing |
| Tool implementations | 20+ tool classes wrapping Arthas commands (jvm, memory, classloader, etc.) |
| Utility classes | JSON parsing, schema generation, assertion helpers, and type conversion utilities |




#3013
协议部分 (2024-11-05)
采用分层架构,主要分为以下几层:
TransportProvider : Transport : McpSession : 客户端 = 1 : N : N : N
TransportProvider 作为工厂类,为每个新的客户端连接创建新的 Transport,Transport 负责与单个客户端之间的消息传输 ,McpSession 管理单个客户端的所有会话状态。
工具架构
由于现在仅支持旧版本的mcp协议(2024-11-05),暂未支持Streamable http,支持的工具只是单次调用的,支持列表:
jvm相关
class/classloader 相关
.java文件为.class文件.class文件,redefine 到 JVM 里.class文件,retransform 到 JVM 里Todo