-
Notifications
You must be signed in to change notification settings - Fork 27
feat: support remote MCP server migration (streamable-http, sse) #245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,11 +10,21 @@ export namespace McpMigrator { | |
|
|
||
| // Kilocode MCP server structure | ||
| export interface KilocodeMcpServer { | ||
| command: string | ||
| command?: string | ||
| args?: string[] | ||
| env?: Record<string, string> | ||
| disabled?: boolean | ||
| alwaysAllow?: string[] | ||
| // Remote server fields | ||
| type?: string | ||
| url?: string | ||
| headers?: Record<string, string> | ||
| } | ||
|
|
||
| const REMOTE_TYPES = new Set(["streamable-http", "sse"]) | ||
|
|
||
| function isRemote(server: KilocodeMcpServer): boolean { | ||
| return !!server.url || REMOTE_TYPES.has(server.type ?? "") | ||
| } | ||
|
|
||
| export interface KilocodeMcpSettings { | ||
|
|
@@ -38,10 +48,18 @@ export namespace McpMigrator { | |
| // Skip disabled servers | ||
| if (server.disabled) return null | ||
|
|
||
| // Build command array: [command, ...args] | ||
| const command = [server.command, ...(server.args ?? [])] | ||
| // Remote servers (streamable-http, sse, or any config with a url) | ||
| if (isRemote(server)) { | ||
| const mcpConfig: Config.Mcp = { | ||
| type: "remote", | ||
| url: server.url!, | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CRITICAL: Non-null assertion on
|
||
| ...(server.headers && Object.keys(server.headers).length > 0 && { headers: server.headers }), | ||
| } | ||
| return mcpConfig | ||
| } | ||
|
|
||
| // Build the MCP config object | ||
| // Local/stdio servers | ||
| const command = [server.command!, ...(server.args ?? [])] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WARNING: Non-null assertion on Since |
||
| const mcpConfig: Config.Mcp = { | ||
| type: "local", | ||
| command, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CRITICAL:
isRemote()can classify a server as remote even whenurlis missingIf
server.typeis"streamable-http"/"sse"buturlis absent,convertServer()will still take the remote branch and emit{ type: 'remote', url: undefined }(via non-null assertions), which can break config validation downstream. Consider requiringurlwhentypeindicates remote (or treat missingurlas skipped + warning).