Add Zed Agent support via MCP server#765
Draft
Krishnachaitanyakc wants to merge 1 commit intogit-ai-project:mainfrom
Draft
Add Zed Agent support via MCP server#765Krishnachaitanyakc wants to merge 1 commit intogit-ai-project:mainfrom
Krishnachaitanyakc wants to merge 1 commit intogit-ai-project:mainfrom
Conversation
Zed's extension API lacks tool-use hooks, so integration uses an MCP server that exposes a `git_ai_checkpoint` tool. The agent is instructed via a .rules file to call checkpoints before/after file edits. Components: - `git-ai mcp-server` command: MCP server over stdio with Content-Length framing (MCP/LSP spec), exposes git_ai_checkpoint tool - `zed` checkpoint preset: parses hook input from MCP tool calls - Zed installer: detects Zed via binary/config, sets up context_servers - `.zed/rules` template: instructs agent to call checkpoint tool The MCP server generates a stable session ID per instance to correlate pre/post checkpoint pairs. Process spawning follows pipe deadlock prevention patterns (start readers before writing stdin).
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.
Closes #675
Summary
Adds Zed Agent support for git-ai. Zed's extension API currently lacks tool-use hooks (no pre/post tool use callbacks, no document change events from extensions), so integration uses an MCP server approach.
Components
git-ai mcp-server— MCP server over stdio with Content-Length framing (MCP/LSP spec). Exposes agit_ai_checkpointtool that Zed's agent can call before/after file editszedcheckpoint preset — Parses hook input from MCP tool calls, creates Human (PreToolUse) and AiAgent (PostToolUse) checkpointssrc/mdm/agents/zed.rs) — Detects Zed installation (binary +~/.config/zed/), configurescontext_serversentry. RespectsXDG_CONFIG_HOME.zed/rulestemplate (agent-support/zed/rules) — Instructs the agent to callgit_ai_checkpointbefore/after every file editHow it works
git-ai install-hooks→ detects Zed → adds MCP server config to~/.config/zed/settings.json.zed/rulesto their projectgit_ai_checkpoint(event: "PreToolUse")before editing andgit_ai_checkpoint(event: "PostToolUse")aftergit-ai checkpoint zed --hook-input stdinDesign decisions
PreToolUse/PostToolUsevaluesLimitations
Test plan
cargo fmt -- --check— passescargo check— zero warningscargo clippy --lib -- -D warnings— passescargo test zed— all 5 tests passgit-ai mcp-serverresponds to MCP protocol messagesgit-ai install-hooksdetects Zed and outputs config instructions