feat: MCP server mode (catchme mcp) - #6
Merged
Conversation
Exposes CatchMe's activity tree as a proper MCP (Model Context Protocol)
server over stdio transport. Any MCP-compatible host (Claude Desktop,
Cursor, Hermes Agent, etc.) can now use CatchMe as a native tool without
shell-parsing prose answers.
Tools exposed:
- search_activity(query, date?) — LLM-powered retrieval, returns answer + sources
- list_days() — available recorded days with top-level summaries
- get_session(session_id) — full session detail with app/location breakdown
- get_tree(date) — full activity tree JSON for a given day
Changes:
- catchme/mcp_server.py: new MCP stdio server using the `mcp` SDK
- catchme/run.py: added `cmd_mcp()` and `catchme mcp` CLI entry
- pyproject.toml: added `mcp[cli]>=1.0` as optional dep under [mcp] extra
Usage:
pip install catchme[mcp]
catchme mcp # starts stdio server
Claude Desktop config:
{"mcpServers": {"catchme": {"command": "catchme", "args": ["mcp"]}}}
Closes HKUDS#5
Collaborator
|
thanks for your contribution! |
This was referenced Apr 25, 2026
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
This PR implements the feature proposed in #5 — exposing CatchMe's activity tree as a proper MCP (Model Context Protocol) stdio server.
Any MCP-compatible host (Claude Desktop, Cursor, Hermes Agent, Windsurf, etc.) can now use CatchMe as a native tool — no skill files, no shell-parsing prose answers, no lock-in.
Changes
catchme/mcp_server.pycatchme/run.pycmd_mcp()+catchme mcpCLI entry + help textpyproject.tomlmcp[cli]>=1.0as optional[mcp]extraTools Exposed
search_activity(query, date?)retrieve()generator, returns{answer, sources}JSONlist_days()get_session(session_id)get_tree(date)Installation & Usage
Claude Desktop (
claude_desktop_config.json):{ "mcpServers": { "catchme": { "command": "catchme", "args": ["mcp"] } } }Cursor (
.cursor/mcp.json):{ "mcpServers": { "catchme": { "command": "catchme", "args": ["mcp"] } } }Design Notes
retrieve(),_load_all_trees(), and_node_index()frompipelines/retrieve.pymcpis not pulled in unless the user explicitly installscatchme[mcp], so the base install is unaffectedmcpis not installed,catchme mcpprints a clear install instruction and exits cleanly instead of crashing with an ImportErrorTesting
Tested locally with Claude Desktop and the MCP Inspector:
list_days()returns correct day summariessearch_activity("what was I coding this morning")correctly traverses the tree and returns a structured answerget_session()andget_tree()return correct JSONmcppackage produces a clean error messageHappy to adjust the tool schema, add HTTP/SSE transport as an alternative, or split into a smaller first step if preferred.