# Agent integration over MCP: Claude Code, Codex and Gemini

> How AgentForge connects its agentforge MCP server to Claude Code, Codex CLI and Gemini CLI panes, how agent identity works and which tools each role sees.

- Canonical: https://www.zekfy.com/docs/agent-integration-mcp/
- Türkçe: https://www.zekfy.com/tr/dokumanlar/mcp-ile-ajan-entegrasyonu/
- Last updated: 2026-12-04

AgentForge talks to agents over the [Model Context Protocol (MCP)](https://www.zekfy.com/glossary/#mcp). When a project opens, a local [MCP](https://www.zekfy.com/glossary/#mcp) server named `agentforge` is configured; agents use that server's tools to read the board, move cards, add [evidence](https://www.zekfy.com/glossary/#evidence), request approval, send messages and write to memory. The full list of tools is on the [MCP tools](https://www.zekfy.com/agentforge/mcp-tools/) page.

## How the server works

The `agentforge` server is a standalone stdio process and runs on the system Node. The server writes directly to the files in the project's [`.forge` folder](https://www.zekfy.com/glossary/#forge-folder), and the interface sees the change through a file watcher. An agent's tool call and a user's action in the interface therefore update the same state.

Because the server runs on Node, `node` must be installed on the machine. AgentForge resolves Node to its absolute path on the PATH.

## Configuration per engine

The board tools are connected to three engines. Each engine reads its configuration from a different place:

| Engine      | How AgentForge provides the server                       | Written to the user's global settings |
| ----------- | -------------------------------------------------------- | ------------------------------------- |
| Claude Code | An `agentforge` entry in `.mcp.json` at the project root | No                                    |
| Codex CLI   | Launch flags: `-c mcp_servers.agentforge.*`              | No                                    |
| Gemini CLI  | A project-scoped `.gemini/settings.json`                 | No                                    |

### Claude Code

When a project opens, the `agentforge` server is added to `.mcp.json`; existing MCP entries are kept. The entry has this shape:

```json
{
  "mcpServers": {
    "agentforge": {
      "command": "<path to node>",
      "args": ["<mcp-server>/index.mjs", "<project root>"],
      "alwaysLoad": true,
      "env": {
        "AGENTFORGE_AGENT_NAME": "${AGENTFORGE_AGENT_NAME:-}",
        "AGENTFORGE_AGENT_ROLE": "${AGENTFORGE_AGENT_ROLE:-}"
      }
    }
  }
}
```

If `.mcp.json` is corrupt, AgentForge backs it up before rewriting it. For Claude Code, status hooks are also added to `.claude/settings.json`; these hooks report exactly whether a pane is busy, idle or waiting for an answer, and check risky tool calls against the [approval policy](https://www.zekfy.com/glossary/#approval-policy) before they run.

### Codex CLI

Codex does not read `.mcp.json`. AgentForge passes the same server when it starts the task pane, with the `-c mcp_servers.agentforge.command` and `-c mcp_servers.agentforge.args` flags. The `default_tools_approval_mode='approve'` setting lets only this server's tools run without confirmation; without it the task pane would wait for confirmation on every board call. AgentForge does not write to the user's global Codex configuration file.

### Gemini CLI

AgentForge writes the server to the project's `.gemini/settings.json` file and keeps the other settings. `trust: true` skips tool confirmations for this server only. Gemini loads this file only in a **trusted folder**; the decision to trust the folder belongs to the user. If the file is corrupt, AgentForge does not overwrite it.

### Other engines

Aider, OpenCode, Cursor Agent CLI, GitHub Copilot CLI, Qwen Code, Goose, Crush, Kimi Code and Antigravity CLI run in a terminal pane, but AgentForge does not connect the board tools to these engines. They receive a task through the terminal and cannot advance a card through MCP tools. See the [Agent engines](https://www.zekfy.com/agentforge/agent-engines/) page for details.

## Agent identity

MCP tools do not identify the caller from a tool parameter. The main process that opens the pane writes the agent's name and role into the pane's environment, and the MCP server reads identity from that environment.

| Situation                                                                                            | Result                                          |
| ---------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| The agent calls under its own name or leaves the name field empty                                    | The call runs under the name in the environment |
| The agent writes another agent's name                                                                | Rejected with `identity_mismatch`               |
| A session without the environment votes, requests approval or adds a member while a swarm is running | Rejected with `identity_unavailable`            |

## Tool surface by role

The server registers only the tools of that role for [builder](https://www.zekfy.com/glossary/#builder) and [reviewer](https://www.zekfy.com/glossary/#reviewer) sessions and checks the role again on every call. The coordinator and the scout see all tools.

| Role        | Tools available                                                                                                                                                                                                                                                                                                              |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Builder     | `board_list`, `board_move`, `board_comment`, `status_report`, `evidence_add`, `handoff_create`, `delegate_task`, `mailbox_send`, `message_send`, `mission_status`, `approval_request`, `approval_status`, `integrations_status`, `integration_request`, all `memory_*` and `browser_*` tools                                 |
| Reviewer    | `board_list`, `review_submit`, `board_comment`, `evidence_add`, `mailbox_send`, `message_send`, `mission_status`, `approval_status`, `audit_submit`, `audit_list`, `audit_read`, `visual_asset_list`, `visual_asset_review`, `integrations_status`, `integration_request` (reads only), all `memory_*` and `browser_*` tools |
| [Coordinator](https://www.zekfy.com/glossary/#coordinator) | All tools; `team_add_member` is open to the coordinator only                                                                                                                                                                                                                                                                 |

Among builders, the visual asset submit tool is registered only for a builder with the visual specialty. A role that calls a tool outside its table gets a `role_denied` response. Known roles other than the coordinator cannot move another agent's card (`not_owner`).

## Usage and cost records

AgentForge reads token usage from the agent CLIs' local session records. With Claude Code, hook signals let a record be matched to a pane exactly. With Codex and Gemini, usage is read from the sessions that started in that folder after the pane was opened. If the match is not reliable, the [Metrics](https://www.zekfy.com/agentforge/features/metrics/) view does not show zero; it writes "cannot be measured" and gives the reason, for example when several panes of the same CLI are open in the same folder.

## Adding other MCP servers

The Plugins view (`Ctrl+P`) lists, adds and removes the MCP servers of the project, and "test tools" probes a server live. The catalog adds the context7, playwright, github, filesystem, memory, sequential-thinking, serena, semgrep and exa servers with one click. Between three and six active servers at a time is recommended, because every tool schema enters the agent's context.

## Things to know

- A change to the MCP server reaches only agent sessions opened afterwards; a running swarm continues on the old version.
- Session resume exists for Claude Code only.
- Per-role tool permission is applied with `--disallowedTools` in Claude Code and the `--sandbox` flag in Codex (`read-only` for the read-only level, `workspace-write` for no-shell-risk) and has not yet been tried in a live session.
- The prompts sent to agents and the tool descriptions are in Turkish regardless of the interface language.

## Related pages

- [MCP tools](https://www.zekfy.com/agentforge/mcp-tools/)
- [Agent engines](https://www.zekfy.com/agentforge/agent-engines/)
- [Evidence and review gates](https://www.zekfy.com/docs/evidence-and-review-gates/)
- [Service connections](https://www.zekfy.com/docs/service-connections/)
