Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- No changes yet.

## [0.9.3] - 2026-11-02

### Added

- Claude Code MCP user scope (`claudeScope: "user"`, with `"global"` as an alias), defaulting new home-directory installs to user scope while normal repositories keep project scope. User entries carry a per-project prefix; scope changes, disabling Claude and reset clean up recorded CLI registrations without removing another project's servers.

- `agents doctor` warns when `.agents` lives in the home directory but Claude Code is on `project` or `local` scope, where its servers are visible only to a Claude session started in `~`. Existing installs keep their explicit scope, so this is how they learn about `user`.

### Fixed

- Claude local and user sync read current registrations from Claude's `.claude.json` instead of `claude mcp list`, which health-checks every configured server. With a dozen servers that took about 4 seconds, and one unreachable server pushed it past the 5-second limit, so every sync failed with "Failed checking Claude MCP status". `sync --check` in that setup now takes under 200 ms. Writes still go through `claude mcp add/remove`, and the CLI is used for reading when the file is missing, unreadable or shaped differently, and on Windows.
- `agents reset` finishes when the Claude CLI is missing or a removal fails, instead of exiting before any cleanup. It exits with status 1, names the Claude registrations still left with the command to remove them, and safe reset keeps their ownership so a later reset can retry.
- Claude user-scope status prefers the project's scoped registration when legacy server names are also visible.

### Changed

- `agents status` runs the Codex, Claude, Gemini and Cursor CLI probes concurrently, so it waits for the slowest one instead of their sum.
- The `agents` launcher loads the CLI in its own process instead of starting a second Node process, saving about 50 ms per command.
- Tests use a temporary Claude config directory. Suites that reached the real Claude CLI used to register servers for temporary projects in the developer's `~/.claude.json`.
- Vitest updated to 4.1.12, closing GHSA-qxg6-89mg-rqv8 and GHSA-xp26-3454-mjgp in `@vitest/mocker` reported by Dependabot.

