Skip to content

[EPIC] MCP Protocol Core #2

@copyleftdev

Description

@copyleftdev

POLYMCP-001

Goals

  • Full MCP v2025-11-25 protocol compliance
  • Async JSON-RPC 2.0 over stdio
  • Type-safe request/response handling
  • Proper error codes and messages

Implement the Model Context Protocol (MCP) specification v2025-11-25 in Rust. This includes JSON-RPC 2.0 message handling, the stdio transport layer, and all core MCP types (tools, resources, prompts). The server must handle initialization handshake, capability negotiation, and tool invocation lifecycle.

Acceptance Criteria

AC-1

  • Given An MCP client sends an initialize request
  • When The server receives the request
  • Then It responds with serverInfo, capabilities, and protocolVersion matching the spec

AC-2

  • Given A client calls tools/list
  • When The server has registered tools
  • Then It returns a JSON array of Tool objects with name, description, and inputSchema

AC-3

  • Given A client calls tools/call with valid arguments
  • When The tool executes successfully
  • Then It returns CallToolResult with content array and optional structuredContent

AC-4

  • Given A client sends a malformed JSON-RPC request
  • When The server parses the message
  • Then It returns a JSON-RPC error with appropriate code (-32700 parse, -32600 invalid, etc.)

AC-5

  • Given The MCP server binary
  • When Started with stdio transport
  • Then It reads newline-delimited JSON from stdin and writes responses to stdout

Technical Context

Crates: tokio, serde, serde_json, thiserror, tracing

Files:

  • src/lib.rs
  • src/mcp/mod.rs
  • src/mcp/types.rs
  • src/mcp/jsonrpc.rs
  • src/mcp/server.rs
  • src/mcp/transport.rs
  • src/mcp/error.rs

Interfaces

McpServer

pub struct McpServer { ... }

Main server struct handling MCP protocol

Tool

pub trait Tool: Send + Sync { async fn call(&self, args: Value) -> Result<CallToolResult>; }

Trait for implementing MCP tools

Out of Scope

  • SSE transport (future milestone)
  • Resources implementation (separate epic)
  • Prompts implementation (not needed for this project)
  • Sampling/LLM integration

Source: epics/00-mcp-core.json
Content Hash: bf3102bfc69a9e8c

Child Issues: POLYMCP-010, POLYMCP-011, POLYMCP-012, POLYMCP-013

Metadata

Metadata

Assignees

No one assigned

    Labels

    component:mcp-coreMCP protocol types and JSON-RPC handlingcomponent:mcp-transportMCP transport layer (stdio, SSE)epicLarge feature containing multiple storiesmvpRequired for MVP releasepriority:criticalMust be done immediately

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions