spt-mcp-client
MCP (Model Context Protocol) server exposing SmartBrain operations as tools for AI assistants
Overview
spt-mcp-client implements a JSON-RPC 2.0 MCP server that exposes SmartBrain cognitive operations as callable tools for Claude and other AI assistants. It provides the protocol layer only --- the McpToolHandler trait must be implemented by a platform bridge to connect to actual SmartBrain operations. Communication uses stdio with line-delimited JSON-RPC.
Key Features
- JSON-RPC 2.0 Protocol --- standard MCP request/response over stdio
- Tool Discovery ---
list_toolsendpoint with schema definitions for each tool - Pluggable Handler ---
McpToolHandlertrait for platform-specific tool implementations - SmartBrain Tool Definitions --- pre-defined tool schemas for cognitive operations
- Async Runtime --- tokio-based async stdio transport
Dependencies
Key external dependencies:
tokio--- async runtime for stdio transportserde/serde_json--- JSON-RPC serialization
No internal SPT crate dependencies (protocol layer only).
Usage
rust
use std::sync::Arc;
use spt_mcp_client::server::{McpToolHandler, run_stdio};
use spt_mcp_client::types::{ToolCallResult, ToolDefinition};
struct MyHandler;
impl McpToolHandler for MyHandler {
fn handle_tool_call(&self, name: &str, params: serde_json::Value)
-> spt_mcp_client::McpResult<ToolCallResult> {
Ok(ToolCallResult::text("result"))
}
fn list_tools(&self) -> Vec<ToolDefinition> {
spt_mcp_client::tools::smartbrain_tools()
}
}API Reference
Core Types
| Type | Description |
|---|---|
McpServer | JSON-RPC server managing request dispatch |
McpRequest | Incoming JSON-RPC request |
McpResponse | Outgoing JSON-RPC response |
ToolDefinition | Schema definition for a callable tool |
ToolCallResult | Result of a tool invocation |
ContentBlock | Text or data block in a tool result |
McpError | Crate error type |
Key Traits
| Trait | Description |
|---|---|
McpToolHandler | Implement to handle tool calls and list available tools |
Key Functions
| Function | Description |
|---|---|
run_stdio() | Start the MCP server on stdin/stdout |
smartbrain_tools() | Returns pre-defined SmartBrain tool definitions |