## [0.9.2] - 2026-10-12

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Eighteen tools. "Verified" means the tool's own CLI was run against the file thi
| Integration | `--llm` id | MCP config it writes | Skills | Verified |
|:--|:--|:--|:--:|:--:|
| Codex | `codex` | `.codex/config.toml` (managed block, project trust handled) | native | ✅ |
| Claude Code | `claude` | `.mcp.json` project scope, plus root `CLAUDE.md` wrapper | bridge | ✅ |
| Claude Code | `claude` | `.mcp.json` project scope or CLI local/user scope, plus root `CLAUDE.md` wrapper | bridge | ✅ |
| Claude Desktop | `claude_desktop` | global `claude_desktop_config.json`, stdio servers only | — | ✅ |
| Gemini CLI | `gemini` | `.gemini/settings.json` | bridge | ✅ |
| Cursor | `cursor` | `.cursor/mcp.json` + CLI enable | bridge | ✅ |
Expand Down Expand Up @@ -326,7 +326,7 @@ No. <code>AGENTS.md</code> stays the instruction file every tool reads. This CLI
<details>
<summary><b>Why does Claude Code use <code>.mcp.json</code> now?</b></summary>
<br/>
Project scope is the location Anthropic documents for teams: it lives in the repository, so everyone working on it gets the same servers, and in `commit-generated` mode it is reviewed like any other file. Before 0.9.0 the CLI registered servers in the machine-local <code>~/.claude.json</code>, which nobody else could see. Set <code>integrations.options.claudeScope</code> to <code>"local"</code> for the old behaviour; projects upgrading from schema 3 keep it automatically.
Project scope is the location Anthropic documents for teams: it lives in the repository, so everyone working on it gets the same servers, and in `commit-generated` mode it is reviewed like any other file. Before 0.9.0 the CLI registered servers in the machine-local <code>~/.claude.json</code>, which nobody else could see. Set <code>integrations.options.claudeScope</code> to <code>"local"</code> for the old behaviour; projects upgrading from schema 3 keep it automatically. For servers available in every project, set it to <code>"user"</code> (<code>"global"</code> is an alias) and run <code>agents sync -g</code>. New home-directory installs (<code>agents init -g</code> or <code>agents start -g</code>) default to user scope; normal repositories default to project scope. Existing explicit choices are preserved. See [Claude MCP scopes](docs/agents-system.md#claude-mcp-scopes) for migration and cleanup.
</details>

<details>
Expand Down
9 changes: 3 additions & 6 deletions bin/agents
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { spawnSync } from 'node:child_process'
import { existsSync } from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { fileURLToPath, pathToFileURL } from 'node:url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
Expand All @@ -17,8 +17,5 @@ if (!existsSync(distCli)) {
if (build.status !== 0) process.exit(build.status ?? 1)
}

const run = spawnSync(process.execPath, [distCli, ...process.argv.slice(2)], {
cwd: process.cwd(),
stdio: 'inherit'
})
process.exit(run.status ?? 1)
// Load the CLI in this process instead of spawning a second Node for every command.
await import(pathToFileURL(distCli).href)
56 changes: 54 additions & 2 deletions docs/agents-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ project/
| Tool | Generated Config |
|:-----|:-----------------|
| **Codex** | `.codex/config.toml`, managed block only |
| **Claude Code** | `.mcp.json` (project scope) + root `CLAUDE.md` wrapper; `claude mcp add -s local` when `claudeScope` is `local` |
| **Claude Code** | `.mcp.json` (project scope) + root `CLAUDE.md` wrapper; `claude mcp add -s local` or `-s user` when `claudeScope` is `local` or `user` |
| **Claude Desktop** | Global `claude_desktop_config.json`, local stdio MCP only, preserving other entries |
| **Gemini** | `.gemini/settings.json` |
| **Cursor** | `.cursor/mcp.json` + CLI enable |
Expand Down Expand Up @@ -99,6 +99,58 @@ exactly those and leaves everything else, including entries added by hand.
Claude Code (project scope) and Copilot CLI both do, so it is written once for both,
and `agents sync` reports that per-tool `targets` cannot isolate servers inside it.

## Claude MCP Scopes

`integrations.options.claudeScope` accepts:

| Value | Storage | Availability |
| --- | --- | --- |
| `project` | Repository `.mcp.json` | Everyone using that repository |
| `local` | Project entry in `~/.claude.json`, through the Claude CLI | You, in that project |
| `user` | User entry in `~/.claude.json`, through the Claude CLI | You, in every project |

`global` is accepted as an alias for `user`. New home-directory installs, including
`agents init -g` and `agents start -g`, default to `user`; normal repositories default
to `project`. Existing explicit values are preserved, including `local` from a schema 3
migration. `-g` selects `~/.agents`; it does not override an explicit scope.

`agents doctor` warns about a home install on `local` or `project` scope. To move it to
`user`, set this in `~/.agents/agents.json`:

```json
{
"integrations": {
"enabled": ["claude"],
"options": { "claudeScope": "user" }
}
}
```

Then run:

```bash
agents sync -g
# Later syncs should report no changes:
agents sync -g --check
```

Claude CLI must be installed for local/user registrations. User entries use
`agents__<hash of the source project path>__<server>` so separate configs do not overwrite
each other. Sync removes recorded registrations in the previous scope before adding
entries in the new CLI scope. When moving from project scope, it removes managed
`.mcp.json` entries unless Copilot CLI still needs them. Failed CLI removals retain
ownership for retry; `--check` reports drift without adding or removing registrations.
Disabling Claude or running `agents reset -g` also removes its recorded CLI registrations.
If the Claude CLI is missing or a removal fails, reset still cleans everything else,
exits with status 1 and lists the registrations left behind.

Sync reads the current registrations from `.claude.json` (in `CLAUDE_CONFIG_DIR` when it
is set), because `claude mcp list` health-checks every server and can take seconds. It
falls back to `claude mcp list` when the file is missing or has an unexpected shape.

Claude gives local scope precedence over project and user scope. See
[Anthropic's MCP scope documentation](https://code.claude.com/docs/en/mcp#mcp-installation-scopes).

## Claude Instructions

- `AGENTS.md` is the only canonical instruction source in the project.
Expand Down Expand Up @@ -241,7 +293,7 @@ syncing every server is the opposite of what was asked for.

## Entries in Global Configs

Claude Desktop, the global Windsurf config and the Goose config live in the home
Claude Code user scope, Claude Desktop, the global Windsurf config and the Goose config live in the home
directory and are shared by every project on the machine. Entries this CLI writes into
them are named `agents__<hash of the project path>__<server>`, so two projects that both
define a server called `fetch` keep their own entry and `agents reset` in one of them
Expand Down
106 changes: 53 additions & 53 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@agents-dev/cli",
"version": "0.9.2",
"version": "0.9.3",
"description": "One config to rule them all \u2014 sync MCP servers, skills and AGENTS.md across 18 AI coding tools, and package them as Agent Plugins.",
"main": "dist/cli.js",
"scripts": {
Expand Down Expand Up @@ -90,6 +90,6 @@
"tsx": "^4.23.13",
"typescript": "^5.9.3",
"vite": "^6.4.3",
"vitest": "^4.1.10"
"vitest": "^4.1.12"
}
}
9 changes: 9 additions & 0 deletions src/commands/doctor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,15 @@ export async function runDoctor(options: DoctorOptions): Promise<void> {
})
}

const claudeScope = config.integrations.options.claudeScope
if (paths.isHome && enabled.has('claude') && claudeScope !== 'user') {
issues.push({
level: 'warning',
message: `Claude Code uses ${claudeScope} scope in the home directory, so its MCP servers are visible only when Claude starts in ~. `
+ 'Set integrations.options.claudeScope to "user" and run agents sync to make them available in every project.'
})
}

if (enabled.has('antigravity') && (await pathExists(paths.antigravityProjectMcp))) {
issues.push({
level: 'warning',
Expand Down
Loading
Loading