Skip to main content
TrueFoundry allows you to connect to external Model Context Protocol (MCP) servers that provide tools and capabilities for AI applications. Once Added, these MCP servers can be used in truefoundry AI gateway and your applications. The MCP servers are saved as a provider Integrations in truefoundry. The group of MCP servers are saved as a provider account. You can add multiple MCP servers to a single provider account, the MCP servers in the same provider account are called integrations.
Replace YOUR_CONTROL_PLANE_URL with your actual TrueFoundry control plane URL and YOUR_API_KEY with your API key throughout this guide.

API Overview

Here is the curl command example to add an MCP Server:
curl -X PUT "YOUR_CONTROL_PLANE_URL/api/svc/v1/apply" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "manifest": {
      "type": "provider-account/hosted-mcp-server",
      "name": "my-mcp-server-group",
      "integrations": [
        {
          "type": "integration/mcp-server/hosted-mcp-server",
          "name": "my-mcp-server",
          "description": "A sample MCP server for file operations",
          "url": "https://mcp-server.example.com",
          "auth_data": {
            "type": "header",
            "headers": {
              "Authorization": "Bearer your-token"
            }
          }
        }
      ]
    },
    "dryRun": false
  }'

Request Schema

The Apply API accepts a TrueFoundryApplyRequest object with the following structure:
manifest
McpServerProviderAccount | ModelManifest | ArtifactManifest | Service | ...
required
The manifest object defining the resource to be created or updated. For MCP Server integrations, this should be a McpServerProviderAccount object. See McpServerProviderAccount for the complete schema.
dryRun
boolean
default:"false"
When set to true, performs a dry run without actually creating or updating the resource. Useful for validation.

McpServerProviderAccount Schema

For adding MCP Servers, the manifest should be a McpServerProviderAccount object. For detailed schema information, refer to the McpServerProviderAccount type documentation.

Response Schema

{
  "id": "mcp-provider-account-123",
  "name": "my-mcp-server-group",
  "fqn": "tenant-name/hosted-mcp-server/my-mcp-server-group",
  "provider": "hosted-mcp-server",
  "manifest": {
    "type": "provider-account/hosted-mcp-server",
    "name": "my-mcp-server-group",
    "integrations": [
      {
        "type": "integration/mcp-server/hosted-mcp-server",
        "name": "my-mcp-server",
        "description": "A sample MCP server for file operations",
        "url": "https://mcp-server.example.com",
        "auth_data": {
          "type": "header",
          "headers": {
            "Authorization": "Bearer your-token"
          }
        }
      }
    ]
  },
  "integrations": [
    {
      "id": "integration-456",
      "name": "my-mcp-server",
      "fqn": "tenant-name/hosted-mcp-server/my-mcp-server-group/integration/my-mcp-server",
      "type": "integration",
      "manifest": {
        "type": "integration/mcp-server/hosted-mcp-server",
        "name": "my-mcp-server",
        "description": "A sample MCP server for file operations",
        "url": "https://mcp-server.example.com",
        "auth_data": {
          "type": "header",
          "headers": {
            "Authorization": "Bearer your-token"
          }
        }
      },
      "providerAccountFqn": "tenant-name/hosted-mcp-server/my-mcp-server-group",
      "createdBySubject": {
        "subjectSlug": "user@example.com"
      },
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-01-15T10:30:00Z"
    }
  ],
  "createdBySubject": {
    "subjectSlug": "user@example.com"
  },
  "createdAt": "2024-01-15T10:30:00Z",
  "updatedAt": "2024-01-15T10:30:00Z",
  "action": "CREATE"
}

Response Fields

id
string
Unique identifier for the MCP Server provider account.
name
string
Name of the MCP Server provider account.
fqn
string
Fully qualified name of the provider account (tenant/provider/name).
provider
string
The provider type: “hosted-mcp-server”.
manifest
object
The MCP Server provider account manifest that was applied, excluding integrations.
integrations
array
List of MCP Server integrations associated with this account.
createdBySubject
object
Information about the user who created the provider account.
createdAt
string
Timestamp when the provider account was created.
updatedAt
string
Timestamp when the provider account was last updated.
action
string
The action performed: “CREATE” for new resources, “UPDATE” for existing ones.

MCP Server Provider Account Examples

Error Handling

The API may return various error responses. Common scenarios include:
  • 400 Bad Request: Invalid manifest structure or missing required fields
  • 401 Unauthorized: Invalid or missing API key
  • 403 Forbidden: Insufficient permissions for the operation
  • 404 Not Found: MCP Server provider account not found
  • 409 Conflict: MCP Server provider account with the same name already exists
  • 422 Unprocessable Entity: Invalid MCP Server configuration or connection issues
I