GAP_ANALYSIS

MCP Specification Gap Analysis

Raku MCP SDK vs MCP Specification 2025-11-25

This document compares the current implementation of the Raku MCP SDK against the MCP Specification 2025-11-25 and identifies missing features.

Summary

CategoryStatusNotes
Base Protocolāœ… CompleteJSON-RPC 2.0, lifecycle, version negotiation
Transportsāœ… CompleteStdio, Streamable HTTP, Legacy SSE
Server Featuresāœ… CompleteTools/Resources/Prompts + pagination, templates, subscriptions, annotations
Client Featuresāœ… CompleteSampling with tools, completion, roots, elicitation
Utilitiesāœ… CompleteLogging, progress, cancellation, ping
Authorizationāœ… CompleteOAuth 2.1 with PKCE, dynamic registration, M2M, enterprise IdP
New 2025-11-25 Featuresāœ… CompleteElicitation, Tasks, Sampling-with-tools, Extensions

Table of Contents

Detailed Analysis

Base Protocol

āœ… Implemented

  • JSON-RPC 2.0 message format (MCP::JSONRPC)

  • Request/Response/Notification handling

  • ID generation

  • Error codes (ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError)

Notes

  • Lifecycle: Initialize/initialized handshake with version negotiation (server falls back to latest supported version if client's isn't recognized)

  • JSON-RPC batching: Not supported (removed from spec in 2025-06-18)

Transports

āœ… Stdio Transport (MCP::Transport::Stdio)

  • Complete implementation

  • Proper newline-delimited JSON messages

āœ… Streamable HTTP Transport (MCP::Transport::StreamableHTTP)

  • Full server-side implementation (POST/GET/DELETE)

  • Full client-side implementation

  • Session management (MCP-Session-Id header)

  • Last-Event-ID replay for SSE resumption

  • CORS handling via allowed-origins

  • Protocol version validation (MCP-Protocol-Version header)

  • Proper error responses per spec (400, 403, 404, 405, 406, 415)

āœ… Legacy SSE Transport (MCP::Transport::SSE)

  • Server-side: GET /sse for SSE stream, POST /message for client messages

  • Client-side: connects to SSE endpoint, receives POST URL via endpoint event

  • Origin validation

  • Single-client model (one SSE connection at a time)

Server Features

āœ… Tools (MCP::Server::Tool)

  • Tool registration with name, description, schema

  • Tool calling with arguments

  • Builder pattern API

  • Tool annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint)

  • outputSchema for structured tool outputs (2025-06-18)

  • Tool name validation (SEP-986: ^[a-zA-Z0-9_-]{1,64}$)

  • tools/list pagination support

āœ… Resources (MCP::Server::Resource)

  • Resource registration with URI, name, description, mimeType

  • Resource reading

  • Resource templates (URI templates with placeholders)

  • Resource subscriptions (resources/subscribe, resources/unsubscribe)

  • notifications/resources/list_changed and notifications/resources/updated

  • resources/list pagination support

  • Resource annotations (audience, priority)

āœ… Prompts (MCP::Server::Prompt)

  • Prompt registration with arguments

  • Prompt retrieval with argument substitution

  • prompts/list pagination support

  • notifications/prompts/list_changed

Client Features

āœ… Sampling (MCP::Client sampling-handler) - Implemented

  • sampling/createMessage handling with full parameter support

  • Tool definitions in sampling requests (SEP-1577)

  • toolChoice parameter support

  • includeContext parameter with capability validation

  • stopReason in responses

  • Tool validation in sampling messages

  • Server-side create-message() convenience method with tools/toolChoice/includeContext

āœ… Roots - Implemented

  • Root type with uri and optional name

  • Client-side:

    • roots configuration option

    • Handles roots/list requests from server

    • set-roots() method sends notifications/roots/list_changed

    • Advertises roots capability (with listChanged)

  • Server-side:

    • list-roots() method to request roots from client

āœ… Elicitation (2025-06-18 feature)

  • ElicitationCapability with form/url mode support

  • ElicitationAction enum (accept/decline/cancel)

  • ElicitationResponse type with content

  • Server-side:

    • elicit(message, schema) for form mode requests

    • elicit-url(message, url, elicitation-id) for URL mode

    • notify-elicitation-complete(elicitation-id) for completion

  • Client-side:

    • elicitation-handler callback for handling requests

    • Capability negotiation with form/url modes

    • URLElicitationRequired error code (-32042)

Utilities

āœ… Progress Tracking - Implemented

  • progress() method on Server with automatic _meta.progressToken extraction

  • proto dispatch-request sets $*MCP-PROGRESS-TOKEN dynamic variable for all handlers

  • Explicit token parameter overrides implicit _meta token

  • No notification emitted when no token is available

  • Client progress() Supply emits typed Progress objects from notifications/progress

  • Types defined (Progress)

āœ… Logging - Implemented

  • log() method on Server with level filtering

  • LogLevel enum, LogEntry type, parse-log-level, log-level-at-or-above helpers

  • logging/setLevel request handler on Server stores and applies log level

  • Log notifications below configured level are suppressed

  • Client set-log-level() method sends logging/setLevel request

āœ… Cancellation - Implemented

  • Server tracks in-flight requests and handles notifications/cancelled

  • Client sends cancellation notification on timeout

  • Both sides have cancel-request method for explicit cancellation

  • is-cancelled method for handlers to check cancellation status

