Complete MCP OAuth flow
import requests
url = "https://api.datagrid.com/v1/organization/mcp-servers/{server_id}/oauth-callback"
payload = {
"code": "<string>",
"state": "<string>",
"redirect_uri": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', state: '<string>', redirect_uri: '<string>'})
};
fetch('https://api.datagrid.com/v1/organization/mcp-servers/{server_id}/oauth-callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/organization/mcp-servers/{server_id}/oauth-callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"state": "<string>",
"redirect_uri": "<string>"
}
'{
"object": "mcp_oauth_callback",
"oauth_configured": true,
"tools_synced": true,
"message": "<string>"
}{
"status_code": 123,
"error": "mcp_oauth_requires_user_principal",
"message": "<string>",
"retryable": false,
"statusCode": 123,
"mitigation": "<string>",
"details": {}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}MCP Servers - Beta
Complete MCP OAuth flow
Complete an OAuth authorization flow for a registered MCP server by exchanging the authorization code returned from the OAuth provider. Requires a user-scoped API key (dg_live_); service keys (dg_svc_) are rejected with mcp_oauth_requires_user_principal.
POST
/
organization
/
mcp-servers
/
{server_id}
/
oauth-callback
Complete MCP OAuth flow
import requests
url = "https://api.datagrid.com/v1/organization/mcp-servers/{server_id}/oauth-callback"
payload = {
"code": "<string>",
"state": "<string>",
"redirect_uri": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({code: '<string>', state: '<string>', redirect_uri: '<string>'})
};
fetch('https://api.datagrid.com/v1/organization/mcp-servers/{server_id}/oauth-callback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://api.datagrid.com/v1/organization/mcp-servers/{server_id}/oauth-callback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"code": "<string>",
"state": "<string>",
"redirect_uri": "<string>"
}
'{
"object": "mcp_oauth_callback",
"oauth_configured": true,
"tools_synced": true,
"message": "<string>"
}{
"status_code": 123,
"error": "mcp_oauth_requires_user_principal",
"message": "<string>",
"retryable": false,
"statusCode": 123,
"mitigation": "<string>",
"details": {}
}{
"status_code": 123,
"error": "rate_limit_exceeded",
"message": "<string>",
"retryable": true,
"statusCode": 123,
"mitigation": "<string>",
"details": {
"reason": "<string>"
}
}Authorizations
Body
application/json
Response
OAuth flow completed