Skip to content

fix(init): --hook installs hooks, and an absent MCP server is not a fault - #772

Merged
fajarhide merged 2 commits into
mainfrom
feat/757-hooks-without-mcp
Sep 4, 2026
Merged

fix(init): --hook installs hooks, and an absent MCP server is not a fault#772
fajarhide merged 2 commits into
mainfrom
feat/757-hooks-without-mcp

Conversation

@fajarhide

@fajarhide fajarhide commented Sep 4, 2026

Copy link
Copy Markdown
Owner

omni init --hook has read "Only install hooks" since it shipped and registered the MCP
server as well. The parser accepted the flag and the code ignored it, which is #151 wearing
a different name. Then omni doctor called the state that flag produces a broken install
and pushed MCP Server is not configured. Run omni init, and omni doctor --fix
reinstalled it. Three ways of overruling a choice the CLI offered in the first place.

--hook and --mcp now install the half they name. Naming the host, naming both halves,
or naming neither still installs both, which is the table:

flags hooks mcp
--hook yes no
--mcp no yes
--hook --mcp yes yes
--claude, --all, or neither yes yes

An absent MCP registration on Claude Code is now reported as what it is rather than as a
fault, and --fix does not repair what nobody broke. That is not leniency: on this host the
hooks are what shortens output, while the MCP server is a convenience whose two tool
definitions sit in the prefix of every request, and the host discards the whole prompt
cache when an MCP server connects or disconnects with its tools loaded (#740). Wanting one
without the other is an ordinary preference.

docs/website in both trees stops telling readers to delete a line from ~/.claude.json
and warning them it will not stick, since there is a flag now.

The first test I wrote was toothless and is not in this PR. It asserted that the hooks
half leaves mcpServers out of settings.json, which was already true on main because
the MCP registration lives in a different file. The decision is a function now,
claude_halves, and the test is the table above. Break-tested: forcing it to answer
(true, true) fails at claude_halves(false, false, true, false) has to be (true, false).

Verification: make ci green, smoke_test.sh 70/70, check_translations.sh green.

Closes #757

Greptile Summary

This PR separates Claude hook and MCP installation so --hook and --mcp can install only their named half, and makes an absent Claude MCP registration informational rather than unhealthy.

  • Adds table-driven selection for full, hooks-only, and MCP-only Claude setup.
  • Extracts the Claude hook installer from the full integration installer.
  • Stops doctor from warning about or directly repairing an absent optional MCP server.
  • Updates English and Indonesian agent documentation and the changelog.

Confidence Score: 4/5

The PR should not merge until Claude hook repair preserves a hooks-only installation instead of restoring the optional MCP server.

The primary init path correctly separates the two installation halves, but every Claude hook-repair path still calls the full installer and therefore reverses the new hooks-only choice.

Files Needing Attention: src/agents/claude.rs

Important Files Changed

Filename Overview
src/cli/init.rs Adds Claude half-selection and routes single-half requests to dedicated installers.
src/agents/claude.rs Splits hook installation and makes MCP absence optional, but hook repair still invokes the full installer and restores MCP.
docs/website/src/reference/agents.md Documents hooks-only and MCP-only Claude setup in English.
docs/website/src-id/reference/agents.md Mirrors the updated Claude setup guidance in Indonesian.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[omni init flags] --> B{Claude halves}
  B -->|hook only| C[Install Claude hooks]
  B -->|MCP only| D[Register MCP server]
  B -->|both| E[Full Claude installer]
  F[omni doctor --fix] --> G{Hooks need repair?}
  G -->|yes| E
  E --> C
  E --> D
Loading

Comments Outside Diff (1)

  1. src/agents/claude.rs, line 177 (link)

    P1 Hook repair restores MCP

    When a hooks-only installation has missing hooks and the user runs omni doctor --fix, this branch calls the full install() method, which also registers the MCP server, causing .claude.json to regain the entry that --hook was intended to omit. The other hook-repair branches have the same behavior.

    Knowledge Base Used:

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: src/agents/claude.rs
    Line: 177
    
    Comment:
    **Hook repair restores MCP**
    
    When a hooks-only installation has missing hooks and the user runs `omni doctor --fix`, this branch calls the full `install()` method, which also registers the MCP server, causing `.claude.json` to regain the entry that `--hook` was intended to omit. The other hook-repair branches have the same behavior.
    
    **Knowledge Base Used:**
    - [CLI command workflows](https://app.greptile.com/weekndlabs/-/custom-context/knowledge-base/fajarhide/omni/-/docs/cli-command-workflows.md)
    - [Agent integration layer](https://app.greptile.com/weekndlabs/-/custom-context/knowledge-base/fajarhide/omni/-/docs/agent-integration-layer.md)
    
    ---
    
    For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

    Fix in Claude Code Fix in Codex Fix in Cursor Fix in Conductor

Fix all with Greploop Fix All in Claude Code Fix All in Codex Fix All in Cursor Fix All in Conductor

Prompt To Fix All With AI
### Issue 1
src/agents/claude.rs:177
**Hook repair restores MCP**

When a hooks-only installation has missing hooks and the user runs `omni doctor --fix`, this branch calls the full `install()` method, which also registers the MCP server, causing `.claude.json` to regain the entry that `--hook` was intended to omit. The other hook-repair branches have the same behavior.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "docs(manual): the hooks-only route is a ..." | Re-trigger Greptile

Context used (3)

…ault

The flag has said 'Only install hooks' since it shipped and installed the MCP
server too, which is #151 wearing a different name: the parser accepts a flag
the code ignores. Then doctor called the state that flag produced a broken
install, and doctor --fix undid it. Three ways of overruling a choice the CLI
offered.

On Claude Code the hooks are what shortens output. The MCP server is a
convenience whose two tool definitions sit in the prefix of every request, and
the host discards the whole prompt cache when an MCP server connects or
disconnects with its tools loaded, so wanting one without the other is an
ordinary preference.

The decision is a function rather than a condition inline at the dispatch,
because the table is what was wrong and a table can be tested.

Closes #757
#740 had to tell readers to delete a line from ~/.claude.json and warn them it
would not stick. omni init --hook does it, doctor reports the result instead of
failing on it, and nothing puts it back.
@fajarhide
fajarhide merged commit 7989d06 into main Sep 4, 2026
14 checks passed
@fajarhide
fajarhide deleted the feat/757-hooks-without-mcp branch September 4, 2026 08:07
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.

No way to run the Claude Code hooks without the MCP registration, and doctor calls that state broken

1 participant