Skip to content

Refine mcp server configuration type #120

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ You can configure OpenCode using environment variables:

```json
{
"$schema": "https://raw.githubusercontent.com/opencode-ai/opencode/main/opencode-schema.json",
"data": {
"directory": ".opencode"
},
Expand Down
89 changes: 58 additions & 31 deletions opencode-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,44 +260,71 @@
"additionalProperties": {
"description": "MCP server configuration",
"properties": {
"args": {
"description": "Command arguments for the MCP server",
"items": {
"type": "string"
},
"type": "array"
},
"command": {
"description": "Command to execute for the MCP server",
"type": "string"
},
"env": {
"description": "Environment variables for the MCP server",
"items": {
"type": "string"
},
"type": "array"
},
"headers": {
"additionalProperties": {
"type": "string"
},
"description": "HTTP headers for SSE type MCP servers",
"type": "object"
},
"type": {
"default": "stdio",
"description": "Type of MCP server",
"enum": ["stdio", "sse"],
"type": "string"
},
"url": {
"description": "URL for SSE type MCP servers",
"type": "string"
}
},
"required": ["command"],
"type": "object"
"oneOf": [
{
"title": "Stdio MCP Server",
"description": "Configuration for an MCP server communicating via standard I/O",
"properties": {
"type": {
"description": "Type of MCP server",
"const": "stdio"
},
"command": {
"description": "Command to execute for the MCP server",
"type": "string"
},
"args": {
"description": "Command arguments for the MCP server",
"items": {
"type": "string"
},
"type": "array"
},
"env": {
"description": "Environment variables for the MCP server",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": ["command"],
"type": "object",
"additionalProperties": false
},
{
"title": "SSE MCP Server",
"description": "Configuration for an MCP server communicating via Server-Sent Events (SSE)",
"properties": {
"type": {
"description": "Type of MCP server",
"const": "sse"
},
"url": {
"description": "URL for the SSE endpoint",
"type": "string",
"format": "uri"
},
"headers": {
"description": "Optional HTTP headers to send with the SSE request",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": ["url"],
"type": "object",
"additionalProperties": false
}
]
},
"description": "Model Control Protocol server configurations",
"type": "object"
Expand Down