Agents
Upsert MCP server
Add or update an MCP server configuration
PUT
/
api
/
agents
/
mcp-configs
/
{name}
Upsert MCP server
curl --request PUT \
--url https://{baseUrl}/api/v1/api/agents/mcp-configs/{name} \
--header 'Content-Type: application/json' \
--data '
{
"url": "http://localhost:3000/sse",
"transport": "sse",
"headers": {
"x-oasm-api-key": "sk-..."
},
"disabled": false,
"allowed_tools": [
"tool1",
"tool2"
],
"timeout": 60,
"sse_read_timeout": 300
}
'import requests
url = "https://{baseUrl}/api/v1/api/agents/mcp-configs/{name}"
payload = {
"url": "http://localhost:3000/sse",
"transport": "sse",
"headers": { "x-oasm-api-key": "sk-..." },
"disabled": False,
"allowed_tools": ["tool1", "tool2"],
"timeout": 60,
"sse_read_timeout": 300
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'http://localhost:3000/sse',
transport: 'sse',
headers: {'x-oasm-api-key': 'sk-...'},
disabled: false,
allowed_tools: ['tool1', 'tool2'],
timeout: 60,
sse_read_timeout: 300
})
};
fetch('https://{baseUrl}/api/v1/api/agents/mcp-configs/{name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{baseUrl}/api/v1/api/agents/mcp-configs/{name}"
payload := strings.NewReader("{\n \"url\": \"http://localhost:3000/sse\",\n \"transport\": \"sse\",\n \"headers\": {\n \"x-oasm-api-key\": \"sk-...\"\n },\n \"disabled\": false,\n \"allowed_tools\": [\n \"tool1\",\n \"tool2\"\n ],\n \"timeout\": 60,\n \"sse_read_timeout\": 300\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"name": "my-mcp-server",
"url": "http://localhost:3000/sse",
"transport": "sse",
"headers": {
"x-oasm-api-key": "sk-..."
},
"disabled": false,
"allowed_tools": [
"tool1",
"tool2"
],
"timeout": 60,
"sse_read_timeout": 300
}请求体
application/json
响应
200 - application/json
⌘I
Upsert MCP server
curl --request PUT \
--url https://{baseUrl}/api/v1/api/agents/mcp-configs/{name} \
--header 'Content-Type: application/json' \
--data '
{
"url": "http://localhost:3000/sse",
"transport": "sse",
"headers": {
"x-oasm-api-key": "sk-..."
},
"disabled": false,
"allowed_tools": [
"tool1",
"tool2"
],
"timeout": 60,
"sse_read_timeout": 300
}
'import requests
url = "https://{baseUrl}/api/v1/api/agents/mcp-configs/{name}"
payload = {
"url": "http://localhost:3000/sse",
"transport": "sse",
"headers": { "x-oasm-api-key": "sk-..." },
"disabled": False,
"allowed_tools": ["tool1", "tool2"],
"timeout": 60,
"sse_read_timeout": 300
}
headers = {"Content-Type": "application/json"}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'http://localhost:3000/sse',
transport: 'sse',
headers: {'x-oasm-api-key': 'sk-...'},
disabled: false,
allowed_tools: ['tool1', 'tool2'],
timeout: 60,
sse_read_timeout: 300
})
};
fetch('https://{baseUrl}/api/v1/api/agents/mcp-configs/{name}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{baseUrl}/api/v1/api/agents/mcp-configs/{name}"
payload := strings.NewReader("{\n \"url\": \"http://localhost:3000/sse\",\n \"transport\": \"sse\",\n \"headers\": {\n \"x-oasm-api-key\": \"sk-...\"\n },\n \"disabled\": false,\n \"allowed_tools\": [\n \"tool1\",\n \"tool2\"\n ],\n \"timeout\": 60,\n \"sse_read_timeout\": 300\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"name": "my-mcp-server",
"url": "http://localhost:3000/sse",
"transport": "sse",
"headers": {
"x-oasm-api-key": "sk-..."
},
"disabled": false,
"allowed_tools": [
"tool1",
"tool2"
],
"timeout": 60,
"sse_read_timeout": 300
}