Skip to content

Add MCP SDK v2 server and agent hooks - #12

Merged
EhsanAzish80 merged 8 commits into
mainfrom
agent/mcp
Dec 5, 2026
Merged

EhsanAzish80 merged 8 commits into
mainfrom
agent/mcp

Conversation

@EhsanAzish80

@EhsanAzish80 EhsanAzish80 commented Dec 5, 2026 •

Copy link
Copy Markdown
Owner

Summary\n- add a local read-only MCP SDK v2 server with review_changes, cochange, file_risk, fix_history, owners, and blast_radius\n- use one default-base index for every tool so alternating calls neither rebuild nor read the agent branch\n- add portable, non-destructive installers for Claude Code, Cursor, and Codex\n- add a Claude Stop hook that checks staged, unstaged, and untracked files\n- move the supported runtime and CI floor to Python 3.11, with CI on 3.11, 3.12, and 3.13\n\n## Review fixes\n- review_changes leads with missing co-change partners and lists files without risk ranking\n- file_risk returns only fix SHAs, recent churn, and owners; no model score\n- advisory Stop output uses hookSpecificOutput.additionalContext; no findings produce no output\n- strict Stop output writes feedback to stderr and exits 2\n- shared configs use devscope mcp, or uvx devscope mcp with --command uvx; no absolute machine paths\n- Codex project config is documented as requiring a trusted project\n\n## Safety\n- reads local Git history only\n- does not execute repository code\n- does not use the network\n- refuses to overwrite an existing Devscope MCP entry\n\n## Verification\n- 236 passed on Python 3.11\n- focused MCP suite: 11 passed\n- ruff check src tests scripts\n- mypy src

@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

🔍 Devscope Health Check

Devscope: A · Low risk · Easy onboarding · 0.51 test-file ratio · 0.03s ⚡

Updated: Sat, 05 Dec 2026 13:01:38 GMT

@codecov-commenter

codecov-commenter commented Dec 5, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.76454% with 55 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/devscope/cli.py 62.22% 34 Missing ⚠️
src/devscope/mcp/tools.py 87.05% 18 Missing ⚠️
src/devscope/mcp/install.py 94.73% 2 Missing ⚠️
src/devscope/mcp/server.py 96.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@EhsanAzish80

Copy link
Copy Markdown
Owner Author

Addressed the review blockers in b7e4402:\n\n- all six tools now use the same default-base index; regression test alternates cochange, review_changes, and owners and asserts every ensure() call uses main\n- Stop hook checks staged, unstaged, and untracked files; advisory output is hookSpecificOutput.additionalContext, strict writes stderr and exits 2, and no findings are silent\n- installers now write portable devscope mcp entries, with optional --command uvx for uvx devscope mcp; no absolute paths\n- MCP review output has no ranking, and file_risk returns only fix SHAs, churn, and owners with no score\n- CI now includes Python 3.13\n- confirmed Codex supports trusted project .codex/config.toml layers; installer prints the trust requirement\n\nVerification: 236 local tests passed; CI passed on Python 3.11, 3.12, and 3.13; Ruff and strict mypy passed.

@EhsanAzish80

Copy link
Copy Markdown
Owner Author

Hardened the Stop hook in 46e17e4:\n\n- check now defaults to staged + unstaged + untracked working-tree changes; --working-tree remains an optional compatibility flag\n- malformed check invocations and legacy --format agent fail open with exit 0 and no usage noise\n- non-Git directories and runtime errors exit 0 silently\n- stdin hook JSON is read for stop_hook_active\n- strict findings exit 2 only on the first Stop pass; an active continuation is downgraded to advisory additionalContext\n- clean runs remain silent\n\nAdded regression tests for malformed usage, legacy flags, non-Git sessions, default working-tree behavior, and repeated strict Stop calls. Local verification: 238 passed, Ruff clean, strict mypy clean.

@EhsanAzish80

Copy link
Copy Markdown
Owner Author

Fixed the final open-stdin hang in cb5bd7f.\n\ncheck now waits at most 200 ms for hook input: select.select on POSIX, and a daemon reader thread joined for 200 ms on Windows. If no data arrives it uses an empty hook object and continues fail-open.\n\nRegression coverage launches devscope check with stdin=PIPE, deliberately leaves the pipe open and unwritten, and requires a clean exit within 5 seconds.\n\nLocal verification: 239 passed; Ruff and strict mypy passed.

@EhsanAzish80
EhsanAzish80 merged commit 77f8dd6 into main Dec 5, 2026
4 checks passed
@EhsanAzish80
EhsanAzish80 deleted the agent/mcp branch December 5, 2026 13:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants