@globant/coda-darwin-x64 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/agents/coda-help.md +6 -5
- package/assets/autonomy/continuation.md +89 -0
- package/assets/autonomy/judge-guidance.md +48 -0
- package/assets/autonomy/judge.md +59 -0
- package/assets/autonomy/maintenance.md +19 -0
- package/assets/autonomy/objective-updated.md +15 -0
- package/assets/autonomy/reminder.md +23 -0
- package/assets/autonomy/wrap-up.md +24 -0
- package/assets/docs/add-mcp-server-skill.md +135 -0
- package/assets/docs/agents.md +1 -1
- package/assets/docs/cli-reference.md +2 -0
- package/assets/docs/config-json.md +42 -45
- package/assets/docs/config-reference.md +50 -36
- package/assets/docs/configuration.md +12 -9
- package/assets/docs/connect-provider.md +3 -3
- package/assets/docs/extensions.md +23 -26
- package/assets/docs/faq.md +17 -7
- package/assets/docs/glossary.md +4 -4
- package/assets/docs/guide-changes.md +4 -4
- package/assets/docs/guide-collaborate.md +4 -4
- package/assets/docs/guide-extend.md +5 -5
- package/assets/docs/hooks.md +32 -68
- package/assets/docs/how-it-works.md +3 -3
- package/assets/docs/index.md +6 -5
- package/assets/docs/installation.md +5 -5
- package/assets/docs/logging.md +1 -1
- package/assets/docs/overview.md +7 -6
- package/assets/docs/permissions.md +16 -12
- package/assets/docs/quickstart.md +8 -4
- package/assets/docs/sessions.md +1 -1
- package/assets/docs/shortcuts.md +1 -1
- package/assets/docs/tools-reference.md +8 -1
- package/assets/docs/workflows.md +2 -1
- package/assets/skills/configure-mcp/SKILL.md +279 -0
- package/assets/skills/create-hook/SKILL.md +4 -4
- package/assets/skills/init-rules/SKILL.md +191 -0
- package/coda +0 -0
- package/lib/keytar/build/Release/keytar.node +0 -0
- package/lib/opentui/libopentui.dylib +0 -0
- package/lib/ripgrep/rg +0 -0
- package/package.json +1 -1
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
# Permissions & Approvals
|
|
2
2
|
|
|
3
|
-
CODA can read files, run shell commands, and edit your code
|
|
3
|
+
CODA can read files, run shell commands, and edit your code. Every tool call goes through an always-on **authorization engine** that decides `allow` / `ask` / `deny`. `allow` runs, `deny` does not, and `ask` pauses for your decision. This human-in-the-loop (HITL) design keeps you in control without prompting for every routine action.
|
|
4
4
|
|
|
5
5
|
Rules and modes combine to form a layered safety net — you stay in control even when the agent runs largely on its own. This page covers the permission modes, the easy plain-English way to change permissions (`propose_policy`), the rule syntax the agent writes for you, how decisions are made, and the un-relaxable catastrophic floor.
|
|
6
6
|
|
|
7
7
|
## How approvals work
|
|
8
8
|
|
|
9
|
-
When
|
|
9
|
+
When the engine returns `ask`, CODA pauses and shows the effective action and reason. In the interactive TUI:
|
|
10
10
|
|
|
11
|
-
- **Y** — allow this action and continue.
|
|
12
|
-
- **
|
|
11
|
+
- **Y** — allow this action once and continue.
|
|
12
|
+
- **A** — allow the displayed reusable rule for this session, when that option is available.
|
|
13
|
+
- **Arrow keys + Enter** — choose another option, including a permanent project rule when CODA can derive one. Permanent changes get a second confirmation that explains their scope.
|
|
14
|
+
- **N** — deny it; CODA carries on without running that action.
|
|
13
15
|
|
|
14
16
|
Some prompts are **questions** rather than yes/no approvals — for example when a tool needs you to pick from a numbered list or type a short answer. There you type your choice (or the number) and press **Enter**.
|
|
15
17
|
|
|
@@ -17,7 +19,7 @@ How often CODA stops to ask depends on your **permission mode** and your **rules
|
|
|
17
19
|
|
|
18
20
|
## Permission modes
|
|
19
21
|
|
|
20
|
-
The main approval control is the **permission mode** — the master dial that sets the agent's default level of autonomy. Press **Ctrl+P** to cycle the session between three modes; set the default
|
|
22
|
+
The main approval control is the **permission mode** — the master dial that sets the agent's default level of autonomy. Press **Ctrl+P** to cycle the session between three modes; set the default in `~/.coda/config.json`. A project `.coda/config.json` can make that starting mode more restrictive, but it cannot silently raise autonomy above your user setting.
|
|
21
23
|
|
|
22
24
|
The three valid values are `"read-only"`, `"default"`, and `"auto"`.
|
|
23
25
|
|
|
@@ -130,12 +132,14 @@ It is **on by default**. To stop the agent from ever suggesting permanent rule c
|
|
|
130
132
|
|
|
131
133
|
To pin a specific command regardless of mode, add rules under `permissions` in `config.json`:
|
|
132
134
|
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
"
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"permissions": {
|
|
138
|
+
"defaultMode": "default",
|
|
139
|
+
"allow": ["Bash(git status)", "Bash(npm test)"],
|
|
140
|
+
"ask": ["Bash(git push:*)"],
|
|
141
|
+
"deny": ["Bash(rm:*)"]
|
|
142
|
+
}
|
|
139
143
|
}
|
|
140
144
|
```
|
|
141
145
|
|
|
@@ -327,7 +331,7 @@ Two things to know when reading the output:
|
|
|
327
331
|
- **See what applies first:** run `/permissions` (or `coda permissions` outside a session) — see the section "Seeing what applies right now" above.
|
|
328
332
|
- **In the session:** press **Ctrl+P** to cycle the permission mode.
|
|
329
333
|
- **Just ask:** tell the agent in plain English (`allow pnpm build`, `never allow rm -rf`) and it drafts the rule via `propose_policy` for your approval.
|
|
330
|
-
- **Default / per project:** `permissions.defaultMode` and `permissions.allow`/`ask`/`deny` in `~/.coda/config.json` or a project's `.coda/config.json
|
|
334
|
+
- **Default / per project:** set `permissions.defaultMode` and `permissions.allow`/`ask`/`deny` in `~/.coda/config.json` or a project's `.coda/config.json`. Rules accumulate across scopes; a project mode can tighten but cannot raise your personal default — see [Configuration](#configuration).
|
|
331
335
|
- **For a headless run:** the `--auto-approve none|all` flag (see [Commands & Flags](#cli-reference)).
|
|
332
336
|
|
|
333
337
|
## See also
|
|
@@ -51,12 +51,16 @@ Search the codebase for code smells around error handling, duplicated logic, and
|
|
|
51
51
|
|
|
52
52
|
## 3. Review what CODA does
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
Every tool call passes through CODA's authorization engine. Safe actions can run immediately, denied actions do not run, and actions classified as `ask` open an approval prompt. When a prompt appears, you can:
|
|
55
55
|
|
|
56
|
-
- Press **Y** to approve
|
|
57
|
-
- Press **
|
|
56
|
+
- Press **Y** to approve this action
|
|
57
|
+
- Press **A** to approve the displayed reusable rule for this session, when offered
|
|
58
|
+
- Use **Arrow keys + Enter** to choose another offered option, including a permanent project rule (which gets a second confirmation)
|
|
59
|
+
- Press **N** to deny this action
|
|
58
60
|
- Press **Esc** to interrupt the current turn entirely
|
|
59
61
|
|
|
62
|
+
How often you see a prompt depends on the current permission mode and your `allow` / `ask` / `deny` rules. See [Permissions & Approvals](#permissions).
|
|
63
|
+
|
|
60
64
|
If CODA goes in the wrong direction, interrupt early — don't let it keep going. Interrupting and redirecting is faster than undoing a lot of changes.
|
|
61
65
|
|
|
62
66
|
## 4. Undo anything
|
|
@@ -75,7 +79,7 @@ This opens the timeline picker (you can also type `/rewind`, or press **Esc** tw
|
|
|
75
79
|
|
|
76
80
|
A few small habits make long sessions much better:
|
|
77
81
|
|
|
78
|
-
- **Watch the context meter.** The status bar shows how full the conversation context is.
|
|
82
|
+
- **Watch the context meter.** The status bar shows how full the conversation context is. CODA reduces context automatically before it fills the window — or you can run `/compact` before switching to a new topic.
|
|
79
83
|
- **Start fresh for unrelated work.** `/new` opens a clean session (the old one is saved and resumable) so unrelated context doesn't bleed into the next task.
|
|
80
84
|
- **Switch models when it helps.** Press `Shift+Tab` to cycle favorite models, or run `/switch-model` to pick one — use a stronger model for hard reasoning, a cheaper one for routine edits.
|
|
81
85
|
- **Resume later.** When you exit (`Ctrl+C` twice or `/exit`), CODA prints a `coda --session-id <id>` command you can paste to pick up exactly where you left off. You can also run `/sessions` from within any active session to open the session browser and switch directly. For an even quicker pick-up, run `coda --lastsession` from your project root to resume the most recent session automatically.
|
package/assets/docs/sessions.md
CHANGED
|
@@ -130,7 +130,7 @@ It prints a health summary: current **State**, the **project** + **workspace id*
|
|
|
130
130
|
|
|
131
131
|
## Watch the context fill level
|
|
132
132
|
|
|
133
|
-
The status bar at the bottom of the TUI shows a context fill percentage.
|
|
133
|
+
The status bar at the bottom of the TUI shows a context fill percentage. CODA begins automatic reduction before the window is exhausted: it can move stale tool output aside first and summarize older history at the configured threshold. If you're deep in a long session and things start feeling off, try:
|
|
134
134
|
|
|
135
135
|
```text
|
|
136
136
|
/compact
|
package/assets/docs/shortcuts.md
CHANGED
|
@@ -36,7 +36,7 @@ These shortcuts work inside the interactive TUI. Type `?` at any time to open th
|
|
|
36
36
|
| --- | --- |
|
|
37
37
|
| `Ctrl+↑` | Scroll up in the transcript |
|
|
38
38
|
| `Ctrl+↓` | Scroll down in the transcript |
|
|
39
|
-
| `Ctrl+Shift+C` | Copy the last code block to clipboard |
|
|
39
|
+
| `Ctrl+Shift+C` | Copy the last code block to clipboard (use [`/copy`](#cli-reference) to copy a full response instead) |
|
|
40
40
|
| `Esc Esc` | Open the timeline picker (double-press within ~750 ms when the chat input is empty and no turn is running) |
|
|
41
41
|
|
|
42
42
|
## Model switching
|
|
@@ -36,9 +36,15 @@ To limit which tools a single run may use, pass `coda --tools …` (see [Command
|
|
|
36
36
|
| `skills` | Load a discovered skill by name |
|
|
37
37
|
| `run_agent`, `wait_agents`, `cancel_agent` | Start and manage delegated [agent](#agents) runs |
|
|
38
38
|
| `workflow` | Run a named workflow script that orchestrates multiple agents in the background (requires agents to be enabled) |
|
|
39
|
+
| `todo_write`, `todo_update`, `todo_list` | Record, revise, and read the session's TODO plan (enabled by config; see [What you can configure](#what-you-can-configure)) |
|
|
40
|
+
| `propose_policy` | Propose a permanent change to your authorization policy — add/remove a rule or set the permission mode (a tightening applies immediately; a loosening asks you first) |
|
|
41
|
+
| `update_run` | End the active autonomous run — mark it `complete` or `blocked`. Available only while an autonomous run is active |
|
|
42
|
+
| `reconfigure_loop` | Reconfigure the active `/loop`'s schedule in place (`intervalMs`, `cap`, and/or `maxDurationMs`). Available only while a loop is active |
|
|
39
43
|
|
|
40
44
|
Extensions and plugins can register more tools the same way the core registers these built-ins.
|
|
41
45
|
|
|
46
|
+
A few tools are **registered dynamically** and only appear while the matching mode is running: `update_run` exists only during an [autonomous run](#guide-automate) and `reconfigure_loop` only during a `/loop` — both are unregistered the moment that run or loop ends (mirroring how `mcp_execute` comes and goes with its MCP servers).
|
|
47
|
+
|
|
42
48
|
### How CODA chooses a tool
|
|
43
49
|
|
|
44
50
|
You never name a tool — CODA picks based on the task. A few patterns are worth knowing so its behavior feels predictable:
|
|
@@ -66,6 +72,7 @@ Tool behavior is configured in a few different places — some from the `/settin
|
|
|
66
72
|
| **OmniParser** | How much extracted document text is inlined in a result vs written to `.coda/omni-parser/`. | `CODA_OMNI_PARSER_INLINE_THRESHOLD_CHARS` env var |
|
|
67
73
|
| **MCP** | Which servers load — which in turn decides whether `mcp_execute` is useful. | The `/mcp` manager |
|
|
68
74
|
| **Agents** | Whether the delegation tools exist, and how runs behave. See [Agents](#agents). | Config (`agents.*`) + the `/agents` manager |
|
|
75
|
+
| **TODO planning** | Whether the `todo_write` / `todo_update` / `todo_list` tools exist. On by default in interactive sessions; headless runs enable them only when `CODA_ENABLE_TODOS` is set to `1`, `true`, or `yes`. | Config (`tools.todos.enabled`) + `CODA_ENABLE_TODOS` env var (headless) |
|
|
69
76
|
|
|
70
77
|
## Web fetch
|
|
71
78
|
|
|
@@ -111,7 +118,7 @@ The tool can also write a fetched page straight to a file (always confined to `.
|
|
|
111
118
|
|
|
112
119
|
When a delegated [agent](#agents) run executes, it uses a trimmed tool set. Two categories are removed from every child session:
|
|
113
120
|
|
|
114
|
-
- **Delegation tools** — `run_agent`, `wait_agents`, and `cancel_agent` are unregistered, so a sub-agent **cannot delegate further** (no nested sub-agents) or wait on other runs.
|
|
121
|
+
- **Delegation tools** — `run_agent`, `wait_agents`, and `cancel_agent` are unregistered, so a sub-agent **cannot delegate further** (no nested sub-agents) or wait on other runs. `workflow` is currently still registered in a child session, so a sub-agent can launch a workflow.
|
|
115
122
|
- **User prompting** — `ask_user` is unregistered, so a sub-agent **cannot prompt you** for input. It must complete its task from the instructions it was given.
|
|
116
123
|
|
|
117
124
|
The `skills` tool is also unavailable in child sessions — skill loading is main-agent-only. The remaining parent tools (read, edit, write, bash, search, etc.) are inherited, and the MCP service is deliberately shared, so `mcp_execute` also works inside a child run.
|
package/assets/docs/workflows.md
CHANGED
|
@@ -76,7 +76,7 @@ Create a workflow that keeps generating test ideas until it finds no new ones or
|
|
|
76
76
|
|
|
77
77
|
> **Tip — name the inputs.** Mentioning the folder, the diff, or the output location in your request helps `create-workflow` set up the workflow's arguments, so later runs can infer them from a one-line prompt.
|
|
78
78
|
|
|
79
|
-
The `create-workflow` agent **writes the file but doesn't run it**.
|
|
79
|
+
The `create-workflow` agent **writes the file but doesn't run it**. A freshly authored workflow gets a first-run confirmation where you can run it, view the generated script, request amendments, or decline. Workflows already committed under the current project's `.coda/workflows/` can run directly. Workflows discovered from parent/user directories or plugins ask for approval the first time; editing one changes its content and asks again.
|
|
80
80
|
|
|
81
81
|
## Workflow authoring conventions
|
|
82
82
|
|
|
@@ -118,6 +118,7 @@ A workflow doesn't just print a wall of text. As it runs it typically:
|
|
|
118
118
|
- **Fans out** the work across agents (one per file, module, or ticket) and runs them up to a concurrency cap derived from available CPU cores (capped at 16).
|
|
119
119
|
- **Synthesizes** their results — often into one or more **artifacts** written to disk (a report, a JSON summary, a translated doc).
|
|
120
120
|
- **Reports back** on a later turn with a short overview and links to any artifacts it wrote, so you can open them when you're ready.
|
|
121
|
+
- **Tracks usage** across its agent runs, including the agent count, output tokens, and USD cost when the provider reports it.
|
|
121
122
|
|
|
122
123
|
Because each step is a real agent run, you can watch the individual agents in the `/workflows` dashboard and open their transcripts, exactly like standalone [agents](#agents).
|
|
123
124
|
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configure-mcp
|
|
3
|
+
description: Configure g-coda's MCP client to connect to an MCP server from a Git URL, remote HTTP endpoint, or npm/pip package, at project or global scope. Use when the user asks to add, register, configure, install, or set up an MCP server or MCP client. e.g. "add the playwright MCP server", "configure an MCP server from this URL", "install this MCP tool globally".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Configure MCP
|
|
7
|
+
|
|
8
|
+
Configure g-coda's MCP client to connect to an MCP server by registering the server entry in the correct config file at the user-chosen scope. The input can be a Git URL, remote HTTP endpoint, or npm/pip package. Reject inputs from which no valid transport (`command` or `url`) can be derived — write nothing in that case.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Golden Rule
|
|
13
|
+
|
|
14
|
+
**Never overwrite existing server entries.** Always merge your new entry into the existing `mcpServers` object. If a server with the same name already exists, confirm with the user before replacing it.
|
|
15
|
+
|
|
16
|
+
**Never hardcode secrets.** Tokens, API keys, and credentials must use `${VAR}` or `${VAR:-default}` interpolation — never inline values.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 1: Determine Scope
|
|
21
|
+
|
|
22
|
+
Ask the user which scope they want if not specified:
|
|
23
|
+
|
|
24
|
+
| Scope | Write to | When to use |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| **Project** | `<cwd>/.coda/mcp.json` | Only this repo; shared via version control |
|
|
27
|
+
| **Global** | `~/.coda/mcp.json` | All projects on this machine; personal |
|
|
28
|
+
|
|
29
|
+
- `<cwd>` = `process.cwd()` where g-coda is running, not the nearest `.git` root.
|
|
30
|
+
- If unsure, **default to project scope**.
|
|
31
|
+
- A project entry always wins over a global entry with the same server name.
|
|
32
|
+
|
|
33
|
+
**Target file:** always write to `mcp.json` (top-level `mcpServers` key).
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 2: Detect Input Type and Validate
|
|
38
|
+
|
|
39
|
+
### 2a. Remote HTTP endpoint
|
|
40
|
+
|
|
41
|
+
Input is `https://…` or `http://…` pointing to a live MCP endpoint (Streamable HTTP transport).
|
|
42
|
+
|
|
43
|
+
Example entry — replace the URL, token variable name, and header values with the real ones:
|
|
44
|
+
|
|
45
|
+
```jsonc
|
|
46
|
+
{
|
|
47
|
+
"url": "https://api.example.com/mcp",
|
|
48
|
+
"authorizationToken": "Bearer ${API_TOKEN}",
|
|
49
|
+
"headers": { "X-Custom": "${CUSTOM_HEADER}" },
|
|
50
|
+
"timeout": 30
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> ⚠️ Make sure no tokens or secrets are exposed — always use `${VAR}` interpolation for credentials.
|
|
55
|
+
|
|
56
|
+
Transport: `url` → HTTP. Do **not** set `command`.
|
|
57
|
+
|
|
58
|
+
### 2b. npm/pip package or CLI tool
|
|
59
|
+
|
|
60
|
+
Input is a package name, `npx`/`uvx` invocation, or local binary path (stdio transport).
|
|
61
|
+
|
|
62
|
+
Example entry — replace the package name and env var names with the real ones:
|
|
63
|
+
|
|
64
|
+
```jsonc
|
|
65
|
+
{
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "@scope/mcp-package@latest"],
|
|
68
|
+
"env": { "API_KEY": "${MY_API_KEY}" }
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
> ⚠️ Make sure no tokens or secrets are exposed — always use `${VAR}` interpolation for credentials.
|
|
73
|
+
|
|
74
|
+
Common patterns: `npx -y <pkg>`, `uvx <pkg>`, `node /path/to/server.js`, `/path/to/binary`.
|
|
75
|
+
|
|
76
|
+
Transport: `command` → stdio. Do **not** set `url`.
|
|
77
|
+
|
|
78
|
+
### 2c. Git URL
|
|
79
|
+
|
|
80
|
+
Most MCP server repositories support **multiple installation methods** (e.g. `npx`, `uvx`, Docker, a remote HTTP endpoint, or a local build). Do not assume — read the repo's documentation first, then ask the user which method they prefer.
|
|
81
|
+
|
|
82
|
+
Steps:
|
|
83
|
+
|
|
84
|
+
1. **Clone temporarily** to read the docs:
|
|
85
|
+
- Project scope: `<cwd>/.coda/tmp/<name>/`
|
|
86
|
+
- Global scope: `~/.coda/tmp/<name>/`
|
|
87
|
+
- Command: `git clone --depth 1 <url> <tmp-dir>`
|
|
88
|
+
2. **Read the README and any MCP-specific docs** to identify all available installation methods.
|
|
89
|
+
3. **Ask the user** which method they prefer — present the options you found. Common options:
|
|
90
|
+
- `npx -y <pkg>` or `uvx <pkg>` (no local build needed — preferred when available)
|
|
91
|
+
- Remote HTTP endpoint (if the project exposes one)
|
|
92
|
+
- Local build (`npm install && npm run build`, entry via `node dist/index.js`)
|
|
93
|
+
4. **Derive the entry** using the chosen method (see sections 2a and 2b for the corresponding entry shape).
|
|
94
|
+
5. **Write the config entry** to `mcp.json`.
|
|
95
|
+
6. **Delete the temporary clone** (`<tmp-dir>`) — it is no longer needed once the config entry is written.
|
|
96
|
+
|
|
97
|
+
> If the chosen method does not require the cloned directory at runtime (e.g. `npx`/`uvx`/HTTP), the tmp directory is always safe to remove. If the user explicitly chooses a local-build method and the runtime depends on the clone, move the directory to its final location (`<cwd>/.coda/mcp-servers/<name>/` or `~/.coda/mcp-servers/<name>/`) instead of deleting it, and tell the user.
|
|
98
|
+
|
|
99
|
+
### 2d. Rejection — no derivable transport
|
|
100
|
+
|
|
101
|
+
If you **cannot** determine either a `command` or a `url` from the input, **do not write anything**. Respond:
|
|
102
|
+
|
|
103
|
+
> "I couldn't determine a valid MCP server transport from what you provided. An MCP server needs either a runnable command (for stdio transport) or an HTTP URL (for Streamable HTTP transport). Please share the server's npm package name, a Git URL, a binary path, or its HTTP endpoint."
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Step 3: Build the Server Entry
|
|
108
|
+
|
|
109
|
+
A valid entry has **exactly one** of `command` (stdio) or `url` (http) — never both, never neither.
|
|
110
|
+
|
|
111
|
+
| Field | Transport | Description |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `command` | stdio | Executable to run as a subprocess |
|
|
114
|
+
| `args` | stdio | Arguments for the subprocess |
|
|
115
|
+
| `cwd` | stdio | Working directory for the subprocess |
|
|
116
|
+
| `url` | http | MCP server HTTP endpoint |
|
|
117
|
+
| `authorizationToken` | http | Shorthand `Authorization` header; supports `${VAR}` |
|
|
118
|
+
| `headers` | http | Extra request headers; string values support `${VAR}` |
|
|
119
|
+
| `timeout` | http | Request timeout in seconds |
|
|
120
|
+
| `env` | both | Environment variables; supports `${VAR}` and `${VAR:-default}` |
|
|
121
|
+
| `disabled` | both | `true` to skip at load time (default: `false`) |
|
|
122
|
+
|
|
123
|
+
Secrets in `env`, `headers`, and `authorizationToken` are resolved from `~/.coda/.secrets`, project `.env`, and `process.env` at load time. Never put raw credentials in the config.
|
|
124
|
+
|
|
125
|
+
Choose a descriptive, kebab-case server name (e.g., `playwright`, `github`, `my-internal-api`).
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Step 4: Non-Destructive Merge into Config
|
|
130
|
+
|
|
131
|
+
### Writing to `mcp.json` (preferred)
|
|
132
|
+
|
|
133
|
+
```jsonc
|
|
134
|
+
// <cwd>/.coda/mcp.json (project) or ~/.coda/mcp.json (global)
|
|
135
|
+
{
|
|
136
|
+
"mcpServers": {
|
|
137
|
+
"<server-name>": { /* entry fields */ }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Merge steps:
|
|
143
|
+
1. Read the existing file, or start with `{ "mcpServers": {} }` if absent.
|
|
144
|
+
2. Check whether `mcpServers["<server-name>"]` exists — confirm with the user before replacing.
|
|
145
|
+
3. Add or replace only the target key; preserve all other entries.
|
|
146
|
+
4. Write the file back.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Step 5: Verify and Notify
|
|
151
|
+
|
|
152
|
+
After writing:
|
|
153
|
+
|
|
154
|
+
1. Show the user exactly what was written (entry + file path).
|
|
155
|
+
2. Confirm the file is valid JSON (no trailing commas, balanced braces).
|
|
156
|
+
3. Remind the user how to activate the change:
|
|
157
|
+
|
|
158
|
+
> **MCP changes are not picked up by `/skills refresh`.** To activate:
|
|
159
|
+
> - Run `/mcp` → select **Reload MCP servers**, or
|
|
160
|
+
> - Restart g-coda.
|
|
161
|
+
|
|
162
|
+
4. For cloned Git repos, delete the temporary directory (`<cwd>/.coda/tmp/<name>/` or `~/.coda/tmp/<name>/`) once the config entry has been written — unless the user chose a local-build method that requires the directory at runtime, in which case it was already moved to its final location as part of step 2c.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Examples
|
|
167
|
+
|
|
168
|
+
### Example 1 — npm package, project scope
|
|
169
|
+
|
|
170
|
+
**User:** "Add the Playwright MCP server to this project."
|
|
171
|
+
|
|
172
|
+
Written to `<cwd>/.coda/mcp.json`:
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"mcpServers": {
|
|
176
|
+
"playwright": {
|
|
177
|
+
"command": "npx",
|
|
178
|
+
"args": ["-y", "@playwright/mcp@latest"]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Response:** Added `playwright` to `.coda/mcp.json`. Run `/mcp` → Reload MCP servers to activate it.
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
### Example 2 — HTTP endpoint, global scope, with auth
|
|
189
|
+
|
|
190
|
+
**User:** "Set up the GitHub MCP server globally. My token is in `GITHUB_TOKEN`."
|
|
191
|
+
|
|
192
|
+
Written to `~/.coda/mcp.json`:
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"mcpServers": {
|
|
196
|
+
"github": {
|
|
197
|
+
"url": "https://api.githubcopilot.com/mcp/",
|
|
198
|
+
"authorizationToken": "Bearer ${GITHUB_TOKEN}",
|
|
199
|
+
"timeout": 30
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Response:** Added `github` to `~/.coda/mcp.json`. Make sure `GITHUB_TOKEN` is set in your environment or `~/.coda/.secrets`. Run `/mcp` → Reload MCP servers to activate it.
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
### Example 3 — Git URL, project scope
|
|
210
|
+
|
|
211
|
+
**User:** "Install from https://github.com/example/my-mcp-server into this project."
|
|
212
|
+
|
|
213
|
+
Steps:
|
|
214
|
+
1. Clone to `<cwd>/.coda/tmp/my-mcp-server/` with `git clone --depth 1 <url> <tmp-dir>`.
|
|
215
|
+
2. Read `README.md` — it documents two options: `npx -y @example/my-mcp-server` or a local build.
|
|
216
|
+
3. Ask the user: *"The repository supports `npx` (no local build needed) or a local build. Which do you prefer?"*
|
|
217
|
+
4. User chooses `npx`. Derive the entry (section 2b).
|
|
218
|
+
5. Write config, then delete `<cwd>/.coda/tmp/my-mcp-server/`.
|
|
219
|
+
|
|
220
|
+
Written to `<cwd>/.coda/mcp.json`:
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"mcpServers": {
|
|
224
|
+
"my-mcp-server": {
|
|
225
|
+
"command": "npx",
|
|
226
|
+
"args": ["-y", "@example/my-mcp-server@latest"]
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
**Response:** Added `my-mcp-server` to `.coda/mcp.json` and removed the temporary clone. Run `/mcp` → Reload MCP servers to activate it.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Example 4 — Rejection
|
|
237
|
+
|
|
238
|
+
**User:** "Add `my-special-tool` as an MCP server."
|
|
239
|
+
|
|
240
|
+
No URL or command is derivable from the name alone.
|
|
241
|
+
|
|
242
|
+
**Response:** I couldn't determine a valid MCP server transport for `my-special-tool`. Please share the npm package name, a Git URL, a binary path, or the HTTP endpoint.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Error Handling
|
|
247
|
+
|
|
248
|
+
| Situation | Action |
|
|
249
|
+
|---|---|
|
|
250
|
+
| File exists but is invalid JSON | Report the parse error and path; do not overwrite. Ask user to fix manually. |
|
|
251
|
+
| Server name already exists | Show the existing entry; ask user to confirm replacement. |
|
|
252
|
+
| No transport derivable | Reject with a clear explanation (Step 2d). Do not write anything. |
|
|
253
|
+
| Git clone fails | Report the error and path; do not write a config entry. Clean up any partial tmp directory. |
|
|
254
|
+
| No installation method found in repo docs | Tell the user no clear method was found; ask them to provide the command or URL directly. |
|
|
255
|
+
| Secret value unclear | Ask which env var name to use; never guess a value. |
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Instructions for the Agent
|
|
260
|
+
|
|
261
|
+
1. **Clarify scope first** — ask project vs global if not stated. Default to project.
|
|
262
|
+
2. **Derive the entry** — HTTP URL → `url` field; package/git/binary → `command` field. For Git URLs, clone to a tmp dir, read the docs, ask the user which method to use, then delete the tmp dir. If no transport is derivable, reject immediately (do not write).
|
|
263
|
+
3. **Choose the config file** — always use `mcp.json` (top-level `mcpServers` key).
|
|
264
|
+
4. **Merge non-destructively** — read the existing file first; preserve all other entries.
|
|
265
|
+
5. **No inline secrets** — always use `${VAR}` notation; tell the user which env var to set.
|
|
266
|
+
6. **Validate JSON** — ensure the written file is syntactically valid.
|
|
267
|
+
7. **Remind about reload** — MCP changes need `/mcp` → Reload MCP servers or a restart. `/skills refresh` does NOT reload MCP.
|
|
268
|
+
8. **Show the result** — always display the final entry and the full path of the file written.
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
272
|
+
## Deliverables
|
|
273
|
+
|
|
274
|
+
When done, provide:
|
|
275
|
+
|
|
276
|
+
1. The exact file path written (e.g., `<cwd>/.coda/mcp.json` or `~/.coda/mcp.json`).
|
|
277
|
+
2. The server entry that was added (JSON block).
|
|
278
|
+
3. Any env vars the user needs to set (if secrets are involved).
|
|
279
|
+
4. The activation command: `/mcp` → Reload MCP servers (or restart g-coda).
|
|
@@ -154,15 +154,15 @@ Every hook receives a JSON object on stdin. All events include these base fields
|
|
|
154
154
|
```json
|
|
155
155
|
{
|
|
156
156
|
"session_id": "abc123",
|
|
157
|
-
"transcript_path": "
|
|
157
|
+
"transcript_path": "",
|
|
158
158
|
"cwd": "/path/to/project",
|
|
159
159
|
"hook_event_name": "PreToolUse",
|
|
160
|
-
"
|
|
161
|
-
"agent_id": "...",
|
|
162
|
-
"agent_type": "main"
|
|
160
|
+
"cli_version": "0.4.2"
|
|
163
161
|
}
|
|
164
162
|
```
|
|
165
163
|
|
|
164
|
+
`transcript_path` is always an empty string (Coda persists conversations to a database, not a transcript file; the field exists for wire-compatibility). `cli_version` is the running Coda version — also available to command hooks as the `CODA_VERSION` env var, which is cheaper than parsing stdin in hot-path hooks. `permission_mode`, `agent_id`, and `agent_type` are reserved fields that are currently never populated — do not depend on them.
|
|
165
|
+
|
|
166
166
|
Additional fields by event:
|
|
167
167
|
|
|
168
168
|
**Tool events** (`PreToolUse`, `PostToolUse`, `PostToolUseFailure`):
|