Kiro icon indicating copy to clipboard operation
Kiro copied to clipboard

MCP Registry servers fail to load in Kiro CLI

Open juanluisbujeda opened this issue 7 months ago • 9 comments

Bug: MCP Registry servers fail in Kiro CLI (work in Kiro IDE)

Description

All MCP servers loaded from an MCP registry fail in Kiro CLI with:

Mcp error: -32002: connection closed: initialize response Servers load in 0.0s, suggesting the process is never properly spawned.

The same registry URL works correctly in Kiro IDE.

Steps to Reproduce

  1. Configure MCP registry URL in Kiro profile
  2. kiro-cli chat
  3. /mcp add → add any server
  4. /mcp → all servers fail

Tested with

  • @modelcontextprotocol/server-brave-search (canonical example from docs)
  • figma-developer-mcp
  • pypi servers fail with: No such file or directory (os error 2)
  • Remote (streamable-http) servers also fail

Key findings

  • Same servers work manually: npx -y figma-developer-mcp --stdio ✅
  • Same servers work in ~/.kiro/settings/mcp.json (local config) ✅
  • Same registry works in Kiro IDE ✅
  • Explicit registryBaseUrl: https://registry.npmjs.org → same failure
  • Log: worker quit with fatal: unexpected server response: expect initialized, accepted

Environment

  • macOS (Apple Silicon)
  • Kiro CLI
  • npx 11.9.0

juanluisbujeda avatar Apr 08 '26 22:04 juanluisbujeda

🤖 Potential Duplicate Detected

This issue appears to be similar to:

What happens next?

  • ⏰ This issue will be automatically closed in 3 days
  • 🏷️ If this is not a duplicate, you can prevent automatic closure by adding a comment or reacting with 👎 to this message.
  • 💬 Comment on the original issue if you have additional information

Why is this marked as duplicate? Both report MCP servers failing to load in Kiro CLI with connection/initialization errors after updates, with similar error patterns and timing

github-actions[bot] avatar Apr 08 '26 22:04 github-actions[bot]

Additional trace-level logs from Kiro CLI

Environment: macOS (Apple Silicon), Kiro CLI v1.29.5, IAM Identity Center (SSO), npx 11.9.0

Registry loads correctly

The registry is fetched and parsed without issues:

DEBUG chat_cli::mcp_registry: Loaded registry server: atlassian-mcp-server DEBUG chat_cli::cli::chat::tool_manager: ToolManager processed 1 MCP servers for runtime use (registry mode: true)

Process spawns but dies in ~370ms

Three pipes are registered (stdin/stdout/stderr) then immediately deregistered:

TRACE mio::poll: registering event source with poller (x3) ... 370ms later ... TRACE mio::poll: deregistering event source from poller (x3) ERROR chat_cli::cli::chat::tool_manager: Error loading server atlassian-mcp-server: McpError(ErrorData { code: ErrorCode(-32002), message: "connection closed: initialize response", data: None })

No spawn command logged

Even at TRACE level, there is no log of what command/args Kiro CLI constructs from the registry JSON to spawn the process. This makes debugging impossible from the user side.

Registry mode blocks all local servers

All servers from ~/.kiro/settings/mcp.json are ignored:

DEBUG chat_cli::mcp_registry: Registry mode: ignoring server 'playwright' (not in registry) DEBUG chat_cli::mcp_registry: Registry mode: ignoring server 'figma' (not in registry) DEBUG chat_cli::mcp_registry: Registry mode: ignoring server 'atlassian' (not in registry)

Tested configurations (all fail identically in CLI)

  • figma-developer-mcp (npm, stdio) with env vars
  • @modelcontextprotocol/server-brave-search (npm, stdio) - canonical example from docs
  • mcp-remote (npm, stdio) with packageArguments
  • Remote streamable-http server
  • With/without explicit registryBaseUrl: https://registry.npmjs.org

Manual execution works perfectly

