v2.0 Phase 1: MCP server skeleton (list_open_files)#9
Open
nonatofabio wants to merge 2 commits intomainfrom
Open
v2.0 Phase 1: MCP server skeleton (list_open_files)#9nonatofabio wants to merge 2 commits intomainfrom
nonatofabio wants to merge 2 commits intomainfrom
Conversation
Phase 1 of v2.0 plumbing. The Mindle app now binds a Unix socket at ~/Library/Caches/local.fnp.mindle/mcp.sock on launch and unlinks it on terminate. The internal protocol over the socket is a tiny length-prefixed JSON dialect (not MCP — the helper handles MCP framing on stdio). Phase 1 ships one op: list_open_files. Aggregated across every window's tabs via a new registeredStores list (weak refs) on AppDelegate, populated whenever a RootView registers its store. Read-only by design: filesystem reads belong in the agent's own Read tool. Mindle's MCP only ever exposes what's unique to Mindle — open-files state and (in the next phase) the annotation feedback channel.
Bundled CLI at Mindle.app/Contents/MacOS/mindle-mcp. Reads newline-delimited JSON-RPC from stdin, handles the standard MCP handshake (initialize / tools/list / tools/call), and translates each tools/call into a length-prefixed request over Mindle's Unix socket. Phase 1 supports one tool: list_open_files. If Mindle isn't running, the helper returns a tool error with a clear 'Open Mindle and try again' message instead of hanging or silently failing. End-to-end smoke test passes — full handshake produces: initialize → serverInfo tools/list → list_open_files schema tools/call list_open_files → text content with absolute paths Build script picks up Sources/MindleMCP/*.swift and embeds the binary in the app bundle.
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
First slice of the v2.0 milestone — the MCP plumbing that lets Claude (or any other harness) ask Mindle questions over a real protocol. Phase 1 only, intentionally narrow: prove the round-trip with one tool, then layer on the annotation surface in Phase 2.
Architecture decision: Mindle's MCP is read-only and Mindle-unique
read_fileandwrite_filebelong in the agent's own filesystem tools. Mindle's MCP only exposes what no other tool can — what's currently open, what the user has annotated, and (in Phase 2) the ability to mark an annotation as addressed. The whole MCP becomes "the human's side of an agent collaboration loop, full stop."What's in this PR
MCPServeractor inSources/mindle/MCPServer.swift. Binds a Unix socket at~/Library/Caches/local.fnp.mindle/mcp.sockon launch, unlinks it on terminate. Speaks length-prefixed JSON internally — not MCP; the helper handles MCP framing.registeredStoreslist (weak refs) solist_open_filesaggregates paths across every window.applicationDidFinishLaunchingstarts the server;applicationWillTerminatestops it.mindle-mcpSwift CLI inSources/MindleMCP/main.swift. Synchronous POSIX-read stdin loop, newline-delimited JSON-RPC out, full MCP handshake (initialize/tools/list/tools/call). Ontools/call list_open_files, opens the Unix socket, sends the internal op, formats the response as text content. Clean error if Mindle isn't running ("Open Mindle and try again").build.shcompiles the helper alongside the main app and embeds it atMindle.app/Contents/MacOS/mindle-mcp.Smoke test (passes locally)
Returns proper
serverInfo, thelist_open_filesschema, and the open file paths as text content.Coming in subsequent phases
get_annotations(path)andclear_annotation(id, summary). Summary attaches to the diff chip's hover.mindle-collaborationskill atdocs/skills/mindle-collaboration.mdteaching the agent the loop and listing tools as deferred (zero context cost until first call).Part of v2.0 roadmap.