Skip to content

Commit f7ec7c3

Browse files
Raffi Krikoriancursoragent
authored andcommitted
v0.48.2: morph setup writes absolute morph-mcp path
`morph setup cursor` (and the `claude-code` / `opencode` siblings, and the `aoe` delegator) used to write `command: "morph-mcp"` (a bare name) into the IDE integration JSON. Cursor on macOS is a GUI-launched app and does NOT inherit the user's shell PATH, so the bare command failed to spawn for Homebrew users on `/opt/homebrew/bin` — the agent saw the `morph-record.mdc` rule but had no `morph_record_session` tool to call. New `resolve_mcp_command()` helper in `morph-cli/src/setup.rs` resolves `morph-mcp` to an absolute path at setup time. Resolution order, first match wins: 1. `MORPH_MCP_PATH` env var (escape hatch) 2. `morph-mcp` sibling of the running `morph` binary via `current_exe()` — common case for Homebrew, `cargo install`, AUR 3. Manual `PATH` walk 4. Bare-name fallback, with a stderr warning so the user knows they may need to fix it manually `SetupReport` / `OpenCodeSetupReport` / `ClaudeCodeSetupReport` carry the resolved `mcp_command` string, and the CLI summary prints it as `morph-mcp: <resolved path>` so a fresh setup immediately shows what got written. Tests: - New spec `morph-cli/tests/specs/setup_cursor.yaml` (6 cases) pins the contract end-to-end: file emission, absolute-path command, CLI summary output, idempotency, existing-config preservation, missing `.morph/` error. - 2 new unit tests for `resolve_mcp_command()` covering env override and bogus-override fallback. - Existing setup_claude_code spec relaxes `'"morph-mcp"'` assertion to `'morph-mcp"'` so it accepts both bare name and absolute path. Metrics: 1220 / 1220 workspace tests passing (41 + 8 + 432 + 10 + 2 + 659 + 31 + 37). Cucumber 34 / 37 (3 skipped, 0 failed) — no change. `cargo build` clean. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 94ea328 commit f7ec7c3

9 files changed

Lines changed: 469 additions & 119 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,62 @@ metrics — see `.cursor/rules/behavioral-commits.mdc`.
1616

1717
## [Unreleased]
1818

19+
## [0.48.2] — 2026-05-06
20+
21+
User-visible bug fix: `morph setup cursor` (and the
22+
`claude-code` / `opencode` siblings, and the `aoe` delegator
23+
that calls them) now resolve `morph-mcp` to an **absolute path**
24+
before writing the IDE integration JSON. Cursor on macOS is a
25+
GUI-launched app that does not inherit the user's shell PATH,
26+
so the previous `command: "morph-mcp"` entry silently failed to
27+
spawn for Homebrew users on `/opt/homebrew/bin` — the agent saw
28+
the `morph-record.mdc` rule but had no `morph_record_session`
29+
tool to call. This release closes that gap.
30+
31+
### Fixed
32+
33+
- **`morph-cli/src/setup.rs`**: new `resolve_mcp_command()`
34+
helper writes an absolute path to `morph-mcp` into
35+
`.cursor/mcp.json`, `.claude/settings.json`, and
36+
`opencode.json`. Resolution order: `MORPH_MCP_PATH` env var
37+
(escape hatch for non-standard installs) → `morph-mcp`
38+
sibling of the running `morph` binary via
39+
`current_exe()` (the common case for Homebrew, `cargo
40+
install`, AUR, etc.) → manual `PATH` walk → bare-name
41+
fallback. The bare-name fallback emits a stderr warning so
42+
the user can fix it manually.
43+
- **`SetupReport` / `OpenCodeSetupReport` /
44+
`ClaudeCodeSetupReport`** now carry the resolved
45+
`mcp_command` string, and the `morph setup …` CLI summary
46+
prints it as `morph-mcp: <resolved path>` so a fresh setup
47+
immediately shows what got written into the IDE config.
48+
49+
### Tests
50+
51+
- **New spec:** `morph-cli/tests/specs/setup_cursor.yaml`
52+
covers `setup cursor`'s contract end-to-end: `.cursor/mcp.json`
53+
+ `.cursor/hooks.json` + the four hook scripts get written,
54+
the resolved command is an absolute path ending in
55+
`/morph-mcp`, the CLI prints the path, the operation is
56+
idempotent, existing user MCP servers are preserved, and a
57+
missing `.morph/` errors out cleanly. 6 cases, all passing.
58+
- **New unit tests:** `resolve_mcp_command_honours_env_override`
59+
and `resolve_mcp_command_ignores_env_when_path_does_not_exist`
60+
pin the env-var contract and the resolver's fallback
61+
behaviour against bogus overrides.
62+
- Existing `mcp_json_created`, `claude_code_settings_json_created`,
63+
and `opencode_json_created` tests now accept either the bare
64+
`morph-mcp` name or any absolute path ending in `morph-mcp`,
65+
matching the new resolver semantics. The setup_claude_code
66+
spec relaxes its `'"morph-mcp"'` assertion to `'morph-mcp"'`
67+
for the same reason.
68+
69+
### Total
70+
71+
493 morph-cli tests passing (41 doc + 8 setup + 432 spec +
72+
10 status + 2 status-merge). No other crate's behaviour
73+
changed.
74+
1975
## [0.48.1] — 2026-05-02
2076

