Skip to main content
POST
/
organization
/
mcp-servers
Python
import os
from datagrid_ai import Datagrid

client = Datagrid(
    api_key=os.environ.get("DATAGRID_API_KEY"),  # This is the default and can be omitted
)
mcp_server = client.organization.mcp_servers.create(
    base_url="https://example.com",
    name="name",
)
print(mcp_server.id)
{
  "object": "mcp_server",
  "id": "<string>",
  "name": "<string>",
  "icon_url": "<string>",
  "base_url": "<string>",
  "transport": "<string>",
  "protocol_version": "<string>",
  "authorization_secret_id": "<string>",
  "status": "<string>",
  "metadata": {
    "requires_oauth": true,
    "oauth_configured": true,
    "tool_count": 123,
    "last_synced_at": "<string>"
  },
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}
Registers a new MCP server at teamspace scope. Use this first in the MCP setup flow. Datagrid automatically attempts an initial tool sync after create. Each teamspace can register up to 30 MCP servers. If the limit is reached, the request returns 409 Conflict. Remove an existing server before adding a new one. You can provide auth in either form:
  • authorization_secret_id: reference an existing Datagrid secret
  • authorization: raw Authorization header value (Datagrid stores it as a secret automatically)
If both are sent, authorization takes precedence. Ownership note:
  • authorization creates a Datagrid-managed secret for this MCP server. If you later rotate or clear that value, Datagrid cleans up the previously auto-created secret.
  • authorization_secret_id references an existing secret that you manage. Datagrid uses the reference, but does not delete that secret automatically.
curl -X POST https://api.datagrid.com/v1/organization/mcp-servers \
  -H "Authorization: Bearer $DATAGRID_API_KEY" \
  -H "Datagrid-Teamspace: $DATAGRID_TEAMSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "manhour",
    "base_url": "https://mcp.example.com/mcp",
    "transport": "http",
    "authorization": "Bearer external-api-token"
  }'

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
name
string
required
Maximum string length: 255
base_url
string<uri>
required

The HTTPS URL of the MCP server.

transport
enum<string> | null
default:http
Available options:
http
Maximum string length: 64
icon_url
string | null
Maximum string length: 1024
protocol_version
string | null
Maximum string length: 32
authorization_secret_id
string | null

Secret ID containing the full Authorization header value to use when calling this MCP server.

authorization
string | null

Raw Authorization header value (for example, 'Bearer '). Datagrid stores it as a secret and links it to this server. If both authorization and authorization_secret_id are provided, authorization takes precedence.

Maximum string length: 64000

Response

Created MCP server

object
enum<string>
required
Available options:
mcp_server
id
string
required
name
string
required
icon_url
string | null
required
base_url
string<uri>
required
transport
string
required
protocol_version
string | null
required
authorization_secret_id
string | null
required

Secret ID containing the full Authorization header value used for this registered MCP server.

status
string
required
metadata
object
required

Safe subset of server metadata exposed to API consumers.

created_at
string<date-time>
required
updated_at
string<date-time>
required