Skip to content

fix: use valid PostToolUse hooks and remove duplicate MCP config#35

Closed
n24q02m wants to merge 1 commit intotirth8205:mainfrom
n24q02m:fix/plugin-hooks-and-duplicate-mcp
Closed

fix: use valid PostToolUse hooks and remove duplicate MCP config#35
n24q02m wants to merge 1 commit intotirth8205:mainfrom
n24q02m:fix/plugin-hooks-and-duplicate-mcp

Conversation

@n24q02m
Copy link
Copy Markdown
Contributor

@n24q02m n24q02m commented Mar 20, 2026

Summary

Fixes two plugin issues that cause errors in Claude Code /doctor:

  • Invalid hook events: PostEdit and PostGit are not valid Claude Code hook event types. Replaced with PostToolUse — the standard event for post-tool callbacks.
  • Duplicate MCP server: .mcp.json at repo root duplicates the MCP server already declared in .claude-plugin/plugin.json mcpServers field. Removed .mcp.json since plugin.json is the canonical source for plugin installs. The CLI install command creates .mcp.json in the user's project root (not this repo), so non-plugin installs are unaffected.

Closes #25
Closes #23

Details

Hook event mapping

Before (invalid) After (valid) Matcher
PostEdit PostToolUse Write|Edit
PostGit PostToolUse Bash

Why .mcp.json removal is safe

When installed as a plugin (`/plugin install`), Claude Code reads MCP server config from `plugin.json` → `mcpServers` field. The standalone `.mcp.json` is only needed for non-plugin installs via `code-review-graph install`, which creates `.mcp.json` in the user's project directory, not from this repo's copy.

Having both causes Claude Code to log:
```
MCP server "code-review-graph" skipped — same command/URL as already-configured "code-review-graph"
```

Supersedes

This PR supersedes #26 by also fixing the duplicate MCP issue in addition to the hooks fix.

Test plan

  • Install plugin via `claude plugin marketplace add tirth8205/code-review-graph && claude plugin install code-review-graph@code-review-graph`
  • Run `/reload-plugins` — should show `6 hooks` (not 3)
  • Run `/doctor` — should show no errors
  • Edit a file — verify `code-review-graph update` runs via PostToolUse hook
  • Run `git commit` via Bash — verify graph update triggers

🤖 Generated with Claude Code

Two plugin issues that cause errors in Claude Code /doctor:

1. hooks/hooks.json used PostEdit and PostGit event types which are not
   valid Claude Code hook events. Replace with PostToolUse — the standard
   event for post-tool callbacks. PostEdit (matcher: Write|Edit) maps
   directly; PostGit (matcher: commit) maps to PostToolUse with Bash
   matcher since git commits go through the Bash tool.

2. .mcp.json at repo root duplicates the MCP server already declared in
   .claude-plugin/plugin.json mcpServers field. When installed as a
   plugin, Claude Code loads both and logs "MCP server skipped — same
   command/URL as already-configured". Remove .mcp.json since plugin.json
   is the canonical source. The CLI install command creates .mcp.json in
   the user's project root (not this repo), so non-plugin installs are
   unaffected.

Closes tirth8205#25
Closes tirth8205#23

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@n24q02m
Copy link
Copy Markdown
Contributor Author

n24q02m commented Mar 20, 2026

Note: The plugin marketplace version (marketplace.json and plugin.json) is still at 1.7.2 while pyproject.toml (PyPI) is at 1.8.2.

This doesn't affect runtime behavior since the MCP server binary is resolved via uvx (always pulls latest PyPI), but the version mismatch can be confusing. Consider bumping both files to match pyproject.toml:

  • .claude-plugin/marketplace.json"version": "1.8.2" (in both metadata and plugins[0])
  • .claude-plugin/plugin.json"version": "1.8.2"

Happy to add this to the PR if you'd like.

@tirth8205
Copy link
Copy Markdown
Owner

Thank you for the PR! The hooks fix was already merged via #26. The .mcp.json removal is valuable — I'll apply that directly to main. Closing this to avoid conflicts but full credit to you for catching the duplicate MCP config issue.

@tirth8205 tirth8205 closed this Mar 20, 2026
tirth8205 added a commit that referenced this pull request Mar 20, 2026
…#22)

Squash-merge of PR #22 by @clls1-stinger with fixups:
- Use RETRIEVAL_QUERY task type for search queries (not RETRIEVAL_DOCUMENT)
- Require explicit opt-in (no auto-detecting GOOGLE_API_KEY)
- Keep lazy model loading for LocalEmbeddingProvider
- Make embedding dimension dynamic per model
- Move google-generativeai to separate [google-embeddings] optional extra
- Fix tests to work with new provider-based architecture
- Restore _check_available() for backward compatibility
- Remove duplicate .mcp.json (credit: @n24q02m from #35)

Co-Authored-By: clls1-stinger <clls1-stinger@users.noreply.github.com>
Co-Authored-By: n24q02m <n24q02m@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zoneghost7 pushed a commit to WalkingWithGiants/code-review-graph that referenced this pull request Apr 9, 2026
…tirth8205#22)

Squash-merge of PR tirth8205#22 by @clls1-stinger with fixups:
- Use RETRIEVAL_QUERY task type for search queries (not RETRIEVAL_DOCUMENT)
- Require explicit opt-in (no auto-detecting GOOGLE_API_KEY)
- Keep lazy model loading for LocalEmbeddingProvider
- Make embedding dimension dynamic per model
- Move google-generativeai to separate [google-embeddings] optional extra
- Fix tests to work with new provider-based architecture
- Restore _check_available() for backward compatibility
- Remove duplicate .mcp.json (credit: @n24q02m from tirth8205#35)

Co-Authored-By: clls1-stinger <clls1-stinger@users.noreply.github.com>
Co-Authored-By: n24q02m <n24q02m@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tirth8205
Copy link
Copy Markdown
Owner

This PR is superseded by current state: the invalid PostEdit/PostGit events were fixed, and PostToolUse is now used. However, the hooks schema is STILL broken (missing nested hooks array). PR #203 addresses the remaining schema issue. This PR is partially integrated but the deeper hooks schema fix still needs PR #203.

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.

hooks.json uses invalid event types PostEdit and PostGit Invalid Hook Names Causing Plugin Load Failure + Fix

2 participants