Skip to content

Conversation

@kiloconnect
Copy link
Contributor

@kiloconnect kiloconnect bot commented Feb 11, 2026

Problem

The MCP migrator at packages/opencode/src/kilocode/mcp-migrator.ts only handled stdio/local MCP servers. When a user configured a remote streamable-http or sse MCP server in .kilocode/mcp_settings.json:

{
  "mcpServers": {
    "local-mcp": {
      "type": "streamable-http",
      "url": "http://localhost:4321/mcp"
    }
  }
}

It failed with: The "file" argument must be of type string. Received undefined

This happened because convertServer() always assumed local servers, building a command array from server.command — which is undefined for remote servers.

Solution

Updated mcp-migrator.ts to detect remote transport types (streamable-http, sse) and convert them to Config.McpRemote (type: "remote") instead of always producing Config.McpLocal.

Changes

packages/opencode/src/kilocode/mcp-migrator.ts:

  • Added REMOTE_TYPES set and isRemote() helper to detect remote server configs
  • Updated convertServer() to branch on remote vs local servers
  • Remote servers map to { type: "remote", url, headers? } (matching Config.McpRemote)
  • Made command optional in KilocodeMcpServer interface since remote servers don't have it
  • Existing stdio/local server migration is unchanged

packages/opencode/test/kilocode/mcp-migrator.test.ts:

  • Added 11 new tests covering:
    • streamable-http server conversion
    • sse server conversion
    • Remote servers with headers/auth
    • Disabled remote servers
    • Empty/missing headers handling
    • Mixed stdio + remote server migration
    • End-to-end migration via migrate() for all remote scenarios

Test Results

All 27 tests pass (20 existing + 7 new remote-specific tests via migrate() + 4 new convertServer unit tests):

 27 pass
 0 fail
 50 expect() calls

Built for Marius Wichtner by Kilo for Slack

The MCP migrator only handled stdio/local MCP servers. When a user
configured a remote streamable-http or sse MCP server in
.kilocode/mcp_settings.json, it failed with:
  The "file" argument must be of type string. Received undefined

This happened because convertServer() always assumed local servers,
building a command array from server.command (which is undefined for
remote servers).

Changes:
- Add remote transport type detection (streamable-http, sse)
- Convert remote servers to Config.McpRemote (type: "remote")
- Pass through url and headers fields
- Make command optional in KilocodeMcpServer interface
- Add comprehensive tests for remote server migration
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@kiloconnect
Copy link
Contributor Author

kiloconnect bot commented Feb 11, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/mcp-migrator.ts 54 convertServer() skips invalid servers (e.g., missing url/command) without recording them in MigrationResult.skipped
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (2 files)
  • packages/opencode/src/kilocode/mcp-migrator.ts - 1 issue
  • packages/opencode/test/kilocode/mcp-migrator.test.ts - 0 issues

Add guard clauses for missing url on remote servers and missing command
on local servers instead of using non-null assertions that could crash
on malformed config files.
@marius-kilocode marius-kilocode enabled auto-merge (squash) February 12, 2026 08:14
@marius-kilocode marius-kilocode merged commit 3e3385f into dev Feb 12, 2026
7 checks passed
@marius-kilocode marius-kilocode deleted the session/agent_e1ed26e3-9a3d-4bc7-a45c-a0fc8d154116 branch February 12, 2026 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants