feat(mcp): add kon-mcp — read-only MCP stdio server over transcripts and tasks

New workspace binary crates/mcp exposes Kon's SQLite store to external
agents (Claude desktop, Cline, any MCP client) without running the Tauri
app. Newline-delimited JSON-RPC 2.0 on stdio, MCP protocol 2024-11-05.

Tools shipped (all read-only):
- list_transcripts — recent transcript summaries, limit 1..200 default 20
- get_transcript   — full text + metadata by id
- search_transcripts — FTS5-backed query, limit 1..100 default 20
- list_tasks       — all tasks (open + done)

No writes. The Tauri app remains the only writer; kon-mcp just opens the
same SQLite file (via kon_storage::init) and reads. Logs land on stderr to
keep stdout clean for the JSON-RPC stream. Smoke-tested end-to-end with
initialize + tools/list over a pipe.

Wire into an MCP client with:
  { "mcpServers": { "kon": { "command": "/path/to/kon-mcp" } } }

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-21 07:52:12 +01:00
parent b8baa65bd2
commit 63e00c15b1
3 changed files with 500 additions and 0 deletions

23
crates/mcp/Cargo.toml Normal file
View File

@@ -0,0 +1,23 @@
[package]
name = "kon-mcp"
version = "0.1.0"
edition = "2021"
description = "Read-only MCP stdio server exposing Kon transcripts and tasks to external agents"
[[bin]]
name = "kon-mcp"
path = "src/main.rs"
[lib]
path = "src/lib.rs"
[dependencies]
kon-storage = { path = "../storage" }
sqlx = { version = "0.8", default-features = false, features = ["runtime-tokio", "sqlite"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["macros", "rt", "io-std", "io-util"] }
anyhow = "1"
[dev-dependencies]
tempfile = "3"