Integrations
Connect an MCP server
Connects an MCP server so GraphAI and workflows can call its tools. With auth_type none or bearer, CostGraph lists the server’s tools before saving and returns the connection; the token is sent as Authorization: Bearer, or in header_name when set. When the server asks for sign-in instead, the response has sign_in_required and nothing is saved. With auth_type oauth the response has an authorize_url to open; CostGraph registers itself with the server when it allows that, otherwise client_id (and client_secret for a confidential client) are required. Tools the server marks read-only start read-only; every other tool needs approval in workflows. Tokens are never returned.
POST
/
api
/
v1
/
integrations
/
mcp-server
/
connect
Connect an MCP server
curl --request POST \
--url https://api.costgraph.ai/api/v1/integrations/mcp-server/connect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"tenant_id": "<string>",
"url": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"header_name": "<string>",
"token": "<string>"
}
'import requests
url = "https://api.costgraph.ai/api/v1/integrations/mcp-server/connect"
payload = {
"name": "<string>",
"tenant_id": "<string>",
"url": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"header_name": "<string>",
"token": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
tenant_id: '<string>',
url: '<string>',
client_id: '<string>',
client_secret: '<string>',
header_name: '<string>',
token: '<string>'
})
};
fetch('https://api.costgraph.ai/api/v1/integrations/mcp-server/connect', 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.costgraph.ai/api/v1/integrations/mcp-server/connect",
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([
'name' => '<string>',
'tenant_id' => '<string>',
'url' => '<string>',
'client_id' => '<string>',
'client_secret' => '<string>',
'header_name' => '<string>',
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.costgraph.ai/api/v1/integrations/mcp-server/connect"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"url\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"header_name\": \"<string>\",\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.costgraph.ai/api/v1/integrations/mcp-server/connect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"url\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"header_name\": \"<string>\",\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/mcp-server/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"url\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"header_name\": \"<string>\",\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"authorize_url": "<string>",
"server": {
"auth_type": "none",
"connection_id": "<string>",
"created_at": "<string>",
"header_name": "<string>",
"id": "<string>",
"last_error": "<string>",
"name": "<string>",
"slug": "<string>",
"status": "<string>",
"tools": [
{
"description": "<string>",
"enabled": true,
"name": "<string>",
"read_only": true,
"read_only_hint": true
}
],
"updated_at": "<string>",
"url": "<string>",
"workflows_enabled": true
},
"sign_in_required": true
}
}{
"message": "some message",
"status": "success",
"data": {
"authorize_url": "<string>",
"server": {
"auth_type": "none",
"connection_id": "<string>",
"created_at": "<string>",
"header_name": "<string>",
"id": "<string>",
"last_error": "<string>",
"name": "<string>",
"slug": "<string>",
"status": "<string>",
"tools": [
{
"description": "<string>",
"enabled": true,
"name": "<string>",
"read_only": true,
"read_only_hint": true
}
],
"updated_at": "<string>",
"url": "<string>",
"workflows_enabled": true
},
"sign_in_required": true
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}Authorizations
Enter "Bearer {token}"
Body
application/json
MCP server
Was this page helpful?
⌘I
Connect an MCP server
curl --request POST \
--url https://api.costgraph.ai/api/v1/integrations/mcp-server/connect \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"tenant_id": "<string>",
"url": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"header_name": "<string>",
"token": "<string>"
}
'import requests
url = "https://api.costgraph.ai/api/v1/integrations/mcp-server/connect"
payload = {
"name": "<string>",
"tenant_id": "<string>",
"url": "<string>",
"client_id": "<string>",
"client_secret": "<string>",
"header_name": "<string>",
"token": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
tenant_id: '<string>',
url: '<string>',
client_id: '<string>',
client_secret: '<string>',
header_name: '<string>',
token: '<string>'
})
};
fetch('https://api.costgraph.ai/api/v1/integrations/mcp-server/connect', 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.costgraph.ai/api/v1/integrations/mcp-server/connect",
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([
'name' => '<string>',
'tenant_id' => '<string>',
'url' => '<string>',
'client_id' => '<string>',
'client_secret' => '<string>',
'header_name' => '<string>',
'token' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.costgraph.ai/api/v1/integrations/mcp-server/connect"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"url\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"header_name\": \"<string>\",\n \"token\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.costgraph.ai/api/v1/integrations/mcp-server/connect")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"url\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"header_name\": \"<string>\",\n \"token\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.costgraph.ai/api/v1/integrations/mcp-server/connect")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"tenant_id\": \"<string>\",\n \"url\": \"<string>\",\n \"client_id\": \"<string>\",\n \"client_secret\": \"<string>\",\n \"header_name\": \"<string>\",\n \"token\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"message": "some message",
"status": "success",
"data": {
"authorize_url": "<string>",
"server": {
"auth_type": "none",
"connection_id": "<string>",
"created_at": "<string>",
"header_name": "<string>",
"id": "<string>",
"last_error": "<string>",
"name": "<string>",
"slug": "<string>",
"status": "<string>",
"tools": [
{
"description": "<string>",
"enabled": true,
"name": "<string>",
"read_only": true,
"read_only_hint": true
}
],
"updated_at": "<string>",
"url": "<string>",
"workflows_enabled": true
},
"sign_in_required": true
}
}{
"message": "some message",
"status": "success",
"data": {
"authorize_url": "<string>",
"server": {
"auth_type": "none",
"connection_id": "<string>",
"created_at": "<string>",
"header_name": "<string>",
"id": "<string>",
"last_error": "<string>",
"name": "<string>",
"slug": "<string>",
"status": "<string>",
"tools": [
{
"description": "<string>",
"enabled": true,
"name": "<string>",
"read_only": true,
"read_only_hint": true
}
],
"updated_at": "<string>",
"url": "<string>",
"workflows_enabled": true
},
"sign_in_required": true
}
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}{
"message": "some message",
"status": "error"
}