mirror of
https://github.com/nexu-io/open-design.git
synced 2026-06-01 03:14:35 +07:00
Kimi CLI 1.35.0 expects MCP stdio servers to include 'type', 'name', 'command', 'args', and 'env' fields. Open Design was passing only 'name', 'command', and 'args', which caused session/new to return JSON-RPC -32602 Invalid params when MCP discovery was enabled. This change normalizes every MCP server descriptor to the full ACP stdio shape before sending it over the wire.
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
// @ts-nocheck
|
|
import assert from 'node:assert/strict';
|
|
import path from 'node:path';
|
|
import { test } from 'vitest';
|
|
import { buildAcpSessionNewParams } from '../src/acp.js';
|
|
|
|
test('ACP session params do not require MCP servers by default', () => {
|
|
assert.deepEqual(buildAcpSessionNewParams('/tmp/od-project'), {
|
|
cwd: path.resolve('/tmp/od-project'),
|
|
mcpServers: [],
|
|
});
|
|
});
|
|
|
|
test('ACP session params do not request global MCP config mutation', () => {
|
|
const params = buildAcpSessionNewParams('/tmp/od-project');
|
|
|
|
assert.equal('mcpConfigPath' in params, false);
|
|
assert.equal('writeMcpConfig' in params, false);
|
|
assert.equal('installMcpServers' in params, false);
|
|
});
|
|
|
|
test('ACP session params normalize explicit MCP servers to ACP stdio shape', () => {
|
|
const mcpServers = [{ name: 'open-design-live-artifacts', command: 'od', args: ['mcp', 'live-artifacts'] }];
|
|
|
|
assert.deepEqual(buildAcpSessionNewParams('/tmp/od-project', { mcpServers }), {
|
|
cwd: path.resolve('/tmp/od-project'),
|
|
mcpServers: [
|
|
{
|
|
type: 'stdio',
|
|
name: 'open-design-live-artifacts',
|
|
command: 'od',
|
|
args: ['mcp', 'live-artifacts'],
|
|
env: [],
|
|
},
|
|
],
|
|
});
|
|
});
|
|
|
|
test('ACP session params preserve caller-provided type and env fields', () => {
|
|
const mcpServers = [
|
|
{ type: 'http', name: 'http-server', url: 'http://localhost:3000', headers: {}, env: [{ key: 'TOKEN', value: 'secret' }] },
|
|
];
|
|
|
|
const result = buildAcpSessionNewParams('/tmp/od-project', { mcpServers });
|
|
assert.equal(result.mcpServers[0].type, 'http');
|
|
assert.equal(result.mcpServers[0].name, 'http-server');
|
|
assert.deepEqual(result.mcpServers[0].env, [{ key: 'TOKEN', value: 'secret' }]);
|
|
});
|