Skip to content

feat: add ccpr_comment MCP tool#62

Merged
hidetzu merged 1 commit into
mainfrom
feat/mcp-comment
May 4, 2026
Merged

feat: add ccpr_comment MCP tool#62
hidetzu merged 1 commit into
mainfrom
feat/mcp-comment

Conversation

@hidetzu
Copy link
Copy Markdown
Owner

@hidetzu hidetzu commented May 4, 2026

Summary

  • Expose ccpr comment --format json over MCP as a new ccpr_comment tool, served by the existing ccpr-mcp binary alongside ccpr_list and ccpr_review. This is the first write-side MCP tool: each successful call posts a real comment to CodeCommit, so the tool description and README explicitly call this out for the MCP host's per-call approval gate.
  • Extract the comment pipeline into internal/app/comment.go so the CLI and MCP paths share input validation, AWS profile/region resolution, PR-metadata fetching (for the before/after commits), and the PostComment call. The existing ccpr comment --format json schema is preserved unchanged.
  • Introduce app.SystemError so the shared use case can mark AWS-side failures and the CLI's exitCode router keeps exiting 2 on those, preserving pre-migration CLI behavior. --body-file and stdin (-) input forms remain CLI-only.
  • Update docs/use-cases.md (UC-13), docs/requirements.md (FR-18), docs/spec.md, docs/json-schema.md, and the READMEs. The "no write-side MCP tools" constraint is removed; create/open/doctor remain out of scope.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change
  • Documentation (docs:)
  • Refactor / chore (refactor: / chore:)
  • Test (test:)

(Primary type: feat:. Refactor extracts the comment pipeline; docs and tests are part of the same change.)

Test plan

  • make build / make build-mcp / make test / make vet / make lint all pass
  • go test ./internal/app/... covers PostComment happy path, validation errors, region precedence, and SystemError wrapping for AWS failures
  • CLI golden tests under cmd/ccpr/testdata/ continue to pass (no JSON output regression)
  • Manual JSON-RPC smoke: initialize + tools/list returns all three tools (ccpr_list, ccpr_review, ccpr_comment) with outputSchema.type == "object"
  • End-to-end smoke via Claude Code MCP registration against a real CodeCommit PR

Spec-driven checklist

  • docs/use-cases.md, docs/requirements.md, docs/spec.md updated before code
  • No breaking changes to JSON output (see docs/versioning.md); the CLI ccpr comment --format json payload is unchanged. The MCP tool returns the same object directly (no wrapper needed because it is already an object).

Related issues

Closes #60.

Expose ccpr comment over MCP as ccpr_comment, the first write-side
tool served by ccpr-mcp. Extract the comment pipeline into
internal/app so the CLI and MCP paths share input parsing, AWS
resolution, PR-metadata fetching, and the PostComment call,
preserving the existing comment --format json schema.

Introduce app.SystemError so the use case can mark AWS-side
failures and the CLI's exitCode router keeps exiting 2 on those,
matching the pre-migration CLI behavior. Body-file and stdin (-)
input forms remain CLI-only.
@hidetzu hidetzu force-pushed the feat/mcp-comment branch from ffdb540 to 46055fb Compare May 4, 2026 06:36
@hidetzu hidetzu merged commit 5bb4298 into main May 4, 2026
3 checks passed
@hidetzu hidetzu deleted the feat/mcp-comment branch May 4, 2026 06:49
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.

[Feature] Add ccpr_comment MCP tool

1 participant