---
title: "Create Mcp Server Connection"
method: POST
path: "/v1/mcp-server-instances/with-spec"
tags: ["v1", "protected", "mcp-server-instances"]
---

# Create Mcp Server Connection

`POST /v1/mcp-server-instances/with-spec`

Create an MCP server spec and instance in one transaction.

## Request body

- MCPServerConnectionCreateRequest
  - `instance` MCPServerInstanceCreateWithoutSpec, required
    - `auth_config_id` string, nullable
    - `description` string, nullable
    - `json_spec` object
    - `name` string, required
  - `server` MCPServerCreate, required — Payload for creating an MCP server spec (catalog template). Either ``docker_image_url`` (for container-based servers) or ``remote_url`` (for HTTP-based servers like GitHub Copilot) should be supplied. ``env_schema`` describes the variables an instance built from this spec needs to provide; secret entries (``isSecret: true``) are routed through the secret manager rather than stored in plaintext.
    - `cmd` string[], nullable — Custom command override for container CMD (e.g. switching between stdio and HTTP modes).
    - `description` string, required — Short summary of what this MCP server provides.
    - `docker_image_url` string, nullable — Docker image URL for container-based MCP servers.
    - `env_schema` object[], nullable — Environment-variable schema entries (KeyValueInput from the MCP registry). Each item has at least 'name' and 'description'; mark secrets with 'isSecret: true'.
    - `is_public` boolean — If true, the spec is visible across workspaces.
    - `json_spec` object, nullable — Raw ServerJSON spec as published by the MCP registry.
    - `name` string, required — Human-readable MCP server name (unique per workspace).
    - `registry_url` string, nullable — Source registry URL the spec was imported from.
    - `remote_url` string, nullable — Remote endpoint URL for HTTP-based MCP servers.
    - `tags` string[] — Tags used for search and categorization.
    - `version` string — Semantic version of the MCP server spec.

## Response `201`

Successful Response

- MCPServerInstanceResponse
  - `auth_config_id` union
    - string, uuid
    - string
  - `created_at` string, required
  - `description` string, nullable, required
  - `id` string, uuid, required
  - `json_spec` object, required
  - `last_dispatch` object, nullable
  - `name` string, required
  - `server_spec_id` string, required
  - `tools` object[], nullable
  - `updated_at` string, required
  - `verification` object, required

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/agentarea/apis/agentarea-api.md) · [All operations](https://skmtc.net/agentarea/apis/agentarea-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/agentarea/agentarea-api/revisions/082e677c141c/schema)
