-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Model Context Protocol (MCP) Support to SuperSocket #809
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
Add Model Context Protocol (MCP) Support to SuperSocket #809
Conversation
Co-authored-by: kerryjiang <[email protected]>
Co-authored-by: kerryjiang <[email protected]>
…NET versions Co-authored-by: kerryjiang <[email protected]>
It seems this MCP implementation cannot work on http (http post and SSE), can you use SuperSocket.Http to make it support Http too? |
Co-authored-by: kerryjiang <[email protected]>
Added HTTP support to MCP implementation using SuperSocket.Http. The implementation now supports:
Key features:
The HTTP implementation leverages SuperSocket.Http's pipeline filter and SSE capabilities while maintaining the same MCP protocol semantics. Both TCP and HTTP transports can run simultaneously. Commit: 7a946ac |
Co-authored-by: kerryjiang <[email protected]>
This PR adds comprehensive support for the Model Context Protocol (MCP) to SuperSocket, enabling LLM applications to communicate with external tools and data sources through a standardized JSON-RPC 2.0 interface.
What is MCP?
The Model Context Protocol is an open standard that enables seamless integration between LLM applications and external data sources and tools. It uses JSON-RPC 2.0 messages and follows a client-server architecture where:
Features Added
✅ Complete MCP Protocol Support: Full JSON-RPC 2.0 implementation following MCP specification version 2024-11-05
✅ Tool Integration: Easy registration and execution of MCP tools with JSON Schema validation
✅ Resource Management: Support for MCP resources with subscription capabilities
✅ Prompt Handling: MCP prompt management and templating
✅ SuperSocket Integration: Leverages SuperSocket's robust pipeline architecture
✅ Extensibility: Clean interfaces for implementing custom handlers
✅ Error Handling: Proper MCP error responses with standard error codes
✅ Logging: Comprehensive logging integration
✅ Concurrent Operations: Thread-safe handler management
Components Implemented
Core Models (
src/SuperSocket.MCP/Models/
)McpMessage.cs
: Core JSON-RPC 2.0 message structure with request/response/notification detectionMcpCapabilities.cs
: Server/client capability definitions for protocol negotiationMcpInitialize.cs
: Initialization protocol messages and handshakeMcpTool.cs
: Tool definition and execution models with content supportPipeline Filter (
src/SuperSocket.MCP/McpPipelineFilter.cs
)MCP Server (
src/SuperSocket.MCP/McpServer.cs
)Handler Interfaces (
src/SuperSocket.MCP/Abstractions/
)IMcpToolHandler
: For implementing executable MCP toolsIMcpResourceHandler
: For implementing readable MCP resourcesIMcpPromptHandler
: For implementing templated MCP promptsExtension Methods (
src/SuperSocket.MCP/Extensions/McpExtensions.cs
)Usage Example
Testing
Benefits
Compatibility
This implementation makes SuperSocket a powerful platform for building MCP-compliant servers that can integrate with LLM applications like Claude, ChatGPT, and other AI tools, opening up new possibilities for AI-powered applications built on SuperSocket's robust foundation.
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.