Skip to content

Commit 7c702b9

Browse files
committed
feat: ux changes for mcp http/sse support
1 parent 23fc820 commit 7c702b9

File tree

3 files changed

+26
-8
lines changed

3 files changed

+26
-8
lines changed

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.test.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,22 @@ describe('addServer()', () => {
235235
})
236236

237237
it('persists and initializes an HTTP server', async () => {
238-
loadStub.resolves({ servers: new Map(), serverNameMapping: new Map(), errors: new Map() })
238+
loadStub.resolves({
239+
servers: new Map(),
240+
serverNameMapping: new Map(),
241+
errors: new Map(),
242+
agentConfig: {
243+
name: 'test-agent',
244+
version: '1.0.0',
245+
description: 'Test agent',
246+
mcpServers: {},
247+
tools: [],
248+
allowedTools: [],
249+
toolsSettings: {},
250+
includedFiles: [],
251+
resources: [],
252+
},
253+
})
239254
const mgr = await McpManager.init([], features)
240255

241256
const httpCfg: MCPServerConfig = {

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpManager.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,6 @@ export class McpManager {
633633

634634
// We don't need to store configPath anymore as we're using agent config
635635
const newCfg: MCPServerConfig = { ...cfg, __configPath__: agentPath }
636-
637636
this.mcpServers.set(sanitizedName, newCfg)
638637
this.serverNameMapping.set(sanitizedName, serverName)
639638

server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools/mcp/mcpUtils.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,17 @@ export async function loadAgentConfig(
408408
serverNameMapping.set(sanitizedName, name)
409409

410410
// Add to agent config
411-
agentConfig.mcpServers[name] = {
412-
command: cfg.command,
413-
args: cfg.args,
414-
env: cfg.env,
415-
initializationTimeout: cfg.initializationTimeout,
416-
timeout: cfg.timeout,
411+
const agentEntry: any = {}
412+
if (cfg.command) agentEntry.command = cfg.command
413+
if (cfg.url) agentEntry.url = cfg.url
414+
if (cfg.args && cfg.args.length) agentEntry.args = cfg.args
415+
if (cfg.env && Object.keys(cfg.env).length) agentEntry.env = cfg.env
416+
if (cfg.headers && Object.keys(cfg.headers).length) agentEntry.headers = cfg.headers
417+
if (typeof cfg.initializationTimeout === 'number') {
418+
agentEntry.initializationTimeout = cfg.initializationTimeout
417419
}
420+
if (typeof cfg.timeout === 'number') agentEntry.timeout = cfg.timeout
421+
agentConfig.mcpServers[name] = agentEntry
418422

419423
logging.info(
420424
`Loaded MCP server with sanitizedName: '${sanitizedName}' and originalName: '${name}' from ${fsPath}`

0 commit comments

Comments
 (0)