āœ… Ping

  • Server responds to ping requests

  • Client has ping() helper

āœ… Completion (autocomplete)

  • completion/complete request handling

  • Server: add-prompt-completer(), add-resource-completer() for registering completers

  • Client: complete-prompt(), complete-resource() convenience methods

  • CompletionResult type with values, total, hasMore

  • Auto-truncation to 100 values per spec

  • completions capability advertised when completers registered

Authorization (2025-03-26+)

āœ… Implemented

OAuth 2.1 authorization framework:

  • āœ… OAuth 2.1 with PKCE (S256)

  • āœ… Token refresh

  • āœ… Resource indicators (RFC 8707)

  • āœ… Authorization server metadata discovery (RFC 8414 + OIDC fallback)

  • āœ… Protected resource metadata (RFC 9728)

  • āœ… Server-side token validation with WWW-Authenticate headers

  • āœ… Client-side automatic token management and 401 retry

  • āœ… Dynamic client registration (RFC 7591)

New Features in 2025-11-25

āœ… Tasks (Experimental)

Long-running operation support:

  • Task creation with task hint in tools/call

  • Task states: working, input_required, completed, failed, cancelled

  • tasks/get for status polling

  • tasks/cancel for cancellation

  • tasks/result for blocking result retrieval

  • tasks/list for listing all tasks

  • notifications/tasks/status on state changes

  • Tool-level execution.taskSupport via builder

āœ… Extensions Framework

  • Extension capability negotiation via experimental hash

  • Extension settings and versioning

  • Namespaced extension methods and notification dispatch

  • Server: register-extension(), unregister-extension()

  • Client: register-extension(), server-extensions(), supports-extension()

āœ… Authorization Extensions

  • āœ… SEP-1046: OAuth client credentials (M2M) — OAuthM2MClient with client_credentials grant

  • āœ… SEP-990: Enterprise IdP policy controls — OAuthEnterpriseClient with token exchange (RFC 8693) and JWT bearer grant (RFC 7523)

āœ… URL Mode Elicitation (SEP-1036)

  • elicit-url() method for URL mode requests

  • notify-elicitation-complete() for completion notifications

  • URLElicitationRequired error code (-32042)

āœ… Sampling with Tools (SEP-1577)

  • Tool definitions in sampling requests

  • Server-side agentic loops

Comparison with Python SDK

The official Python SDK implements:

FeaturePython SDKRaku SDK
Toolsāœ… Fullāœ… Full + annotations
Resourcesāœ… Full + templates + subscriptionsāœ… Full + templates + subscriptions
Promptsāœ… Fullāœ… Full
Samplingāœ… Full + toolsāœ… Full + tools
Rootsāœ… Fullāœ… Full
Elicitationāœ… Full + URL modeāœ… Full
OAuth 2.1āœ… Fullāœ… Full
Streamable HTTPāœ… Full client + serverāœ… Full
SSE Transportāœ… Fullāœ… Full
Tasksāœ… Experimentalāœ… Done (experimental)
Completionāœ… Fullāœ… Full
Paginationāœ… Fullāœ… Full
Extensionsāœ… Experimentalāœ… Done (experimental)

Remaining Work

All priority items from the original roadmap have been completed, including expanded test coverage for progress tracking, error edge cases, and concurrent operations.

Protocol Version

Current implementation targets: 2025-11-25 āœ…

All key features for 2025-11-25 compliance are implemented.

Test Coverage Gaps

Current tests cover:

  • āœ… Types serialization (01-types)

  • āœ… JSON-RPC encoding/decoding (02-jsonrpc)

  • āœ… Builder patterns (03-builders)

  • āœ… Transport interface (04-transport)

  • āœ… Server dispatch and lifecycle (05-server)

  • āœ… Client initialization (06-client)

  • āœ… Top-level MCP exports (07-mcp)

  • āœ… Sampling validation (08-sampling)

  • āœ… HTTP transport (09-http-transport)

  • āœ… OAuth 2.1 types, PKCE, server/client handlers (10-oauth)

  • āœ… Tasks framework (11-tasks)

  • āœ… Extensions framework (12-extensions)

  • āœ… Resource templates (13-resource-templates)

  • āœ… SSE transport (14-sse-transport)

Areas with limited test coverage:

  • Progress tracking (server notifications, client Supply)

  • Error edge cases (malformed messages, transport failures)

  • Concurrent operations (parallel requests, race conditions)

Conclusion

The Raku MCP SDK provides comprehensive MCP specification 2025-11-25 coverage. All transport types (Stdio, Streamable HTTP, Legacy SSE), all server features (Tools, Resources, Prompts), all client features (Sampling, Roots, Elicitation, Completion), and full OAuth 2.1 authorization are implemented. No significant gaps remain.

MCP v0.33.6

Model Context Protocol SDK for Raku - Build MCP servers and clients

Authors

  • Waclaw Kusnierczyk

License

MIT

Dependencies

JSON::FastCro::HTTPMIME::Base64

Provides

  • MCP
  • MCP::Client
  • MCP::JSONRPC
  • MCP::OAuth
  • MCP::OAuth::Client
  • MCP::OAuth::Server
  • MCP::Server
  • MCP::Server::Prompt
  • MCP::Server::Resource
  • MCP::Server::Tool
  • MCP::Transport::Base
  • MCP::Transport::SSE
  • MCP::Transport::Stdio
  • MCP::Transport::StreamableHTTP
  • MCP::Types

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.