bash $ echo '{"jsonrpc":"2.0","id":1,"method":"initialize",...}' | npx -y figma-developer-mcp --stdio {"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{"listChanged":true}},"serverInfo":{"name":"Figma MCP Server","version":"0.8.1"}},"jsonrpc":"2.0","id":1}

Same registry works in Kiro IDE

The exact same registry URL (https://mcpregistry.alerce.cloud/registry.json) works correctly in Kiro IDE - servers load and tools are available.

juanluisbujeda avatar Apr 08 '26 23:04 juanluisbujeda

Thank you for your feedback! 🙏

The duplicate label has been removed and this issue has been sent back for maintainer review.

A maintainer will review this issue shortly.

github-actions[bot] avatar Apr 08 '26 23:04 github-actions[bot]

This is NOT a duplicate of #5452. That issue was about SSE content-type errors in v1.25.0.

This issue is specifically about MCP Registry servers (stdio/npm packages) failing to spawn in Kiro CLI while working perfectly in Kiro IDE with the same registry URL.

Key differences:

  • #5452: SSE transport, content-type parsing error, v1.25.0
  • This issue: stdio transport (npm packages), process dies in 0.0s, v1.29.5, registry mode specific
  • Same registry URL works in Kiro IDE
  • Same packages work when configured locally in mcp.json (without registry)
  • Manual npx execution works perfectly
  • Tested with canonical example from docs (@modelcontextprotocol/server-brave-search) - same failure
  • Trace logs show process spawns but dies immediately, no command logged even at TRACE level

juanluisbujeda avatar Apr 08 '26 23:04 juanluisbujeda

Registry example

{
  "servers": [
    {
      "server": {
        "name": "playwright-mcp",
        "description": "Browser automation",
        "version": "1.0.0",
        "packages": [{
          "registryType": "npm",
          "identifier": "@playwright/mcp@latest",
          "transport": { "type": "stdio" }
        }]
      }
    },
    {
      "server": {
        "name": "atlassian-mcp",
        "description": "Atlassian integration",
        "version": "1.0.1",
        "packages": [{
          "registryType": "pypi",
          "identifier": "atlassian-mcp",
          "transport": { "type": "stdio" }
        }]
      }
    }
  ]
}

Log evidence (KIRO_LOG_LEVEL=trace)

The acp process loads the registry servers but launches none:

INFO agent::agent: MCP server initialization finished launched_servers=[] failed_servers=[]

When the TUI later triggers an agent swap, it tries to load them and fails immediately:

WARN chat_cli::cli::chat::tool_manager: MCP server playwright-mcp did not initialize, aborting
WARN chat_cli::cli::chat::tool_manager: MCP server bamboo did not initialize, aborting
ERROR chat_cli::cli::chat::tool_manager: Error loading server playwright-mcp: McpError(ErrorData { code: ErrorCode(-32002), message: "connection closed: initialize response", data: None })

No npx or npm exec process is ever spawned (verified with ps monitoring during startup).

What works

Type Server Kiro IDE Kiro CLI
pypi atlassian-mcp ✅ ✅
remote (HTTP) datadog ✅ ✅
npm playwright-mcp ✅ ❌
npm bamboo ✅ ❌

Expected behavior

Kiro CLI should spawn npx -y <identifier> for registryType: "npm" packages, the same way Kiro IDE does.

Additional context

  • The same npm servers work in Kiro CLI when configured directly in ~/.kiro/settings/mcp.json (local config, not registry)
  • Kiro CLI uses rmcp (Rust MCP SDK) for transport — the issue is in the chat_cli::mcp_registry layer that translates registry definitions to executable commands

juanluisbujeda avatar Apr 15 '26 21:04 juanluisbujeda

I can confirm this issue with the Atlassian MCP server using a custom MCP registry. Registry config (mcp-registry.json):

json
{
  "servers": [
    {
      "server": {
        "name": "atlassian",
        "title": "Atlassian Rovo MCP Server",
        "description": "Search, create, and update Jira issues, Confluence pages, and Compass components",
        "version": "1.0.0",
        "remotes": [{
          "type": "streamable-http",
          "url": "https://mcp.atlassian.com/v1/mcp"
        }]
      }
    }
  ]
}

Behavior:

Server Kiro IDE Kiro CLI
atlassian (remote/streamable-http) ✅ Works ❌ Fails

CLI Error: /mcp

atlassian ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ [2026:16:12]: ✗ atlassian has failed to load after 0.0 s

  • Mcp error: -32002: missing field scopes at line 4 column 1
  • run with KIRO_LOG_LEVEL=trace and see $TMPDIR/kiro-log/kiro-chat.log for detail

Steps to reproduce:

  1. Host the above mcp-registry.json at a URL
  2. /mcp add → ✓ atlassian added
  3. Run /mcp — atlassian fails

Observation: Remote servers using streamable-http transport fail in CLI but work in IDE.

akhilkondappa avatar Apr 22 '26 11:04 akhilkondappa

for the npm/pypi server issue, the workaround is to remove the version tag from package identifier, so "@playwright/mcp" instead of "@playwright/mcp@latest" while we release the fix in CLI

zixlin7 avatar May 01 '26 17:05 zixlin7

MCP Registry: missing field 'scopes' — Root Cause with Trace Logs

Kiro CLI version: 2.3.0 OS: macOS (Apple Silicon) Kiro IDE: Same registry works correctly


Minimal Reproduction Registry

{
  "servers": [
    {
      "server": {
        "name": "atlassian",
        "title": "Atlassian Rovo MCP Server",
        "description": "Jira and Confluence via OAuth",
        "version": "1.0.0",
        "remotes": [
          {
            "type": "streamable-http",
            "url": "https://mcp.atlassian.com/v1/mcp"
          }
        ]
      }
    }
  ]
}

In Kiro IDE, this same registry JSON works correctly — it triggers browser-based OAuth authentication and connects successfully with all tools loaded.


Trace Logs (Relevant Section)

Captured with:

KIRO_LOG_LEVEL=chat_cli=trace,chat_cli_v2=trace,agent=trace \
KIRO_LOG_NO_COLOR=1 \
KIRO_CHAT_LOG_FILE=debug.txt \
kiro-cli --tui
12:07:00.482 DEBUG mcp_registry: Fetched and validated 1 servers from registry
12:07:53.361 DEBUG mcp_registry: Resolved 1 registry servers for agent config: ["atlassian"]
12:07:53.365 DEBUG agent::mcp: LaunchServer { server_name: "atlassian", config: Remote(RemoteMcpServerConfig { url: "https://mcp.atlassian.com/v1/mcp", oauth_scopes: [], oauth: None }) }
12:07:53.367  INFO agent::mcp::oauth_util: ## mcp: attempting unauthenticated http for atlassian
12:07:55.077  INFO agent::mcp::oauth_util: ## mcp: unauthenticated http failed for atlassian: AuthRequired(AuthRequiredError { www_authenticate_header: "Bearer realm=\"OAuth\", error=\"invalid_token\", error_description=\"Missing or invalid access token\"" }), trying authenticated
12:07:55.082 DEBUG agent: received result from LaunchServer name="atlassian" res=Ok(Err(Custom("missing field `scopes` at line 4 column 1")))
12:07:55.082 ERROR agent: failed to launch MCP server name="atlassian" err=Custom("missing field `scopes` at line 4 column 1")

Root Cause

After the unauthenticated HTTP request fails (expected since Atlassian requires OAuth), Kiro CLI fetches the OAuth Authorization Server metadata:

curl -s "https://mcp.atlassian.com/.well-known/oauth-authorization-server" | python3 -m json.tool

Response:

{
  "issuer": "https://cf.mcp.atlassian.com",
  "authorization_endpoint": "https://mcp.atlassian.com/v1/authorize",
  "token_endpoint": "https://cf.mcp.atlassian.com/v1/token",
  "registration_endpoint": "https://cf.mcp.atlassian.com/v1/register",
  "response_types_supported": ["code"],
  "response_modes_supported": ["query"],
  "grant_types_supported": ["authorization_code", "refresh_token"],
  "token_endpoint_auth_methods_supported": ["client_secret_basic", "client_secret_post", "none"],
  "revocation_endpoint": "https://cf.mcp.atlassian.com/v1/token",
  "code_challenge_methods_supported": ["plain", "S256"]
}

The response does not contain a scopes or scopes_supported field.

Kiro CLI appears to treat scopes as required and fails with:

missing field `scopes` at line 4 column 1

Additional Notes

  • Adding oauth.oauthScopes to the registry JSON (as suggested in the CLI 2.3.0 release notes) does not fix the issue.

Tested with:

{
  "servers": [
    {
      "server": {
        "name": "atlassian",
        "title": "Atlassian Rovo MCP Server",
        "description": "Jira and Confluence via OAuth",
        "version": "1.0.0",
        "remotes": [
          {
            "type": "streamable-http",
            "url": "https://mcp.atlassian.com/v1/mcp"
          }
        ],
        "oauth": {
          "oauthScopes": ["read:jira-work", "write:jira-work"]
        }
      }
    }
  ]
}

but the trace logs still show:

oauth_scopes: [], oauth: None

in the LaunchServer config, which suggests the registry OAuth block is ignored entirely.

  • The exact same registry JSON works correctly in Kiro IDE and successfully launches the browser OAuth flow.

akhilkondappa avatar May 13 '26 12:05 akhilkondappa

Similar issue.

kiro 1.0.395 x64
kiro-cli 2.20.1

As a Kiro admin, I have MCP enabled in Kiro's console and I also have the mcp-registry.json accessible via https. The mcp-registry.json has only one MCP server listed, for simplicity.

{
  "servers": [
    {
      "server": {
        "name": "awslabs.aws-documentation-mcp-server",
        "title": "AWS Documentation",
        "description": "Search and read official AWS documentation, and find related pages.",
        "version": "1.2.0",
        "packages": [
          {
            "registryType": "pypi",
            "identifier": "awslabs.aws-documentation-mcp-server",
            "transport": { "type": "stdio" },
            "environmentVariables": [
              { "name": "FASTMCP_LOG_LEVEL", "value": "ERROR" },
              { "name": "AWS_DOCUMENTATION_PARTITION", "value": "aws" }
            ]
          }
        ]
      }
    }
  ]
}

In the IDE, I can add this MCP server based on what I have in the MCP registry URL. I have set only the global mcp configuration at ~/.kiro/settings/mcp.json  and it contains the following:

{
  "mcpServers": {
    "awslabs.aws-documentation-mcp-server": {
      "type": "registry",
      "disabled": false
    }
  }
}

However, the kiro-cli  is having another behavior with the same IAM Identity Center user that I used to log in the IDE.

$ kiro-cli mcp list
❌ Failed to fetch registry data: Failed to fetch MCP registry: HTTP 403 Forbidden
Registry contains invalid data. Contact your administrator.

$ kiro-cli mcp add --name awslabs.aws-documentation-mcp-server
❌ Failed to fetch registry data: Failed to fetch MCP registry: HTTP 403 Forbidden
Registry contains invalid data. Contact your administrator.

When I run it with /mcp list, it shows: "0 configured servers, 0 registry servers".

It works with CLI v3.

diegoaugusto avatar Sep 02 '26 07:09 diegoaugusto