feat: add MCP server for AI assistant integration#101
Merged
Conversation
Add retrochat-mcp crate that exposes chat session query and analytics capabilities via Model Context Protocol (MCP). This enables AI assistants like Claude and Cursor to query and analyze chat history. Features: - Read-only MCP server with stdio transport - 4 tools: list_sessions, get_session_detail, search_messages, get_session_analytics - Comprehensive error handling and validation (UUID, dates) - Pretty-printed JSON responses for AI consumption - Unit tests for all components (9 tests) - Documentation in CLAUDE.md with configuration examples Technical details: - Uses rmcp 0.11 with server, macros, and transport-io features - Shares database with CLI/TUI (read-only access) - Logs to stderr to avoid interfering with stdio transport - Supports RUST_LOG for log level control Usage: cargo mcp # Run MCP server cargo tmcp # Run tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
retrochat-mcpcrate that exposes chat session query and analytics capabilities via Model Context Protocol (MCP). This enables AI assistants like Claude and Cursor to query and analyze chat history.Features
list_sessions- Query and filter chat sessions with paginationget_session_detail- Get full session details with all messagessearch_messages- Full-text search across all messagesget_session_analytics- Get analytics for a sessionTechnical Details
rmcp0.11 with server, macros, and transport-io featuresRUST_LOGenvironment variable for log level controlUsage
Configuration
Claude Desktop (
~/Library/Application Support/Claude/claude_desktop_config.json):{ "mcpServers": { "retrochat": { "command": "/path/to/retrochat-mcp", "args": [] } } }Cursor (
.cursor/mcp.json):{ "mcpServers": { "retrochat": { "command": "cargo", "args": ["run", "-p", "retrochat-mcp"], "cwd": "/path/to/retrochat" } } }Testing
-D warningscargo fmtFiles Changed
crates/retrochat-mcp/crate (5 files, 813 lines)Cargo.tomlwith new member and dependencies.cargo/config.tomlwithmcpandtmcpaliasesCLAUDE.mdwith comprehensive MCP server documentation