创建 MCP 服务器
curl --request POST \
--url 'https://api.flashcat.cloud/safari/mcp/server/create?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"server_name": "prometheus",
"description": "Query Prometheus metrics and alerts.",
"transport": "streamable-http",
"url": "https://mcp.example.com/prometheus",
"headers": {
"Authorization": "Bearer example-token-f2c1"
},
"status": "enabled"
}
'import requests
url = "https://api.flashcat.cloud/safari/mcp/server/create?app_key="
payload = {
"server_name": "prometheus",
"description": "Query Prometheus metrics and alerts.",
"transport": "streamable-http",
"url": "https://mcp.example.com/prometheus",
"headers": { "Authorization": "Bearer example-token-f2c1" },
"status": "enabled"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
server_name: 'prometheus',
description: 'Query Prometheus metrics and alerts.',
transport: 'streamable-http',
url: 'https://mcp.example.com/prometheus',
headers: {Authorization: 'Bearer example-token-f2c1'},
status: 'enabled'
})
};
fetch('https://api.flashcat.cloud/safari/mcp/server/create?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/safari/mcp/server/create?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'server_name' => 'prometheus',
'description' => 'Query Prometheus metrics and alerts.',
'transport' => 'streamable-http',
'url' => 'https://mcp.example.com/prometheus',
'headers' => [
'Authorization' => 'Bearer example-token-f2c1'
],
'status' => 'enabled'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/safari/mcp/server/create?app_key="
payload := strings.NewReader("{\n \"server_name\": \"prometheus\",\n \"description\": \"Query Prometheus metrics and alerts.\",\n \"transport\": \"streamable-http\",\n \"url\": \"https://mcp.example.com/prometheus\",\n \"headers\": {\n \"Authorization\": \"Bearer example-token-f2c1\"\n },\n \"status\": \"enabled\"\n}")
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/safari/mcp/server/create?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"server_name\": \"prometheus\",\n \"description\": \"Query Prometheus metrics and alerts.\",\n \"transport\": \"streamable-http\",\n \"url\": \"https://mcp.example.com/prometheus\",\n \"headers\": {\n \"Authorization\": \"Bearer example-token-f2c1\"\n },\n \"status\": \"enabled\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/mcp/server/create?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"server_name\": \"prometheus\",\n \"description\": \"Query Prometheus metrics and alerts.\",\n \"transport\": \"streamable-http\",\n \"url\": \"https://mcp.example.com/prometheus\",\n \"headers\": {\n \"Authorization\": \"Bearer example-token-f2c1\"\n },\n \"status\": \"enabled\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
"account_id": 10023,
"team_id": 0,
"can_edit": true,
"environments": [],
"server_name": "prometheus",
"description": "Query Prometheus metrics and alerts.",
"transport": "streamable-http",
"url": "https://mcp.example.com/prometheus",
"headers": {
"Authorization": "Bear****f2c1"
},
"status": "enabled",
"connect_timeout": 0,
"call_timeout": 0,
"auth_mode": "shared",
"created_by": 80011,
"created_at": 1716960000000,
"updated_at": 1716960000000
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}MCP 服务器
创建 MCP 服务器
在账户下注册新的 MCP 服务器(连接器)。
POST
/
safari
/
mcp
/
server
/
create
创建 MCP 服务器
curl --request POST \
--url 'https://api.flashcat.cloud/safari/mcp/server/create?app_key=' \
--header 'Content-Type: application/json' \
--data '
{
"server_name": "prometheus",
"description": "Query Prometheus metrics and alerts.",
"transport": "streamable-http",
"url": "https://mcp.example.com/prometheus",
"headers": {
"Authorization": "Bearer example-token-f2c1"
},
"status": "enabled"
}
'import requests
url = "https://api.flashcat.cloud/safari/mcp/server/create?app_key="
payload = {
"server_name": "prometheus",
"description": "Query Prometheus metrics and alerts.",
"transport": "streamable-http",
"url": "https://mcp.example.com/prometheus",
"headers": { "Authorization": "Bearer example-token-f2c1" },
"status": "enabled"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
server_name: 'prometheus',
description: 'Query Prometheus metrics and alerts.',
transport: 'streamable-http',
url: 'https://mcp.example.com/prometheus',
headers: {Authorization: 'Bearer example-token-f2c1'},
status: 'enabled'
})
};
fetch('https://api.flashcat.cloud/safari/mcp/server/create?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/safari/mcp/server/create?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'server_name' => 'prometheus',
'description' => 'Query Prometheus metrics and alerts.',
'transport' => 'streamable-http',
'url' => 'https://mcp.example.com/prometheus',
'headers' => [
'Authorization' => 'Bearer example-token-f2c1'
],
'status' => 'enabled'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/safari/mcp/server/create?app_key="
payload := strings.NewReader("{\n \"server_name\": \"prometheus\",\n \"description\": \"Query Prometheus metrics and alerts.\",\n \"transport\": \"streamable-http\",\n \"url\": \"https://mcp.example.com/prometheus\",\n \"headers\": {\n \"Authorization\": \"Bearer example-token-f2c1\"\n },\n \"status\": \"enabled\"\n}")
req, _ := http.NewRequest("POST", 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))
}HttpResponse<String> response = Unirest.post("https://api.flashcat.cloud/safari/mcp/server/create?app_key=")
.header("Content-Type", "application/json")
.body("{\n \"server_name\": \"prometheus\",\n \"description\": \"Query Prometheus metrics and alerts.\",\n \"transport\": \"streamable-http\",\n \"url\": \"https://mcp.example.com/prometheus\",\n \"headers\": {\n \"Authorization\": \"Bearer example-token-f2c1\"\n },\n \"status\": \"enabled\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/mcp/server/create?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"server_name\": \"prometheus\",\n \"description\": \"Query Prometheus metrics and alerts.\",\n \"transport\": \"streamable-http\",\n \"url\": \"https://mcp.example.com/prometheus\",\n \"headers\": {\n \"Authorization\": \"Bearer example-token-f2c1\"\n },\n \"status\": \"enabled\"\n}"
response = http.request(request)
puts response.read_body{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"data": {
"server_id": "mcp_4kP9wQ2nLceRtY7uVb3xA1",
"account_id": 10023,
"team_id": 0,
"can_edit": true,
"environments": [],
"server_name": "prometheus",
"description": "Query Prometheus metrics and alerts.",
"transport": "streamable-http",
"url": "https://mcp.example.com/prometheus",
"headers": {
"Authorization": "Bear****f2c1"
},
"status": "enabled",
"connect_timeout": 0,
"call_timeout": 0,
"auth_mode": "shared",
"created_by": 80011,
"created_at": 1716960000000,
"updated_at": 1716960000000
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 300 次/分钟;20 次/秒 |
| 权限要求 | MCP 管理(ai-sre) |
使用说明
command/args/env用于stdio;url/headers用于sse/streamable-http。server_name必须以字母开头,只能包含字母、数字、-或_,且在其作用域(账户级或单个团队)内唯一;违反时返回InvalidParameter。- 未传
source_template_name时,创建到团队(team_id > 0)要求调用者属于该团队,只有账户 owner 或管理员可以在账户级(team_id=0)创建。 - 传入
source_template_name表示安装市场模板:模板必须存在(否则返回ResourceNotFound),team_id被忽略、服务器一律建在账户级,且连接字段必须与模板一致,只能填写模板声明的参数值。若模板为按人认证、且其参数允许安装者决定目标主机,则仅账户 owner 或管理员可安装。 environments的每一项必须是cloud,或某个账户级 BYOC Runner、调用者所属团队的 BYOC Runner 的环境 ID;重复项会被去除,空字符串会被拒绝。省略或为空表示所有环境。per_user_secret认证模式要求secret_schema为合法 JSON 且包含非空的header_name。env与headers中,键名包含KEY、SECRET、TOKEN、PASSWORD、PASSWD、CREDENTIAL或AUTHORIZATION(不区分大小写)、或含PWD/PASS分段的值,以及已加密存储的值,会加密存储并在响应中脱敏。- 响应为已保存的服务器。之后服务端会通过已在线的执行环境在后台拉取其工具列表,调用不会等待该过程。
- 每次调用都会记录到账户审计日志。
授权
请求体
application/json
新建 MCP 服务器的配置。
凭据由谁提供:
shared(默认,空值等同):使用保存在服务器上的一份凭据(env/headers),所有调用者共用。per_user_secret:每位用户各自保存密钥,放在secret_schema.header_name指定的请求头中发送。per_user_oauth:每位用户各自完成 OAuth 授权,首次使用时完成发现与客户端注册。
per_user_secret 要求 secret_schema 带非空的 header_name;其他取值返回 InvalidParameter。
可用选项:
shared, per_user_secret, per_user_oauth 响应
成功
所有 Flashduty 公开 API 共用的标准响应结构。成功时 data 为接口专属载荷且不含 error;失败时 error 存在而 data 缺失。request_id 始终存在,并会同步写入 Flashcat-Request-Id 响应头。
此页面对您有帮助吗?