---
title: "Create MCP server"
method: POST
path: "/functions"
tags: ["functions"]
---

# Create MCP server

`POST /functions`

Creates a new MCP server function deployment. The function will expose tools via the Model Context Protocol that can be used by AI agents. Supports streamable HTTP transport.

## Request body

- Function — MCP server deployment that exposes tools for AI agents via the Model Context Protocol (MCP). Deployed as a serverless auto-scaling endpoint using streamable HTTP transport.
  - `events` CoreEvent[] — Events happening on a resource deployed on Blaxel
    - `canaryRevision` string — Canary revisionID link to the event
    - `message` string — Event message
    - `revision` string — RevisionID link to the event
    - `status` string — Event status
    - `time` string — Event time
    - `type` string — Event type
  - `metadata` Metadata, required — Owner fields for Persistence
    - `createdAt` string — The date and time when the resource was created
    - `updatedAt` string — The date and time when the resource was updated
    - `createdBy` string — The user or service account who created the resource
    - `updatedBy` string — The user or service account who updated the resource
    - `displayName` string — Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
    - `externalId` string — Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
    - `labels` MetadataLabels — Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
    - `name` string, required — Unique identifier for the resource within the workspace. Must be lowercase alphanumeric with hyphens, max 49 characters. Immutable after creation.
    - `plan` string — Billing plan tier applied to this resource (inherited from workspace account)
    - `url` string — Auto-generated endpoint URL for accessing this resource (for agents, functions, models, sandboxes)
    - `workspace` string — Name of the workspace this resource belongs to (read-only, set automatically)
  - `spec` FunctionSpec, required — Configuration for an MCP server function including runtime settings, transport protocol, and connected integrations
    - `enabled` boolean — When false, the function is disabled and will not serve requests
    - `integrationConnections` string[]
    - `policies` string[]
    - `public` boolean — When true, the function is publicly accessible without authentication. Only available for mk3 generation.
    - `region` string — Region where the function should be deployed (e.g. us-pdx-1, eu-lon-1). If not specified, the function is deployed based on policy locations.
    - `revision` RevisionConfiguration — Revision configuration
      - `active` string — Active revision id
      - `canary` string — Canary revision id
      - `canaryPercent` integer — Canary revision percent
      - `stickySessionTtl` integer — Sticky session TTL in seconds (0 = disabled)
      - `traffic` integer — Traffic percentage
    - `runtime` FunctionRuntime — Runtime configuration defining how the MCP server function is deployed and scaled
      - `envs` Env[] — Environment variables injected into the function. Supports Kubernetes EnvVar format with valueFrom references.
        - `name` string — Name of the environment variable
        - `secret` boolean — Whether the value is a secret
        - `value` string — Value of the environment variable
      - `generation` 'mk2' | 'mk3' — Infrastructure generation: mk2 (containers, 2-10s cold starts, 15+ global regions) or mk3 (microVMs, sub-25ms cold starts)
      - `image` string — Container image built by Blaxel when deploying with 'bl deploy'. This field is auto-populated during deployment.
      - `maxScale` integer — Maximum number of concurrent function instances for auto-scaling
      - `memory` integer — Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
      - `minScale` integer — Minimum instances to keep warm. Set to 1+ to eliminate cold starts, 0 for scale-to-zero.
      - `ports` Port[] — Set of ports for a resource
        - `name` string — The name of the port
        - `protocol` 'HTTP' | 'TCP' | 'UDP' | 'TLS' — The protocol of the port
        - `target` integer, required — The target port of the port
      - `transport` 'websocket' | 'http-stream' — Transport compatibility for the MCP, can be "websocket" or "http-stream"
    - `triggers` Trigger[] — Triggers to use your agent
      - `configuration` TriggerConfiguration — Trigger configuration
        - `authenticationType` string — The authentication type of the trigger
        - `callbackSecret` string — The callback secret for async triggers (auto-generated, encrypted)
        - `callbackUrl` string — The callback URL for async triggers (optional)
        - `path` string — The path of the trigger
        - `retry` integer — The retry of the trigger
        - `schedule` string — The schedule of the trigger, cron expression * * * * *
        - `tasks` TriggerConfigurationTask[] — The tasks configuration of the cronjob
        - `timeout` integer — The timeout in seconds for async triggers (max 900s, MK3 only)
      - `enabled` boolean — Enable or disable the trigger (default: true)
      - `id` string — Identifier of the trigger. Optional — the server auto-generates a unique id when one is not provided, and disambiguates duplicates within a resource.
      - `type` 'http' | 'http-async' | 'cron' — The type of trigger, can be http or http-async
  - `status` 'DELETING' | 'TERMINATED' | 'FAILED' | 'DEACTIVATED' | 'DEACTIVATING' | 'UPLOADING' | 'BUILDING' | 'DEPLOYING' | 'DEPLOYED' | 'BUILT' — Deployment status of a resource deployed on Blaxel

## Response `200`

successful operation

- Function — MCP server deployment that exposes tools for AI agents via the Model Context Protocol (MCP). Deployed as a serverless auto-scaling endpoint using streamable HTTP transport.
  - `events` CoreEvent[] — Events happening on a resource deployed on Blaxel
    - `canaryRevision` string — Canary revisionID link to the event
    - `message` string — Event message
    - `revision` string — RevisionID link to the event
    - `status` string — Event status
    - `time` string — Event time
    - `type` string — Event type
  - `metadata` Metadata, required — Owner fields for Persistence
    - `createdAt` string — The date and time when the resource was created
    - `updatedAt` string — The date and time when the resource was updated
    - `createdBy` string — The user or service account who created the resource
    - `updatedBy` string — The user or service account who updated the resource
    - `displayName` string — Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
    - `externalId` string — Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
    - `labels` MetadataLabels — Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
    - `name` string, required — Unique identifier for the resource within the workspace. Must be lowercase alphanumeric with hyphens, max 49 characters. Immutable after creation.
    - `plan` string — Billing plan tier applied to this resource (inherited from workspace account)
    - `url` string — Auto-generated endpoint URL for accessing this resource (for agents, functions, models, sandboxes)
    - `workspace` string — Name of the workspace this resource belongs to (read-only, set automatically)
  - `spec` FunctionSpec, required — Configuration for an MCP server function including runtime settings, transport protocol, and connected integrations
    - `enabled` boolean — When false, the function is disabled and will not serve requests
    - `integrationConnections` string[]
    - `policies` string[]
    - `public` boolean — When true, the function is publicly accessible without authentication. Only available for mk3 generation.
    - `region` string — Region where the function should be deployed (e.g. us-pdx-1, eu-lon-1). If not specified, the function is deployed based on policy locations.
    - `revision` RevisionConfiguration — Revision configuration
      - `active` string — Active revision id
      - `canary` string — Canary revision id
      - `canaryPercent` integer — Canary revision percent
      - `stickySessionTtl` integer — Sticky session TTL in seconds (0 = disabled)
      - `traffic` integer — Traffic percentage
    - `runtime` FunctionRuntime — Runtime configuration defining how the MCP server function is deployed and scaled
      - `envs` Env[] — Environment variables injected into the function. Supports Kubernetes EnvVar format with valueFrom references.
        - `name` string — Name of the environment variable
        - `secret` boolean — Whether the value is a secret
        - `value` string — Value of the environment variable
      - `generation` 'mk2' | 'mk3' — Infrastructure generation: mk2 (containers, 2-10s cold starts, 15+ global regions) or mk3 (microVMs, sub-25ms cold starts)
      - `image` string — Container image built by Blaxel when deploying with 'bl deploy'. This field is auto-populated during deployment.
      - `maxScale` integer — Maximum number of concurrent function instances for auto-scaling
      - `memory` integer — Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
      - `minScale` integer — Minimum instances to keep warm. Set to 1+ to eliminate cold starts, 0 for scale-to-zero.
      - `ports` Port[] — Set of ports for a resource
        - `name` string — The name of the port
        - `protocol` 'HTTP' | 'TCP' | 'UDP' | 'TLS' — The protocol of the port
        - `target` integer, required — The target port of the port
      - `transport` 'websocket' | 'http-stream' — Transport compatibility for the MCP, can be "websocket" or "http-stream"
    - `triggers` Trigger[] — Triggers to use your agent
      - `configuration` TriggerConfiguration — Trigger configuration
        - `authenticationType` string — The authentication type of the trigger
        - `callbackSecret` string — The callback secret for async triggers (auto-generated, encrypted)
        - `callbackUrl` string — The callback URL for async triggers (optional)
        - `path` string — The path of the trigger
        - `retry` integer — The retry of the trigger
        - `schedule` string — The schedule of the trigger, cron expression * * * * *
        - `tasks` TriggerConfigurationTask[] — The tasks configuration of the cronjob
        - `timeout` integer — The timeout in seconds for async triggers (max 900s, MK3 only)
      - `enabled` boolean — Enable or disable the trigger (default: true)
      - `id` string — Identifier of the trigger. Optional — the server auto-generates a unique id when one is not provided, and disambiguates duplicates within a resource.
      - `type` 'http' | 'http-async' | 'cron' — The type of trigger, can be http or http-async
  - `status` 'DELETING' | 'TERMINATED' | 'FAILED' | 'DEACTIVATED' | 'DEACTIVATING' | 'UPLOADING' | 'BUILDING' | 'DEPLOYING' | 'DEPLOYED' | 'BUILT' — Deployment status of a resource deployed on Blaxel

## Other responses

- `400` — Bad request - Invalid function configuration
- `401` — Unauthorized - Invalid or missing authentication credentials
- `403` — Forbidden - Insufficient permissions to create functions
- `409` — Conflict - Function with this name already exists
- `500` — Internal server error

---

[API](https://skmtc.net/blaxel/apis/blaxel-control-plane.md) · [All operations](https://skmtc.net/blaxel/apis/blaxel-control-plane/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/blaxel/blaxel-control-plane/versions/dfa264bc72ee/schema)
