feat(mcp): Phase 1 — parsec mcp serve + stdio JSON-RPC 2.0 server (Refs #293)#348
Open
erishforG wants to merge 1 commit into
Open
feat(mcp): Phase 1 — parsec mcp serve + stdio JSON-RPC 2.0 server (Refs #293)#348erishforG wants to merge 1 commit into
erishforG wants to merge 1 commit into
Conversation
#293) Add `parsec mcp serve` subcommand and the underlying stdio JSON-RPC 2.0 server that makes git-parsec callable by AI agents (Claude Desktop, Cursor). ## What - `src/mcp/server.rs` — new stdio transport loop: - `initialize` → server metadata + protocol version + capabilities - `tools/list` → full TOOLS registry (all 10 tools from Phase 1 spec) - `tools/call` → stub: echoes Phase 3 message for known tools, returns METHOD_NOT_FOUND for unknown tools - `shutdown` → returns null result - malformed JSON → PARSE_ERROR (-32700) - unknown method → METHOD_NOT_FOUND (-32601) - `src/mcp/mod.rs` — expose `pub mod server` - `src/cli/mod.rs` — add `parsec mcp` subcommand with `serve` action; wired via `tokio::task::spawn_blocking` ## Tests (7 new unit tests) initialize, tools/list, tools/call known/unknown, shutdown, unknown method, missing-method field — all in `src/mcp/server::tests`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6 tasks
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.
무엇
parsec mcp serve서브커맨드 + stdio JSON-RPC 2.0 서버 구현 (Phase 2, #293).Phase 1 (#292) 에서 만든
TOOLSregistry와McpContextskeleton 위에 실제 transport loop를 구축.왜
#293 의 핵심 deliverable: AI agent (Claude Desktop, Cursor) 가
parsec mcp serve를 stdio MCP server로 등록하고 JSON-RPC 2.0 으로 호출할 수 있는 기반.등록 예시 (claude_desktop_config.json):
{"command": "parsec", "args": ["mcp", "serve"]}변경
src/mcp/server.rssrc/mcp/mod.rspub mod server노출 (+1 줄)src/cli/mod.rsparsec mcp serve서브커맨드 추가지원 메서드:
initializetools/listtools/callshutdown다음 Phase 힌트
Phase 2 (#293):
tools/callstub 을 실제src/mcp/tools/핸들러와 연결.worktree_list부터 시작 권장 (가장 읽기 전용 + 테스트 용이).리스크
src/mcp/server.rs만 추가. 기존 CLI 명령 변경 없음.src/cli/mod.rs는 새 variant + match arm 추가만 (기존 시그니처 불변).spawn_blocking으로 blocking stdin I/O 를 tokio async context 에서 안전하게 격리.롤백
parsec mcp serve서브커맨드 제거 +src/mcp/server.rs삭제. 기존 명령에 영향 없음.Test plan
수동 smoke test:
Refs #293
Milestone: v1.0
@erishforG