2177
Senior-engineer cleanup pass — small reliability + readability
@@ -1592,7 +1648,8 @@ Three coordinated changes to repo setup, adoption, and migration.
15921648
- 15 new YAML acceptance spec cases in the default eval suite:
15931649
`init_at_latest:*` ×4, `init_in_git_dir:*` ×6, `upgrade:*` ×5.
15941650

1595-
[Unreleased]: https://github.com/r/morph/compare/v0.48.1...HEAD
1651+
[Unreleased]: https://github.com/r/morph/compare/v0.48.2...HEAD
1652+
[0.48.2]: https://github.com/r/morph/compare/v0.48.1...v0.48.2
15961653
[0.48.1]: https://github.com/r/morph/compare/v0.48.0...v0.48.1
15971654
[0.48.0]: https://github.com/r/morph/compare/v0.47.0...v0.48.0
15981655
[0.47.0]: https://github.com/r/morph/compare/v0.46.0...v0.47.0

‎Cargo.lock‎

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ resolver = "2"
33
members = ["morph-core", "morph-cli", "morph-mcp", "morph-serve", "morph-e2e"]
44

55
[workspace.package]
6-
version = "0.48.1"
6+
version = "0.48.2"

‎morph-cli/src/main.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,14 @@ fn main() -> anyhow::Result<()> {
22752275
"unchanged"
22762276
}
22772277
);
2278+
println!(" morph-mcp: {}", report.mcp_command);
2279+
if !report.mcp_command.contains('/')
2280+
&& !report.mcp_command.contains('\\')
2281+
{
2282+
eprintln!(
2283+
"warning: could not locate `morph-mcp` on disk; wrote bare command name into mcp.json. Cursor on macOS doesn't inherit shell PATH, so the MCP server may fail to start. Set MORPH_MCP_PATH or edit .cursor/mcp.json with the absolute path."
2284+
);
2285+
}
22782286
}
22792287
SetupCmd::Opencode { path } => {
22802288
let root = std::path::Path::new(&path)
@@ -2310,6 +2318,7 @@ fn main() -> anyhow::Result<()> {
23102318
"unchanged"
23112319
}
23122320
);
2321+
println!(" morph-mcp: {}", report.mcp_command);
23132322
}
23142323
SetupCmd::ClaudeCode { path } => {
23152324
let root = std::path::Path::new(&path)
@@ -2330,6 +2339,7 @@ fn main() -> anyhow::Result<()> {
23302339
"unchanged"
23312340
}
23322341
);
2342+
println!(" morph-mcp: {}", report.mcp_command);
23332343
}
23342344
SetupCmd::Aoe {
23352345
path,

0 commit comments

Comments
 (0)