Skip to main content

Crate velocity_mcp_core

Crate velocity_mcp_core 

Source
Expand description

VELOCITY-MCP Core - WASM-compatible protocol logic.

This crate contains pure MCP protocol handling without OS-specific dependencies. It can be compiled to both native and wasm32-wasip1 targets.

§Tool Execution

The core crate defines a ToolExecutor trait that callers implement to provide actual tool execution. The handle_mcp_request_with_executor function routes tools/list and tools/call to the provided executor, enabling real tool execution in any deployment target (native, edge/WASM, etc.).

§Supported MCP Methods

MethodStatus
initializeFull — declares tools, resources, prompts capabilities
notifications/initializedAcknowledged (no-op)
pingFull
tools/listFull via executor; stub returns empty
tools/callFull via executor; stub returns placeholder
resources/listReturns empty list (no resource provider on Edge)
resources/readValidates URI format, returns error for unknown URIs
resources/templates/listReturns empty list
prompts/listReturns empty list (no prompt provider on Edge)
prompts/getValidates name, returns error for unknown prompts
elicitation/createRefused (-32601) — server→client method
roots/listRefused (-32601) — server→client method
completion/completeValidates ref type, returns empty completions
sampling/createMessageRefused (-32601) — server→client method

Structs§

McpError
MCP error structure
McpRequest
MCP JSON-RPC request
McpResponse
MCP JSON-RPC response
ToolDefinition
Definition of an MCP tool (name, description, JSON Schema for input).

Traits§

ToolExecutor
Trait for providing tool listing and execution to the core protocol handler.

Functions§

handle_mcp_request
Process an MCP request in stub mode (no tool execution).
handle_mcp_request_with_executor
Process an MCP request with a real tool executor.
parse_request
Parse raw JSON bytes into an McpRequest
serialize_response
Serialize an McpResponse to JSON bytes