Skip to content
OpenCode
Esc
navigateopen⌘Jpreview

Add MCP server

Add an MCP server at runtime or replace an existing one, connecting it immediately.

PUT/api/mcp/{server}
Path parameters
serverstringrequired
Query parameters
locationobject | any
Request body
requiredapplication/json
configMcp.LocalConfig | Mcp.RemoteConfigrequired
Show properties
Any of:
Mcp.LocalConfig
typestringrequired
Allowed:local
commandstring[]required
cwdstring | any
Working directory for the MCP server process. Relative paths resolve from the workspace directory.
Show properties
Any of:
string
string
any
any
environmentobject | any
Show properties
Any of:
object
object
any
any
disabledboolean | any
Show properties
Any of:
boolean
boolean
any
any
codemodeboolean | any
Expose this server's tools through Code Mode. Defaults to true.
Show properties
Any of:
boolean
boolean
any
any
timeoutMcp.TimeoutConfig | any
Show properties
Any of:
Mcp.TimeoutConfig
startupobject | any
Maximum time in milliseconds to establish and initialize the MCP server.
Show properties
Any of:
object
object
any
any
catalogobject | any
Maximum time in milliseconds to wait for MCP discovery requests such as tools/list and prompts/list.
Show properties
Any of:
object
object
any
any
executionobject | any
Maximum time in milliseconds to wait for MCP tool and prompt execution.
Show properties
Any of:
object
object
any
any
any
any
Mcp.RemoteConfig
typestringrequired
Allowed:remote
urlstringrequired
headersobject | any
Show properties
Any of:
object
object
any
any
oauthMcp.OAuthConfig | boolean | any
Show properties
Any of:
Mcp.OAuthConfig | boolean
Any of:
Mcp.OAuthConfig
client_idstring | any
Show properties
Any of:
string
string
any
any
client_secretstring | any
Show properties
Any of:
string
string
any
any
scopestring | any
Show properties
Any of:
string
string
any
any
callback_portobject | any
Show properties
Any of:
object
object
any
any
redirect_uristring | any
Show properties
Any of:
string
string
any
any
boolean
boolean
any
any
disabledboolean | any
Show properties
Any of:
boolean
boolean
any
any
codemodeboolean | any
Expose this server's tools through Code Mode. Defaults to true.
Show properties
Any of:
boolean
boolean
any
any
timeoutMcp.TimeoutConfig | any
Show properties
Any of:
Mcp.TimeoutConfig
startupobject | any
Maximum time in milliseconds to establish and initialize the MCP server.
Show properties
Any of:
object
object
any
any
catalogobject | any
Maximum time in milliseconds to wait for MCP discovery requests such as tools/list and prompts/list.
Show properties
Any of:
object
object
any
any
executionobject | any
Maximum time in milliseconds to wait for MCP tool and prompt execution.
Show properties
Any of:
object
object
any
any
any
any
Responses
204<No Content>
400InvalidRequestError
_tagstringrequired
Allowed:InvalidRequestError
messagestringrequired
kindstring | any
Show properties
Any of:
string
string
any
any
fieldstring | any
Show properties
Any of:
string
string
any
any
401UnauthorizedError
_tagstringrequired
Allowed:UnauthorizedError
messagestringrequired
Request
curl -X PUT "/api/mcp/string" \
  -H "Content-Type: application/json" \
  -d '{
  "config": {
    "type": "local",
    "command": [
      "string"
    ],
    "cwd": "string",
    "environment": {},
    "disabled": true,
    "codemode": true,
    "timeout": {
      "startup": {},
      "catalog": {},
      "execution": {}
    }
  }
}'
Response
<No Content>