mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 17:27:54 +00:00
improved mcp support, including standard "mcpServers" setting with multiple named servers with command/args/env/cwd (#392)
This commit is contained in:
@@ -20,6 +20,7 @@ import { WriteFileTool } from '../tools/write-file.js';
|
||||
import { WebFetchTool } from '../tools/web-fetch.js';
|
||||
import { ReadManyFilesTool } from '../tools/read-many-files.js';
|
||||
import { BaseTool, ToolResult } from '../tools/tools.js';
|
||||
import { StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
|
||||
|
||||
export class Config {
|
||||
private toolRegistry: ToolRegistry;
|
||||
@@ -35,6 +36,9 @@ export class Config {
|
||||
private readonly toolDiscoveryCommand: string | undefined,
|
||||
private readonly toolCallCommand: string | undefined,
|
||||
private readonly mcpServerCommand: string | undefined,
|
||||
private readonly mcpServers:
|
||||
| Record<string, StdioServerParameters>
|
||||
| undefined,
|
||||
private readonly userAgent: string,
|
||||
private userMemory: string = '', // Made mutable for refresh
|
||||
private geminiMdFileCount: number = 0,
|
||||
@@ -86,6 +90,10 @@ export class Config {
|
||||
return this.mcpServerCommand;
|
||||
}
|
||||
|
||||
getMcpServers(): Record<string, StdioServerParameters> | undefined {
|
||||
return this.mcpServers;
|
||||
}
|
||||
|
||||
getUserAgent(): string {
|
||||
return this.userAgent;
|
||||
}
|
||||
@@ -146,6 +154,7 @@ export function createServerConfig(
|
||||
toolDiscoveryCommand?: string,
|
||||
toolCallCommand?: string,
|
||||
mcpServerCommand?: string,
|
||||
mcpServers?: Record<string, StdioServerParameters>,
|
||||
userAgent?: string,
|
||||
userMemory?: string,
|
||||
geminiMdFileCount?: number,
|
||||
@@ -161,6 +170,7 @@ export function createServerConfig(
|
||||
toolDiscoveryCommand,
|
||||
toolCallCommand,
|
||||
mcpServerCommand,
|
||||
mcpServers,
|
||||
userAgent ?? 'GeminiCLI/unknown', // Default user agent
|
||||
userMemory ?? '',
|
||||
geminiMdFileCount ?? 0,
|
||||
|
||||
Reference in New Issue
Block a user