Skip to content

fix: use HTTP MCP server for Kiro 2.14.1+ so @agentbridge tools load#949

Merged
catatafishen merged 1 commit into
catatafishen:masterfrom
Strobotti:fix/kiro-http-mcp-server
Jul 25, 2026
Merged

fix: use HTTP MCP server for Kiro 2.14.1+ so @agentbridge tools load#949
catatafishen merged 1 commit into
catatafishen:masterfrom
Strobotti:fix/kiro-http-mcp-server

Conversation

@Strobotti

Copy link
Copy Markdown
Contributor

Summary

Fixes #948.

In Kiro CLI sessions, only `web_fetch`/`web_search` were available — none of the `@agentbridge/` MCP tools loaded, leaving the agent with effectively no IDE/file tools.

Root cause

Kiro 2.14.1 advertises `mcpCapabilities: { http: true, sse: false }` during ACP `initialize`, but `KiroClient.customizeNewSession()` injected a stdio MCP server via `buildMcpStdioServer()`. Kiro 2.14.1 silently ignores stdio MCP servers passed over ACP, so `_kiro.dev/mcp/server_initialized` never fired and no tools loaded.

Switching to an HTTP MCP server (pointing at the already-running `McpHttpServer`) surfaced a second, subtler bug: Kiro's `session/new` parser requires the HTTP server entry to carry a `headers` field as a JSON array (even empty `[]`). Without it — or with `headers` as an object — Kiro exits cleanly (exit code 0, no stderr, never connecting to MCP) the instant it parses `session/new`, killing the whole session.

The correct shape is:
```json
{"type":"http","name":"agentbridge","url":"http://127.0.0.1:/mcp","headers":[]}
```

The fix

  • `AcpClient`: added `buildMcpHttpServer()` / `buildMcpHttpServerJson()` that emit the HTTP MCP server entry including the mandatory empty `headers` array, plus `advertisesHttpMcp()` to honor `mcpCapabilities.http`.
  • `KiroClient.customizeNewSession()`: for Kiro ≥ 2.14.1 that advertises HTTP MCP, inject the HTTP server instead of stdio. Older versions fall back to stdio (no worse than before). The version gate is a conservative safeguard since older Kiro couldn't be re-verified.
  • Added unit tests covering the HTTP MCP JSON shape (including the `headers:[]` array).

Verification

  • A/B tested directly over ACP against real kiro-cli 2.14.1 (`--agent-engine v2`): stdio ❌, http+`headers:[]` ✅ — Kiro emits `_kiro.dev/mcp/server_initialized: agentbridge` and POSTs `initialize → notifications/initialized → tools/list`.
  • Verified end-to-end in the real IntelliJ sandbox: all `@agentbridge/` tools now load in Kiro sessions.
  • Unit tests pass.

Kiro 2.14.1 advertises mcpCapabilities.http at ACP initialize but silently
ignores stdio MCP servers passed over session/new, so no @AgentBridge tools
load and the agent is left with only web_fetch/web_search.

Add buildMcpHttpServer()/advertisesHttpMcp() to AcpClient and make
KiroClient.customizeNewSession() send an HTTP MCP server pointing at the
already-running in-IDE McpHttpServer.

The HTTP MCP entry must include a `headers` ARRAY (even when empty). Kiro
2.14.1's session/new parser rejects an entry without it — or with `headers`
as an object — by exiting cleanly (exit 0, no error), which kills the whole
session before any MCP connection is attempted. This was verified empirically
by driving kiro-cli 2.14.1 over ACP: with headers:[] Kiro emits
kiro.dev/mcp/server_initialized: agentbridge and loads all tools.

Version-gate the transport as a conservative safeguard: older Kiro (e.g.
2.10.0) also advertises mcpCapabilities.http:true and was observed to crash on
session/new, but only ever with the earlier headerless payload; it was not
re-verified with the corrected shape. So HTTP is used only for Kiro >= 2.14.1
(verified working) and older versions fall back to the stdio transport, which
keeps the session alive (without @AgentBridge tools) — no worse than before.

Fixes catatafishen#948

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown

⚠️ ClusterFuzzLite — Maintainer Security Review Required

A maintainer needs to approve the ClusterFuzzLite PR fuzzing workflow run for this fork PR.

Before approving, please review the code changes from Strobotti/agentbridge@4c253c16 to confirm there is no code that could:

  • Exfiltrate the CFLITE_STORAGE_REPO_TOKEN CI secret
  • Abuse CI infrastructure or the fuzz corpus storage repository

The fuzz targets from the fork branch will be compiled and executed with access to repository secrets. Rubber-stamping this approval without reviewing the code is a security risk.

This comment is posted automatically whenever ClusterFuzzLite is triggered on a fork PR.

@Strobotti

Copy link
Copy Markdown
Contributor Author

here's a screenshot with the fix applied:
image

@catatafishen

Copy link
Copy Markdown
Owner

Thanks, I appreciate the help!

As a side note, I can no longer verify Kiro end to end. My account got banned for “suspicious activity,” and when I created a new one with another email, the same thing happened after a few days. I guess they’re quite sensitive to ACP-related testing, so it’s probably worth being careful when trying things out.

@catatafishen
catatafishen merged commit 98ac721 into catatafishen:master Jul 25, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kiro CLI 2.14.1: @agentbridge/ tools never load — plugin sends stdio MCP over ACP, but Kiro only initializes HTTP MCP

2 participants