Skip to content

feat: Add MCP Client implementation #89

@avrabe

Description

@avrabe

Summary

Add a full MCP client implementation to enable connecting TO MCP servers, not just serving as one.

Motivation

The official rmcp SDK provides complete client-side capabilities. Adding this to PulseEngine would:

  • Enable building MCP proxies and gateways
  • Allow programmatic testing of MCP servers
  • Support multi-hop MCP architectures
  • Make PulseEngine a complete SDK (client + server)

Proposed Implementation

Reuse existing code where possible:

Component Reuse From Notes
Protocol models mcp-protocol All request/response types already defined
Transports mcp-transport stdio, HTTP, WebSocket, streamable HTTP
JSON-RPC handling mcp-server Message parsing, error handling
Auth mcp-auth OAuth client flow, bearer tokens

New Code Needed

// Example API design
let client = McpClient::connect(StdioTransport::new(child_process)).await?;

// Initialize
let server_info = client.initialize(client_info).await?;

// Use server capabilities
let tools = client.list_tools().await?;
let result = client.call_tool("tool_name", json!({"arg": "value"})).await?;

let prompts = client.list_prompts().await?;
let prompt = client.get_prompt("prompt_name", args).await?;

let resources = client.list_resources().await?;
let content = client.read_resource("resource://uri").await?;

// Notifications
client.notify_cancelled(request_id, reason).await?;
client.notify_progress(token, progress, total).await?;

Crate Structure Options

  1. Add to mcp-server - Rename to mcp-core or mcp-runtime
  2. New mcp-client crate - Separate concerns, optional dependency

Acceptance Criteria

  • Connect to MCP servers via stdio transport
  • Full protocol support (tools, prompts, resources, completions)
  • Progress and cancellation notifications
  • Pagination helpers (list_all_* convenience methods)
  • Integration with existing auth infrastructure
  • Example: programmatic server testing
  • Example: MCP proxy/gateway

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions