Skip to content

The platform for continuously improving AI agents.

init writes URL-only MCP config; sync leaves MCP and .git alone (#244)

Freyam Mehta55bf602b2a15
diff --git a/frontend/public/setup.md b/frontend/public/setup.md
index 8d26c1ca..75887c04 100644
--- a/frontend/public/setup.md
+++ b/frontend/public/setup.md
@@ -4,48 +4,14 @@ These are instructions for you, an AI coding agent, to set the human up on
Overmind. Read them once, then act on them. The human who handed you this
document wants you to do the setup and execute workflows, not to explain it back to them.
-There are 2 prerequisites to start this:
+Run from the repository root. Every step is safe to repeat.
-1. **MCP config for Overmind**
-
-```json
-{
- ...
- "overmind": {
- "url": "https://api.overmindlab.ai/api/mcp/"
- }
-}
-```
-
-**DO NOT forget the slash in the end for the url**
-
-2. **PyPI package overmind**
-
-- Ensure python version is alteast 3.10, if the version is lower, report the conflict to the user and stop.
-
-Use any of the following to install overmind, depending on what is available on the host machine:
-
-- pip: `pip install --upgrade "overmind>=0.1.104"`
-- uv: `uv pip install "overmind>=0.1.104"`
-- Poetry or anything else: `<PYTHON> -m pip install "overmind>=0.1.104"`
-
-2.1 The overmind SDK comes with a set of loaded skills, run the command below using the coding agent you are being called within.
-
-```bash
-overmind init --ide=<cursor | claude | codex | opencode>
-```
-
-Ensure that the project's `python version is >= 3.10`, and `overmind --version is >= 0.1.104`
-
-If the project's Python is older than 3.10 or the install conflicts with the environment,
-report the exact conflict and stop; do not change the project's supported Python range.
-
-The command above should add a `overmind.toml` file, which will also act as a source of truth for users' resources in Overmind.
-
-Ask the user to reload their coding agent if needed to enable MCP,
-otherwise they will not be able to invoke the MCP.
-
-Now we can move onto getting started with overmind.
+1. Install the CLI (Python 3.10+): `python -m pip install --upgrade "overmind>=0.1.105"`.
+ On a conflict, report it and stop.
+1. Run `python -m overmind init --ide <claude|codex|cursor|opencode>` for the agent you run in.
+ Add `--api-url URL` if the message names an API. It edits this agent's config; if your
+ sandbox blocks that, ask the user to approve running it outside the sandbox.
+1. Call `list_projects`. If it fails, show the user the `Next:` line `init` printed and wait.
# USING OVERMIND
@@ -53,7 +19,7 @@ Overmind can be used in 2 ways, onboarding from a codebase or onboarding using a
ASK the USER which one they want to continue with, if it hasn't already been configured.
> Connect the project once: call the MCP tool `create_api_key` without `project_id`, then run
-> `OVERMIND_API_KEY=<key> python -m overmind sync`. Sync creates the project and saves its key;
+> `OVERMIND_API_KEY=<key> python -m overmind sync --api-url <base-url>`. Sync creates the project and saves its key;
> later syncs need no key. Never print or store the account key. Skip this if `overmind.toml`
> has a `project-id` and `.overmind/credentials.toml` exists.
diff --git a/frontend/src/lib/mcp-setup.test.ts b/frontend/src/lib/mcp-setup.test.ts
index 98e62ead..6fe2ea3f 100644
--- a/frontend/src/lib/mcp-setup.test.ts
+++ b/frontend/src/lib/mcp-setup.test.ts
@@ -44,9 +44,9 @@ describe("mcp setup snippets", () => {
it("installs from PyPI on every host", () => {
for (const host of [STAGING, PROD, LOCAL]) {
- expect(sdkPipInstall(host)).toBe('python -m pip install "overmind>=0.1.104"');
+ expect(sdkPipInstall(host)).toBe('python -m pip install "overmind>=0.1.105"');
expect(sdkPipInstall(host, "tracing")).toBe(
- 'python -m pip install "overmind[tracing]>=0.1.104"'
+ 'python -m pip install "overmind[tracing]>=0.1.105"'
);
}
});
@@ -88,7 +88,7 @@ describe("mcp setup snippets", () => {
const { sdkPipInstall: pip } = await import("./mcp-setup");
expect(pip(LOCAL)).toBe(`python -m pip install -e "${EDITABLE}"`);
expect(pip(LOCAL, "tracing")).toBe(`python -m pip install -e "${EDITABLE}[tracing]"`);
- expect(pip(PROD)).toBe('python -m pip install "overmind>=0.1.104"');
+ expect(pip(PROD)).toBe('python -m pip install "overmind>=0.1.105"');
vi.unstubAllEnvs();
vi.resetModules();
});
diff --git a/frontend/src/lib/mcp-setup.ts b/frontend/src/lib/mcp-setup.ts
index 1dcbce51..f3fc111d 100644
--- a/frontend/src/lib/mcp-setup.ts
+++ b/frontend/src/lib/mcp-setup.ts
@@ -10,7 +10,7 @@ export const MCP_CLIENTS: { id: McpClient; label: string; destination: string }[
];
export const API_KEY_PLACEHOLDER = "<your-api-key>";
-export const MIN_ONBOARDING_SDK_VERSION = "0.1.104";
+export const MIN_ONBOARDING_SDK_VERSION = "0.1.105";
export const SDK_PREFLIGHT_COMMAND = "python -m overmind --version";
const HOSTED_API_URL = "https://api.overmindlab.ai";
@@ -97,7 +97,7 @@ export function onboardingPrompt(
export function telemetrySetupPrompt(client: McpClient): string {
const meta = mcpClientMeta(client);
return [
- `Instrument this repository using the Overmind MCP and skill setup in ${meta.label}. Do not rerun \`overmind init\` for an already configured client. If ${meta.label} has no Overmind MCP entry and onboarding sync has completed, run \`overmind init --ide ${client}\` once; it reuses the saved project credential. If MCP authentication is pending, stop and ask the user to complete onboarding with \`overmind sync\`, then reload ${meta.label} once; never configure MCP with the temporary account bootstrap key.`,
+ `Instrument this repository using the Overmind MCP and skill setup in ${meta.label}. Do not rerun \`overmind init\` for an already configured client. If ${meta.label} has no Overmind MCP entry and onboarding sync has completed, run \`overmind init --ide ${client}\` once. If MCP authentication is pending, stop and ask the user to complete the sign-in step \`overmind init\` printed.`,
"Install `overmind[tracing]` if tracing is not already importable, with the installer the project already uses.",
"For local runs, the tracing SDK reuses the credential saved by `overmind sync`; deployed processes still require `OVERMIND_API_KEY` in their runtime secret configuration.",
"Follow the “Instrumentation” section of the installed overmind-observability skill. Call `get_instrumentation_plan` with no capability for project-wide work or the supplied capability for scoped work. If it returns `human_action` or no placements, report the instruction and stop this attempt.",
diff --git a/overmind/README.md b/overmind/README.md
index 935023ce..c1e7f3de 100644
--- a/overmind/README.md
+++ b/overmind/README.md
@@ -48,9 +48,10 @@ overmind sync
```
The pasted account key is a bootstrap credential for the current shell only.
-`init` installs the skill and prepares the selected IDE; `sync` creates the
-project, stores its project-scoped key in `.overmind/credentials.toml`, and
-updates the local MCP config. Reload the IDE once after the first sync.
+`init` installs the skill, adds the Overmind MCP server and prints the client's
+sign-in step; `sync` creates the project and stores its project-scoped key in
+`.overmind/credentials.toml`. Complete the `Next:` step `init` prints before
+using MCP tools.
Then in your coding harness:
@@ -255,8 +256,8 @@ overmind skills sync overmind-observability overmind-datasets --ide codex
overmind init --ide codex
```
-`init` prepares each vendor's project-scoped MCP config, leaving any other
-configured servers untouched. `sync` installs the final project key:
+`init` adds a URL-only Overmind server, leaving any other configured servers
+untouched. The client signs in through OAuth; `sync` never edits MCP config:
| `--ide` | MCP config | Skill install |
| ------------------------ | ------------------------------ | ------------------ |
@@ -266,12 +267,10 @@ configured servers untouched. `sync` installs the final project key:
| `codex` | `.codex/config.toml` | `.agents/skills` |
Claude Code gets a local-scope server for this directory in `~/.claude.json`
-(or `$CLAUDE_CONFIG_DIR/.claude.json`), so the key never enters the repository
-and a committed `.mcp.json` is left untouched. Other MCP configs containing the
-project key and `.overmind/credentials.toml` are added to the clone-local Git
-exclude file and written with owner-only permissions. Sync refuses to put a key
-in a tracked config. Codex loads project configuration only for trusted
-repositories.
+(or `$CLAUDE_CONFIG_DIR/.claude.json`), and a committed `.mcp.json` is left
+untouched. Codex loads project configuration only for trusted repositories.
+`.overmind/` holds local state; its own `.gitignore` keeps it out of Git, and
+`credentials.toml` is owner-only.
`overmind init` installs the complete skill set. Plugins bundle the same source;
`overmind skills sync` refreshes selected skills in an existing installation.
diff --git a/overmind/overmind/__init__.py b/overmind/overmind/__init__.py
index b2d81ac7..3f5f4e93 100644
--- a/overmind/overmind/__init__.py
+++ b/overmind/overmind/__init__.py
@@ -10,7 +10,7 @@ from __future__ import annotations
from typing import TYPE_CHECKING, Any
-__version__ = "0.1.104"
+__version__ = "0.1.105"
from .client import Client, ModelDeleted, OvermindInferenceError
diff --git a/overmind/overmind/config.py b/overmind/overmind/config.py
index dddda8aa..67a19bcb 100644
--- a/overmind/overmind/config.py
+++ b/overmind/overmind/config.py
@@ -179,6 +179,11 @@ def _safe_local_target(path: Path, repo_root: Path) -> Path:
def protect_secret_file(path: Path, *, repo_root: Path) -> None:
path = _safe_local_target(path, repo_root)
+ # A directory-local ignore file needs no write under .git/, which agent sandboxes protect.
+ ignore = path.parent / ".gitignore"
+ if not ignore.exists():
+ path.parent.mkdir(parents=True, exist_ok=True)
+ ignore.write_text("*\n")
try:
root_result = subprocess.run(
["git", "-C", str(repo_root.resolve()), "rev-parse", "--show-toplevel"],
@@ -204,22 +209,6 @@ def protect_secret_file(path: Path, *, repo_root: Path) -> None:
if tracked.returncode == 0:
raise SecretFileError(f"Refusing to write an API key to tracked file {relative.as_posix()}")
- exclude_result = subprocess.run(
- ["git", "-C", str(git_root), "rev-parse", "--git-path", "info/exclude"],
- capture_output=True,
- check=False,
- text=True,
- )
- if exclude_result.returncode == 0:
- exclude_path = Path(exclude_result.stdout.strip())
- if not exclude_path.is_absolute():
- exclude_path = git_root / exclude_path
- entry = f"/{relative.as_posix()}"
- existing = exclude_path.read_text() if exclude_path.exists() else ""
- if entry not in existing.splitlines():
- exclude_path.parent.mkdir(parents=True, exist_ok=True)
- exclude_path.write_text(f"{existing.rstrip()}\n{entry}\n" if existing.strip() else f"{entry}\n")
-
if path.exists():
path.chmod(0o600)
diff --git a/overmind/overmind/init_cmd.py b/overmind/overmind/init_cmd.py
index f362d676..f842ad0a 100644
--- a/overmind/overmind/init_cmd.py
+++ b/overmind/overmind/init_cmd.py
@@ -15,12 +15,10 @@ from rich.console import Console
from overmind.config import (
DEFAULT_PATH,
Config,
- SecretFileError,
default_project_name,
dump,
ensure_project_name,
load,
- protect_secret_file,
saved_project_api_key,
)
from overmind.skills import get_destination_dir, sync_skills
@@ -38,6 +36,13 @@ MCP_CONFIG_PATHS: dict[Ide, Path] = {
"codex": Path(".codex/config.toml"),
}
+SIGN_IN: dict[Ide, str] = {
+ "claude": "Restart Claude Code, run /mcp, select overmind, then Authenticate.",
+ "codex": "Run `codex mcp login overmind`, then restart Codex.",
+ "cursor": "Open Cursor Settings > MCP and click Connect next to overmind.",
+ "opencode": "Run `opencode mcp auth overmind`, then restart OpenCode.",
+}
+
MCP_URLS = {
"production": "https://api.overmindlab.ai/api/mcp/",
"staging": "https://api-staging.overmindlab.ai/api/mcp/",
@@ -141,7 +146,8 @@ def _write_text(path: Path, content: str, *, contains_secret: bool) -> None:
fh.write(content)
fh.flush()
os.fsync(fh.fileno())
- os.chmod(temp_name, 0o600 if contains_secret else 0o644)
+ mode = 0o600 if contains_secret else (path.stat().st_mode & 0o777 if path.exists() else 0o644)
+ os.chmod(temp_name, mode)
os.replace(temp_name, path)
except BaseException:
Path(temp_name).unlink(missing_ok=True)
@@ -172,17 +178,10 @@ def claude_config_path() -> Path:
return (Path(config_dir).expanduser() if config_dir else Path.home()) / ".claude.json"
-def _claude_servers(config: dict, cwd: Path) -> dict | None:
- servers = config.get("projects", {}).get(cwd.resolve().as_posix(), {}).get("mcpServers")
- return servers if isinstance(servers, dict) else None
-
-
-def write_claude_mcp(cwd: Path, url: str, api_key: str | None) -> Path:
+def write_claude_mcp(cwd: Path, url: str) -> Path:
path = claude_config_path().resolve()
config = json.loads(path.read_text()) if path.exists() else {}
- server: dict = {"type": "http", "url": url}
- if api_key:
- server["headers"] = {"X-Api-Key": api_key}
+ server = {"type": "http", "url": url}
project = config.setdefault("projects", {}).setdefault(cwd.resolve().as_posix(), {})
project.setdefault("mcpServers", {})["overmind"] = server
_write_text(path, json.dumps(config, indent=2) + "\n", contains_secret=True)
@@ -223,81 +222,23 @@ def seed_toml(path: Path, *, base_url: str) -> Path | None:
return path
-def write_mcp_config(ide: Ide, cwd: Path, mcp_url: str, api_key: str | None) -> Path:
+def write_mcp_config(ide: Ide, cwd: Path, mcp_url: str) -> Path:
if ide == "claude":
- return write_claude_mcp(cwd, mcp_url, api_key)
+ return write_claude_mcp(cwd, mcp_url)
path = cwd / MCP_CONFIG_PATHS[ide]
- if api_key:
- protect_secret_file(path, repo_root=cwd)
if ide == "codex":
- write_codex_mcp(path, mcp_url, api_key)
+ write_codex_mcp(path, mcp_url)
return path
-
if ide == "opencode":
config = json.loads(path.read_text()) if path.exists() else {"$schema": "https://opencode.ai/config.json"}
- server = {
- "type": "remote",
- "url": mcp_url,
- "enabled": True,
- }
- if api_key:
- server["headers"] = {"X-Api-Key": api_key}
- config.setdefault("mcp", {})["overmind"] = server
+ config.setdefault("mcp", {})["overmind"] = {"type": "remote", "url": mcp_url, "enabled": True}
else:
config = json.loads(path.read_text()) if path.exists() else {}
- server = {"url": mcp_url}
- if api_key:
- server["headers"] = {"X-Api-Key": api_key}
- config.setdefault("mcpServers", {})["overmind"] = server
-
- _write_text(path, json.dumps(config, indent=2) + "\n", contains_secret=bool(api_key))
+ config.setdefault("mcpServers", {})["overmind"] = {"url": mcp_url}
+ _write_text(path, json.dumps(config, indent=2) + "\n", contains_secret=False)
return path
-def configured_ides(cwd: Path) -> list[Ide]:
- configured: list[Ide] = []
- for ide in SUPPORTED_IDES:
- if ide == "claude":
- path = claude_config_path()
- if path.exists() and "overmind" in (_claude_servers(json.loads(path.read_text()), cwd) or {}):
- configured.append(ide)
- continue
- path = cwd / MCP_CONFIG_PATHS[ide]
- if not path.exists():
- continue
- text = path.read_text()
- if ide == "codex":
- if re.search(r"(?m)^\[\[?mcp_servers\.overmind(?:\.|\])", text):
- configured.append(ide)
- continue
- if '"overmind"' not in text:
- continue
- config = json.loads(text)
- servers = config.get("mcp") if ide == "opencode" else config.get("mcpServers")
- if isinstance(servers, dict) and "overmind" in servers:
- configured.append(ide)
- return configured
-
-
-def preflight_mcp_configs(cwd: Path) -> list[Ide]:
- ides = configured_ides(cwd)
- for ide in ides:
- if ide == "claude":
- continue
- path = cwd / MCP_CONFIG_PATHS[ide]
- protect_secret_file(path, repo_root=cwd)
- if ide != "codex":
- json.loads(path.read_text())
- return ides
-
-
-def refresh_mcp_configs(cwd: Path, mcp_url: str, api_key: str) -> list[Ide]:
- ides = preflight_mcp_configs(cwd)
- for ide in ides:
- write_mcp_config(ide, cwd, mcp_url, api_key)
- return ides
-
-
def run_init(
ide: Ide,
*,
@@ -316,7 +257,7 @@ def run_init(
and config_path.exists()
):
configured_url = load(config_path).base_url
- mcp_url, base_url = resolve_mcp_url(env, configured_url) # noqa: F841
+ mcp_url, base_url = resolve_mcp_url(env, configured_url)
sync_skills([skill.slug for skill in skills], ide=ide)
dest = get_destination_dir(ide)
@@ -325,32 +266,20 @@ def run_init(
for path in write_slash_commands(ide, root):
console.print(f"Command → {path.relative_to(root)}")
+ created = seed_toml(config_path, base_url=base_url)
+ mcp_path = write_mcp_config(ide, root, mcp_url)
try:
- created = seed_toml(config_path, base_url=base_url)
- saved_key = saved_project_api_key(config_path)
- # mcp_path = write_mcp_config(ide, root, mcp_url, saved_key or None)
- except SecretFileError as exc:
- raise typer.BadParameter(str(exc), param_hint="MCP config") from exc
- # try:
- # mcp_display = str(mcp_path.relative_to(root))
- # except ValueError:
- # mcp_display = str(mcp_path)
- # console.print(f"MCP → {mcp_display}")
+ mcp_display = str(mcp_path.relative_to(root))
+ except ValueError:
+ mcp_display = str(mcp_path)
+ console.print(f"MCP → {mcp_display}")
if created:
console.print(f"Seeded {created.relative_to(root)}")
else:
console.print(f"{DEFAULT_PATH.name} already present — left unchanged")
- if saved_key:
- console.print(
- "\nMCP configured with the saved project credential. Run overmind connection check --project-id PROJECT --json in this coding environment to verify MCP and local transfer readiness."
- )
- else:
- console.print(
- "\nMCP authentication pending. Run [bold]overmind sync[/bold] to create the console project "
- "and install its credential, then reload this coding agent once."
- )
+ console.print(f"\nNext: {SIGN_IN[ide]}")
def init(
diff --git a/overmind/overmind/sync.py b/overmind/overmind/sync.py
index f66c74df..c4bf8d73 100644
--- a/overmind/overmind/sync.py
+++ b/overmind/overmind/sync.py
@@ -35,7 +35,6 @@ from overmind.config import (
load,
protect_secret_file,
)
-from overmind.init_cmd import preflight_mcp_configs, refresh_mcp_configs, resolve_mcp_url
SYNC_PATH = "/api/v1/sync"
PROJECTS_PATH = "/api/projects/"
@@ -164,7 +163,7 @@ def ensure_mcp_project_key(
config.api_key = new_key
dump(config, path)
if scope == "account":
- console.print("Minted project-scoped API key for MCP.")
+ console.print("Saved a project-scoped API key for this repository.")
return config, new_key
@@ -230,7 +229,6 @@ def run_up(path: Path, api_key: str, api_url: str) -> Config:
raise SyncError("Missing API key. Pass --api-key or set OVERMIND_API_KEY.")
try:
protect_secret_file(credentials_path(path), repo_root=path.resolve().parent)
- preflight_mcp_configs(path.resolve().parent)
except (SecretFileError, OSError, ValueError) as exc:
raise SyncError(str(exc)) from exc
key_scope = _api_key_scope(key, url)
@@ -253,16 +251,6 @@ def run_up(path: Path, api_key: str, api_url: str) -> Config:
config, key = ensure_mcp_project_key(config, path, key, url, key_scope=key_scope)
except (SecretFileError, OSError, ValueError) as exc:
raise SyncError(f"Local sync persistence failed; a project credential may have been saved: {exc}") from exc
- mcp_url, _ = resolve_mcp_url("production", url)
- try:
- updated = refresh_mcp_configs(path.resolve().parent, mcp_url, key)
- except (SecretFileError, OSError, ValueError) as exc:
- raise SyncError(f"Project credential saved, but MCP config update failed: {exc}") from exc
- if updated:
- console.print(f"Updated MCP authentication: {', '.join(updated)}.")
- console.print("Reload the coding agent once. No re-export or re-init is required.")
- else:
- console.print("No Overmind MCP config found. Run `overmind init --ide <client>` to add one.")
return config
diff --git a/overmind/pyproject.toml b/overmind/pyproject.toml
index bbfd8685..88c8a88b 100644
--- a/overmind/pyproject.toml
+++ b/overmind/pyproject.toml
@@ -32,7 +32,7 @@ name = "overmind"
readme = "README.md"
requires-python = ">=3.10,<4" # todo; remove the upper bound
urls = { Homepage = "https://github.com/overmind-core/overmind", Repository = "https://github.com/overmind-core/overmind" }
-version = "0.1.104"
+version = "0.1.105"
[project.scripts]
overmind = "overmind.__main__:app"
diff --git a/overmind/skills/overmind/SKILL.md b/overmind/skills/overmind/SKILL.md
index 14e038be..021fe6c6 100644
--- a/overmind/skills/overmind/SKILL.md
+++ b/overmind/skills/overmind/SKILL.md
@@ -107,7 +107,7 @@ coding environment with `overmind connection check --project-id PROJECT --json`;
configuration alone is not readiness. Follow the Datasets skill for durable
upload recovery and scoped host approvals.
-Use the connected catalog and `overmind://interface/current` as the authority for available operations and the current contract version. OAuth/account API keys discover projects with `list_projects` and pass `project_id` on every operation and resource; project API keys retain narrower scope. Never put credentials in chat. `create_api_key` returns a new secret once; omit `project_id` for an account key and pass it for a project key. Do not write the secret into the repository, a prompt, or another tool argument.
+Use the connected catalog and `overmind://interface/current` as the authority for available operations and the current contract version. OAuth/account API keys discover projects with `list_projects` and pass `project_id` on every operation and resource; project API keys retain narrower scope. Never put credentials in chat. `create_api_key` returns a new secret once; omit `project_id` for an account key and pass it for a project key. Do not write the secret into the repository, a prompt, or another tool argument, except the `OVERMIND_API_KEY=` prefix of the first onboarding `overmind sync`.
Data-first projects do not require repository scanning, capabilities or instrumentation. Use `develop-model-from-data` when starting with uploaded data. Repository discovery remains a local workflow only for code-backed projects. Installed skills assist discovery; they are not a correctness prerequisite.
diff --git a/overmind/skills/overmind/references/onboard.md b/overmind/skills/overmind/references/onboard.md
index ca9dc25c..1fd0957b 100644
--- a/overmind/skills/overmind/references/onboard.md
+++ b/overmind/skills/overmind/references/onboard.md
@@ -28,11 +28,11 @@ Isolation does not install application tracing. Verify the tracing SDK in the ap
## Connect project
-1. `python -m overmind init --ide <client>` writes `overmind.toml`, prepares the IDE's MCP config and installs this skill.
-1. `python -m overmind sync` creates the Console project from `project-name` in `overmind.toml` (seeded from the repo directory), writes `project-id` into the toml, stores the project credential in `.overmind/credentials.toml` and updates every configured IDE's MCP entry. Empty capabilities are fine.
-1. Report that the project is connected and a coding-agent reload is required. In Claude Code, ask the user to exit and run `claude -c`; elsewhere, reload the IDE. Stop until the user reloads. Do not print credentials or run init again.
+1. `python -m overmind init --ide <client>`. If your sandbox blocks it, ask the user to approve running it outside the sandbox.
+1. Show the user the `Next:` line it printed and wait for sign-in. Then call `list_projects`.
+1. Call `create_api_key` without `project_id`, then run `OVERMIND_API_KEY=<key> python -m overmind sync --api-url <saved-base-url>` once. Do not print the key or rerun init.
-After reload, read `overmind://project/current` to confirm the project and resume scanning without repeating sync. If authentication is still unavailable, keep this stage blocked and report it.
+Then read `overmind://project/current?project_id=ID` to confirm the project. If authentication is still unavailable, keep this stage blocked and report it.
**Do not run `/overmind setup` or read [setup.md](setup.md) until sync succeeds.** If `overmind.toml` exists, merge: do not overwrite `base-url`, `project-id` or capability ids without reading first. To recreate a project, delete it in the Console, clear `project-id` in the toml, keep `project-name` as the repo directory name, then repeat sync.
diff --git a/overmind/tests/test_config_toml.py b/overmind/tests/test_config_toml.py
index 0519686e..f0fe197c 100644
--- a/overmind/tests/test_config_toml.py
+++ b/overmind/tests/test_config_toml.py
@@ -168,23 +168,25 @@ def test_credentials_only_apply_to_their_project(tmp_path: Path):
assert load(path).api_key == ""
-def test_secret_file_is_locally_excluded_and_must_not_be_tracked(tmp_path: Path):
+def test_overmind_dir_is_ignored_without_touching_git_metadata(tmp_path: Path):
subprocess.run(["git", "init", "-q"], cwd=tmp_path, check=True)
+ exclude = tmp_path / ".git" / "info" / "exclude"
+ before = exclude.read_text() if exclude.exists() else None
secret = tmp_path / ".overmind" / "credentials.toml"
protect_secret_file(secret, repo_root=tmp_path)
+ (tmp_path / ".overmind" / "scan.json").write_text("{}\n")
- exclude = subprocess.run(
- ["git", "rev-parse", "--git-path", "info/exclude"],
+ assert (exclude.read_text() if exclude.exists() else None) == before
+ match = subprocess.run(
+ ["git", "check-ignore", "--no-index", "-v", ".overmind/scan.json"],
cwd=tmp_path,
capture_output=True,
check=True,
text=True,
)
- exclude_path = tmp_path / exclude.stdout.strip()
- assert "/.overmind/credentials.toml" in exclude_path.read_text().splitlines()
+ assert match.stdout.startswith(".overmind/.gitignore:")
- secret.parent.mkdir(parents=True, exist_ok=True)
secret.write_text('api-key = "tracked"\n')
subprocess.run(["git", "add", "-f", ".overmind/credentials.toml"], cwd=tmp_path, check=True)
with pytest.raises(SecretFileError, match="tracked file"):
@@ -209,3 +211,5 @@ def test_secret_file_still_works_without_git(tmp_path: Path):
with pytest.MonkeyPatch.context() as monkeypatch:
monkeypatch.setattr("overmind.config.subprocess.run", missing_git)
protect_secret_file(secret, repo_root=tmp_path)
+
+ assert (tmp_path / ".overmind" / ".gitignore").read_text() == "*\n"
diff --git a/overmind/tests/test_init.py b/overmind/tests/test_init.py
index c762ab7b..6c9247a3 100644
--- a/overmind/tests/test_init.py
+++ b/overmind/tests/test_init.py
@@ -1,4 +1,5 @@
import json
+import stat
import subprocess
from pathlib import Path
@@ -24,6 +25,11 @@ SURFACE_SKILLS = (
)
+def _claude_overmind(project: Path) -> dict:
+ config = json.loads(claude_config_path().read_text())
+ return config["projects"][project.resolve().as_posix()]["mcpServers"]["overmind"]
+
+
def _init(tmp_path: Path, ide: str, *extra: str) -> None:
result = runner.invoke(
app,
@@ -80,10 +86,11 @@ def test_init_delivers_current_onboarding_workflow(tmp_path, monkeypatch, ide, s
assert (installed / "agents/openai.yaml").read_bytes() == (source / "agents/openai.yaml").read_bytes()
-def test_init_installs_cursor_skills_without_writing_mcp(tmp_path, monkeypatch):
+def test_init_writes_cursor_mcp_json(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
_init(tmp_path, "cursor")
- assert not (tmp_path / ".cursor" / "mcp.json").exists()
+ cfg = json.loads((tmp_path / ".cursor" / "mcp.json").read_text())
+ assert cfg["mcpServers"]["overmind"] == {"url": "http://localhost:8000/api/mcp/"}
assert (tmp_path / ".agents" / "skills" / "overmind" / "SKILL.md").is_file()
assert (tmp_path / ".agents" / "skills" / "overmind" / "references" / "setup.md").is_file()
@@ -113,7 +120,7 @@ def test_codex_local_init_without_url_override(tmp_path, monkeypatch):
for name in ("OVERMIND_API_URL", "OVERMIND_BASE_URL", "OVERMIND_PROJECT_ID"):
monkeypatch.delenv(name, raising=False)
_init(tmp_path, "codex")
- assert not (tmp_path / ".codex" / "config.toml").exists()
+ assert 'url = "http://localhost:8000/api/mcp/"' in (tmp_path / ".codex" / "config.toml").read_text()
assert 'base-url = "http://localhost:8000"' in (tmp_path / "overmind.toml").read_text()
@@ -138,7 +145,8 @@ def test_init_seeds_toml_without_slash_commands(tmp_path, monkeypatch):
assert "[capabilities]" in toml
assert not list((tmp_path / ".cursor" / "commands").glob("*.md"))
- assert not (tmp_path / ".cursor" / "mcp.json").exists()
+ mcp = json.loads((tmp_path / ".cursor" / "mcp.json").read_text())
+ assert mcp["mcpServers"]["overmind"]["url"] == "http://localhost:8000/api/mcp/"
def test_init_preserves_existing_toml(tmp_path, monkeypatch):
@@ -165,16 +173,16 @@ def test_init_backfills_project_name_without_overwriting(tmp_path, monkeypatch):
assert 'project-name = "custom-name"' in toml
-def test_init_claude_installs_skills_without_writing_mcp(tmp_path, monkeypatch):
+def test_init_claude_writes_local_scope_mcp(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
monkeypatch.delenv("OVERMIND_API_KEY", raising=False)
- before = claude_config_path().read_text() if claude_config_path().exists() else None
for alias in ("claude", "claude_code", "claude-code"):
- _init(tmp_path, alias)
+ result = runner.invoke(app, ["init", "--ide", alias, "--env", "local"], catch_exceptions=False)
- after = claude_config_path().read_text() if claude_config_path().exists() else None
- assert after == before
+ assert result.exit_code == 0, result.output
+ assert "Next: Restart Claude Code, run /mcp, select overmind, then Authenticate." in result.output
+ assert _claude_overmind(tmp_path) == {"type": "http", "url": "http://localhost:8000/api/mcp/"}
assert not (tmp_path / ".mcp.json").exists()
assert not (tmp_path / ".claude" / "commands").exists()
assert (tmp_path / ".claude" / "skills" / "overmind" / "SKILL.md").is_file()
@@ -196,74 +204,82 @@ def test_init_claude_preserves_other_config_and_tracked_mcp_json(tmp_path, monke
config = json.loads(claude_config_path().read_text())
assert config["theme"] == "dark"
assert config["projects"]["/elsewhere"]["mcpServers"] == {"x": {"type": "http", "url": "u"}}
- assert tmp_path.resolve().as_posix() not in config["projects"]
+ assert _claude_overmind(tmp_path)["url"] == "http://localhost:8000/api/mcp/"
assert (tmp_path / ".mcp.json").read_text() == tracked
def test_init_keeps_bootstrap_key_out_of_local_files(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
monkeypatch.setenv("OVERMIND_API_KEY", "secret")
- claude = claude_config_path()
- before = claude.read_text() if claude.exists() else None
for ide in ("cursor", "claude", "opencode", "codex"):
result = runner.invoke(app, ["init", "--ide", ide], catch_exceptions=False)
assert result.exit_code == 0, result.output
for path in (
tmp_path / ".cursor" / "mcp.json",
+ claude_config_path(),
tmp_path / "opencode.json",
tmp_path / ".codex" / "config.toml",
+ tmp_path / "overmind.toml",
):
- assert not path.exists()
- assert "secret" not in (tmp_path / "overmind.toml").read_text()
- after = claude.read_text() if claude.exists() else None
- assert after == before
+ assert "secret" not in path.read_text()
assert not (tmp_path / ".overmind" / "credentials.toml").exists()
-def test_init_opencode_installs_skill_without_writing_mcp(tmp_path, monkeypatch):
+def test_init_opencode_json(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
_init(tmp_path, "opencode")
- assert not (tmp_path / "opencode.json").exists()
+ cfg = json.loads((tmp_path / "opencode.json").read_text())
+ assert cfg["mcp"]["overmind"] == {
+ "type": "remote",
+ "url": "http://localhost:8000/api/mcp/",
+ "enabled": True,
+ }
assert (tmp_path / ".opencode" / "skills" / "overmind" / "SKILL.md").is_file()
assert not (tmp_path / ".opencode" / "commands").exists()
-def test_init_codex_installs_skill_without_writing_mcp(tmp_path, monkeypatch):
+def test_init_codex_writes_project_config_and_skill(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
monkeypatch.setenv("OVERMIND_API_KEY", "k")
result = runner.invoke(app, ["init", "--ide", "codex", "--env", "production"], catch_exceptions=False)
assert result.exit_code == 0, result.output
- assert not (tmp_path / ".codex" / "config.toml").exists()
+ assert "Next: Run `codex mcp login overmind`, then restart Codex." in result.output
+ config = (tmp_path / ".codex" / "config.toml").read_text()
+ assert '[mcp_servers.overmind]\nurl = "https://api.overmindlab.ai/api/mcp/"' in config
+ assert "http_headers" not in config
assert (tmp_path / ".agents" / "skills" / "overmind" / "SKILL.md").is_file()
assert (tmp_path / "overmind.toml").is_file()
- assert not (tmp_path / ".codex" / "commands").exists()
-def test_init_leaves_existing_codex_config_unchanged(tmp_path, monkeypatch):
+def test_init_codex_replaces_own_section_and_preserves_other_config(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
- monkeypatch.setenv("OVERMIND_API_KEY", "k")
config_path = tmp_path / ".codex" / "config.toml"
config_path.parent.mkdir()
- original = (
+ config_path.write_text(
'model = "gpt-5"\n\n'
- '[mcp_servers.overmind]\nurl = "https://old.example"\n\n'
+ '[mcp_servers.overmind]\nurl = "https://old.example"\nhttp_headers = { "X-Api-Key" = "old" }\n\n'
'[mcp_servers.other]\nurl = "https://other.example"\n'
)
- config_path.write_text(original)
+ config_path.chmod(0o600)
result = runner.invoke(app, ["init", "--ide", "codex"], catch_exceptions=False)
assert result.exit_code == 0, result.output
- assert config_path.read_text() == original
+ config = config_path.read_text()
+ assert 'model = "gpt-5"' in config
+ assert 'url = "https://other.example"' in config
+ assert config.count("[mcp_servers.overmind]") == 1
+ assert "https://old.example" not in config
+ assert "http_headers" not in config
+ assert stat.S_IMODE(config_path.stat().st_mode) == 0o600
def test_init_does_not_copy_saved_project_key_into_mcp(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
monkeypatch.delenv("OVERMIND_API_URL", raising=False)
monkeypatch.delenv("OVERMIND_BASE_URL", raising=False)
- before = claude_config_path().read_text() if claude_config_path().exists() else None
dump(
Config(
api_key="ovr_project_key",
@@ -276,9 +292,7 @@ def test_init_does_not_copy_saved_project_key_into_mcp(tmp_path, monkeypatch):
result = runner.invoke(app, ["init", "--ide", "claude"], catch_exceptions=False)
assert result.exit_code == 0, result.output
- after = claude_config_path().read_text() if claude_config_path().exists() else None
- assert after == before
- assert "ovr_project_key" not in (after or "")
+ assert _claude_overmind(tmp_path) == {"type": "http", "url": "http://localhost:8000/api/mcp/"}
def test_init_does_not_copy_legacy_inline_key_into_mcp(tmp_path, monkeypatch):
@@ -293,24 +307,25 @@ def test_init_does_not_copy_legacy_inline_key_into_mcp(tmp_path, monkeypatch):
result = runner.invoke(app, ["init", "--ide", "codex"], catch_exceptions=False)
assert result.exit_code == 0, result.output
- assert not (tmp_path / ".codex" / "config.toml").exists()
+ assert "legacy-bootstrap" not in (tmp_path / ".codex" / "config.toml").read_text()
assert "legacy-bootstrap" in (tmp_path / "overmind.toml").read_text()
assert not (tmp_path / ".overmind" / "credentials.toml").exists()
-def test_init_leaves_tracked_mcp_config_unchanged(tmp_path, monkeypatch):
+def test_init_can_prepare_a_tracked_unauthenticated_mcp_config(tmp_path, monkeypatch):
monkeypatch.chdir(tmp_path)
subprocess.run(["git", "init", "-q"], cwd=tmp_path, check=True)
- config_path = tmp_path / ".codex" / "config.toml"
+ config_path = tmp_path / ".cursor" / "mcp.json"
config_path.parent.mkdir()
- original = '[mcp_servers.other]\ncommand = "other"\n'
- config_path.write_text(original)
- subprocess.run(["git", "add", ".codex/config.toml"], cwd=tmp_path, check=True)
+ config_path.write_text('{"mcpServers": {"other": {"command": "other"}}}\n')
+ subprocess.run(["git", "add", ".cursor/mcp.json"], cwd=tmp_path, check=True)
- result = runner.invoke(app, ["init", "--ide", "codex"], catch_exceptions=False)
+ result = runner.invoke(app, ["init", "--ide", "cursor"], catch_exceptions=False)
assert result.exit_code == 0, result.output
- assert config_path.read_text() == original
+ servers = json.loads(config_path.read_text())["mcpServers"]
+ assert servers["other"] == {"command": "other"}
+ assert "headers" not in servers["overmind"]
def test_init_honors_api_url_over_env(tmp_path, monkeypatch):
@@ -332,7 +347,8 @@ def test_init_honors_api_url_over_env(tmp_path, monkeypatch):
catch_exceptions=False,
)
assert result.exit_code == 0, result.output
- assert not (tmp_path / ".cursor" / "mcp.json").exists()
+ mcp = json.loads((tmp_path / ".cursor" / "mcp.json").read_text())
+ assert mcp["mcpServers"]["overmind"]["url"] == "http://127.0.0.1:9000/api/mcp/"
assert 'base-url = "http://127.0.0.1:9000"' in (tmp_path / "overmind.toml").read_text()
diff --git a/overmind/tests/test_sync_ensure_project.py b/overmind/tests/test_sync_ensure_project.py
index 0e331d35..f748fb01 100644
--- a/overmind/tests/test_sync_ensure_project.py
+++ b/overmind/tests/test_sync_ensure_project.py
@@ -9,7 +9,7 @@ from unittest.mock import MagicMock, patch
import pytest
from overmind.config import Config, dump, load
-from overmind.init_cmd import claude_config_path, write_mcp_config
+from overmind.init_cmd import SUPPORTED_IDES, claude_config_path, write_mcp_config
from overmind.sync import (
SyncError,
_api_key_scope,
@@ -124,12 +124,12 @@ def test_ensure_mcp_project_key_noop_for_project_scoped_key(tmp_path: Path):
assert load(path).api_key == "already-project"
-def test_sync_installs_final_key_for_all_configured_ides(tmp_path: Path, monkeypatch, capsys):
+def test_sync_saves_project_key_without_touching_oauth_mcp_configs(tmp_path: Path, monkeypatch, capsys):
path = tmp_path / "overmind.toml"
project_id = "11111111-1111-1111-1111-111111111111"
dump(Config(project_id=project_id, project_name="demo"), path)
- for ide in ("cursor", "claude", "opencode", "codex"):
- write_mcp_config(ide, tmp_path, "https://api.example/api/mcp/", None)
+ configs = [write_mcp_config(ide, tmp_path, "https://api.example/api/mcp/") for ide in SUPPORTED_IDES]
+ before = [config.read_text() for config in configs]
with (
patch("overmind.sync._api_key_scope", return_value="account"),
@@ -141,15 +141,7 @@ def test_sync_installs_final_key_for_all_configured_ides(tmp_path: Path, monkeyp
assert result.api_key == "ovr_project_key"
assert "ovr_project_key" not in capsys.readouterr().out
assert "api-key" not in path.read_text()
- assert json.loads((tmp_path / ".cursor" / "mcp.json").read_text())["mcpServers"]["overmind"]["headers"] == {
- "X-Api-Key": "ovr_project_key"
- }
- claude = json.loads(claude_config_path().read_text())["projects"][tmp_path.resolve().as_posix()]
- assert claude["mcpServers"]["overmind"]["headers"] == {"X-Api-Key": "ovr_project_key"}
- assert json.loads((tmp_path / "opencode.json").read_text())["mcp"]["overmind"]["headers"] == {
- "X-Api-Key": "ovr_project_key"
- }
- assert 'http_headers = { "X-Api-Key" = "ovr_project_key" }' in (tmp_path / ".codex" / "config.toml").read_text()
+ assert [config.read_text() for config in configs] == before
monkeypatch.delenv("OVERMIND_API_KEY", raising=False)
assert resolve_api_key("", load(path)) == "ovr_project_key"
diff --git a/overmind/uv.lock b/overmind/uv.lock
index 363d7e1a..a91451e5 100644
--- a/overmind/uv.lock
+++ b/overmind/uv.lock
@@ -892,7 +892,7 @@ wheels = [
[[package]]
name = "overmind"
-version = "0.1.104"
+version = "0.1.105"
source = { editable = "." }
dependencies = [
{ name = "packaging" },