Skip to content

MCP integrations

AI Foundry Hub can connect an approved Model Context Protocol (MCP) provider and expose its tools through a controlled backend API. The Hub handles the provider connection, OAuth flow, tool discovery, user consent, argument validation, and idempotent tool invocation.

MCP integration endpoints are server-to-server only. Never expose the Hub API key or accept X-Integration-Subject directly from browser input. Your backend must derive the subject from its authenticated user session.

Your application must be registered by an AI Foundry Hub operator for the MCP providers it may use. A normal Hub API key is not enough on its own. Every request except the OAuth callback requires:

Authorization: Bearer <registered-server-api-key>
X-Integration-Subject: <opaque-authenticated-user-id>

The subject must be stable for the signed-in user and opaque to the provider. MCP availability and the provider catalogue depend on the Hub environment configuration. When MCP is disabled, GET /v1/integrations returns an empty integrations array.

StepMethod and pathResult
List providersGET /v1/integrationsCatalogue with status, auth mode, and allowed actions
Start connectionPOST /v1/integrations/{provider}/connectionnext_action is authorize or review
Start OAuthPOST /v1/integrations/{provider}/authorizationProvider authorization_url
Review toolsGET /v1/integrations/{provider}/reviewTool snapshot, revision, and snapshot hash
Approve toolsPOST /v1/integrations/{provider}/consentActivates the reviewed snapshot
List active toolsGET /v1/integrations/{provider}/toolsConsented tools and current snapshot hash
Call a toolPOST /v1/integrations/{provider}/callsMCP tool result
RevokeDELETE /v1/integrations/{provider}/connectionRemoves credentials and invalidates pending authorization

Start by listing the catalogue:

Terminal window
curl "https://api.aifoundryhub.com/v1/integrations" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "X-Integration-Subject: $PRODUCT_USER_ID"

Each integration includes status, auth_mode, and an actions array such as connect, review, or revoke. Use only the actions returned by the API.

Terminal window
curl -X POST "https://api.aifoundryhub.com/v1/integrations/atlassian/connection" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "X-Integration-Subject: $PRODUCT_USER_ID"

If the response is {"next_action":"authorize"}, request an authorization URL from /authorization and redirect the user to the returned HTTPS URL. The provider redirects back to the Hub callback; the Hub then redirects to your application’s pre-registered return URL. Do not construct callback or return URLs from request data.

After authorization, retrieve the exact tool snapshot:

Terminal window
curl "https://api.aifoundryhub.com/v1/integrations/atlassian/review" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "X-Integration-Subject: $PRODUCT_USER_ID"

Show the tools to the user, then send the unchanged revision and snapshot_hash back to the consent endpoint:

Terminal window
curl -X POST "https://api.aifoundryhub.com/v1/integrations/atlassian/consent" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "X-Integration-Subject: $PRODUCT_USER_ID" \
-H "Content-Type: application/json" \
-d '{"revision":"<revision>","snapshot_hash":"<snapshot-hash>"}'

A 409 conflict means the connection or tool snapshot changed. Fetch /review again and ask the user to approve the new snapshot.

First call GET /v1/integrations/{provider}/tools. Tool names are namespaced by the Hub, and the response includes the snapshot_hash required for invocation.

Terminal window
curl -X POST "https://api.aifoundryhub.com/v1/integrations/atlassian/calls" \
-H "Authorization: Bearer $AI_FOUNDRY_HUB_API_KEY" \
-H "X-Integration-Subject: $PRODUCT_USER_ID" \
-H "Content-Type: application/json" \
-d '{
"invocation_id": "01JD3EXAMPLESTABLEID",
"snapshot_hash": "<snapshot-hash>",
"tool": "<namespaced-tool-name>",
"arguments": {"query": "project = HUB"},
"expires_at": "<RFC3339 timestamp within five minutes>"
}'

invocation_id must be stable for one product-level attempt, and expires_at must be no more than five minutes in the future. Arguments are validated against the approved tool schema. Do not automatically retry an uncertain provider_unavailable result with a new invocation ID: first make a product-level decision with the user.

HTTP statusErrorMeaning
400invalid_requestMissing/invalid headers, payload, provider, tool, or expired invocation
401unauthorized_clientAPI key is not registered, is expired/revoked, or does not match the registered owner
403needs_setupMCP is not configured for this environment
409conflictConnection state or tool snapshot changed
503provider_unavailableProvider, storage, OAuth, or MCP operation is temporarily unavailable

The Hub never forwards your Hub API key to an MCP provider. Provider credentials and approved tool snapshots are stored per registered application, subject, and provider.