modelcontextprotocol / modelcontextprotocol/modelcontextprotocol
Define a Standard MCP Configuration Schema
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- TypeScript
- Star
- 9.3k
- Fork
- 1.8k
- Merge trung bình
- 1 ngày 12 giờ
- Pull request đã merge (30 ngày)
- 25
Mô tả
Is your feature request related to a problem? Please describe.
I'm developing an MCP host. Existing MCP hosts read their configuration from a config JSON file, but I couldn’t find a standard configuration schema.
Currently, each implementation appears to handle configuration independently in some popular projects/products. There are concerns with this situation from multiple perspectives:
From the MCP host implementer's perspective:
Each implementation has its own design and validation mechanism. As new requirements—such as additional validation rules or authentication methods—arise, implementers must address these changes on a case-by-case basis. This fragmentation increases maintenance overhead and complicates keeping up with evolving specifications.
From the end-user's perspective:
Configuration options differ across products. Users must consult various product documents to understand each specific implementation's requirements, and if multiple products are used, configurations may vary (with different setting names). This inconsistency negatively impacts the user experience.
Here are some implementations in popular projects/products:
-
Claude Desktop:
[Quickstart for Claude Desktop](https://modelcontextprotocol.io/quickstart/user)
Example configuration locations:- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Desktop", "/Users/username/Downloads" ] } } }This configuration is minimal but no documentation for transport types like
stdinorsse. - macOS:
-
VSCode's GitHub Copilot:
[MCP Servers Documentation](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server){ // 💡 Inputs are prompted on first server start, then stored securely by VS Code. "inputs": [ { "type": "promptString", "id": "perplexity-key", "description": "Perplexity API Key", "password": true } ], "servers": { // https://github.com/ppl-ai/modelcontextprotocol/ "Perplexity": { "type": "stdio", "command": "npx", "args": ["-y", "@modelcontextprotocol/server-perplexity-ask"], "env": { "PERPLEXITY_API_KEY": "${input:perplexity-key}" } } } }The
inputsfield is more advanced—it defines how to obtain authentication information and pass it to the command. Also, GitHub Copilot can readclaude_desktop_config.json:VS Code can automatically detect and reuse MCP servers defined in other tools, such as Claude Desktop. Enable auto-discovery with the
chat.mcp.discovery.enabledsetting. -
Cline:
The schema is defined using Zod.
[Cline's MCP Schema in McpHub.ts](https://github.com/cline/cline/blob/807a4b36dfe14a18a3e6a0dc39e05594e2fbff4c/src/services/mcp/McpHub.ts#L48-L72)const AutoApproveSchema = z.array(z.string()).default([]) const BaseConfigSchema = z.object({ autoApprove: AutoApproveSchema.optional(), disabled: z.boolean().optional(), timeout: z.number().min(MIN_MCP_TIMEOUT_SECONDS).optional().default(DEFAULT_MCP_TIMEOUT_SECONDS), }) const SseConfigSchema = BaseConfigSchema.extend({ url: z.string().url(), }).transform((config) => ({ ...config, transportType: "sse" as const, })) const StdioConfigSchema = BaseConfigSchema.extend({ command: z.string(), args: z.array(z.string()).optional(), env: z.record(z.string()).optional(), }).transform((config) => ({ ...config, transportType: "stdio" as const, })) const ServerConfigSchema = z.union([StdioConfigSchema, SseConfigSchema]) const McpSettingsSchema = z.object({ mcpServers: z.record(ServerConfigSchema), })Cline extends the schema with additional properties like
autoApproveanddisabled. It usestransportTypeto indicate whether the configuration is forstdinorsse, whereas GitHub Copilot uses a property calledtype. -
Continue:
[Continue MCP Documentation](https://docs.continue.dev/customize/deep-dives/mcp){ "experimental": { "modelContextProtocolServers": [ { "transport": { "type": "stdio", "command": "uvx", "args": ["mcp-server-sqlite", "--db-path", "/Users/NAME/test.db"] } } ] } }
Describe the solution you'd like
Define a standard MCP configuration schema. I propose using JSON Schema because it is language-independent and is already employed in MCP (e.g., in the ListTools response).
Here is an example of a server schema.
{
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["stdio", "sse"]
},
"command": {
"type": "string"
},
"args": {
"type": "array",
"items": { "type": "string" }
},
"env": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"url": {
"type": "string",
"format": "uri"
}
}
}
While this is merely a basic schema common to all current implementations, defining it could provide a base for future enhancements such as various authentication methods and other transport-specific configurations(e.g. the input field in GitHub Copilot)
Describe alternatives you've considered
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách so sánh các cấu hình Claude Desktop, VS Code, Cline và Continue được liên kết trong issue, sau đó đọc cuộc thảo luận gồm 23 bình luận về các yêu cầu vận chuyển và xác thực chưa được giải quyết. Công việc được xem là hoàn thành khi dự án có một JSON Schema đã được thống nhất và ghi lại tài liệu cho cấu hình máy chủ MCP, giải quyết các khác biệt đã xác định và các phần mở rộng trong tương lai.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Lĩnh vực
- backend-api-design
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100