> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getmcp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Server

> Create a new MCP server.

## Body Parameters

<ParamField body="name" type="string" required>
  Human-readable server name (e.g., `My Weather Tools`).
</ParamField>

<ParamField body="description" type="string">
  Optional description of what this server does. Stored inside `settings.description` and returned in the response as `settings.description`.
</ParamField>

<ParamField body="status" default="active" type="string">
  Initial server status. One of: `active`, `paused`, `draft`.
</ParamField>

<ParamField body="auth_type" default="none" type="string">
  Inbound authentication required for the MCP endpoint. One of: `none`, `bearer`, `api-key`, `basic`, `oauth`.
</ParamField>

<ParamField body="test_auth_credentials" type="string">
  JSON-encoded string of the credentials used when clicking **Test** in the admin panel.
  These are your personal/dev API keys — they are stored encrypted and are **never exposed to MCP clients**.
  If not set, the test flow falls back to `auth_credentials` automatically.

  Format depends on `test_auth_type`:

  **Bearer** — `{"token":"your_bearer_token"}`

  **API Key** — `{"name":"X-API-Key","value":"your_api_key","location":"header"}` — use `"location":"query"` to send as a query parameter.

  **Basic Auth** — `{"username":"your_username","password":"your_password"}`

  <Note>Pass as a JSON-serialised string here. The `GET /servers/{id}/credentials` endpoint returns these as a decoded object.</Note>
</ParamField>

<ParamField body="cors_origins" type="string">
  Comma-separated list of allowed CORS origins. Leave empty to allow all origins (`*`).
</ParamField>

<ParamField body="rate_limit_per_min" default="60" type="integer">
  Maximum MCP requests per minute for this server.
</ParamField>

<Note>
  **Timeout** is configured per-tool, not per-server. Set `timeout` when creating or updating a tool via the Tools API.
</Note>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url https://yoursite.com/wp-json/getmcp/v1/servers \
       --header 'Authorization: Bearer gmcp_your_api_key' \
       --header 'content-type: application/json' \
       --data '
  {
    "name": "GitHub Tools",
    "description": "Tools for managing GitHub repositories",
    "status": "active",
    "auth_type": "bearer",
    "test_auth_credentials": "{\"token\":\"your_bearer_token\"}",
    "rate_limit_per_min": 30
  }
  '
  ```

  ```python Python theme={null}
  import requests, json

  response = requests.post(
      "https://yoursite.com/wp-json/getmcp/v1/servers",
      headers={
          "Authorization": "Bearer gmcp_your_api_key",
          "Content-Type": "application/json"
      },
      json={
          "name": "GitHub Tools",
          "description": "Tools for managing GitHub repositories",
          "status": "active",
          "auth_type": "bearer",
          "test_auth_credentials": json.dumps({"token": "your_bearer_token"}),
          "rate_limit_per_min": 30
      }
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    "https://yoursite.com/wp-json/getmcp/v1/servers",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer gmcp_your_api_key",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({
        name: "GitHub Tools",
        description: "Tools for managing GitHub repositories",
        status: "active",
        auth_type: "bearer",
        test_auth_credentials: JSON.stringify({ token: "your_bearer_token" }),
        rate_limit_per_min: 30
      })
    }
  );
  const data = await response.json();
  ```

  ```php PHP theme={null}
  $response = wp_remote_post(
      "https://yoursite.com/wp-json/getmcp/v1/servers",
      [
          "headers" => [
              "Authorization" => "Bearer gmcp_your_api_key",
              "Content-Type"  => "application/json"
          ],
          "body" => json_encode([
              "name"                  => "GitHub Tools",
              "description"           => "Tools for managing GitHub repositories",
              "status"                => "active",
              "auth_type"             => "bearer",
              "test_auth_credentials" => json_encode(["token" => "your_bearer_token"]),
              "rate_limit_per_min"    => 30
          ])
      ]
  );
  $data = json_decode(wp_remote_retrieve_body($response), true);
  ```

  ```go Go theme={null}
  package main
  import (
  	"fmt"
  	"io"
  	"net/http"
  	"strings"
  )

  func main() {
  	body := strings.NewReader(`{
    "name": "GitHub Tools",
    "description": "Tools for managing GitHub repositories",
    "status": "active",
    "auth_type": "bearer",
    "test_auth_credentials": "{\"token\":\"your_bearer_token\"}",
    "rate_limit_per_min": 30
  }`)

  	req, _ := http.NewRequest("POST", "https://yoursite.com/wp-json/getmcp/v1/servers", body)
  	req.Header.Set("Authorization", "Bearer gmcp_your_api_key")
  	req.Header.Set("Content-Type", "application/json")

  	client := &http.Client{}
  	resp, _ := client.Do(req)
  	defer resp.Body.Close()
  	data, _ := io.ReadAll(resp.Body)
  	fmt.Println(string(data))
  }
  ```

  ```java Java theme={null}
  import java.net.URI;
  import java.net.http.HttpClient;
  import java.net.http.HttpRequest;
  import java.net.http.HttpResponse;

  public class Main {
      public static void main(String[] args) throws Exception {
          String json = "{\n  \"name\": \"GitHub Tools\",\n  \"description\": \"Tools for managing GitHub repositories\",\n  \"status\": \"active\",\n  \"auth_type\": \"bearer\",\n  \"test_auth_credentials\": \"{\\\"token\\\":\\\"your_bearer_token\\\"}\",\n  \"rate_limit_per_min\": 30\n}";

          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://yoursite.com/wp-json/getmcp/v1/servers"))
              .header("Authorization", "Bearer gmcp_your_api_key")
              .header("Content-Type", "application/json")
              .POST(HttpRequest.BodyPublishers.ofString(json))
              .build();

          HttpClient client = HttpClient.newHttpClient();
          HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
          System.out.println(response.body());
      }
  }
  ```

  ```ruby Ruby theme={null}
  require 'net/http'
  require 'json'
  require 'uri'

  uri = URI('https://yoursite.com/wp-json/getmcp/v1/servers')
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = uri.scheme == 'https'

  request = Net::HTTP::Post.new(uri)
  request['Authorization'] = 'Bearer gmcp_your_api_key'
  request['Content-Type'] = 'application/json'
  request.body = '{
    "name": "GitHub Tools",
    "description": "Tools for managing GitHub repositories",
    "status": "active",
    "auth_type": "bearer",
    "test_auth_credentials": "{\"token\":\"your_bearer_token\"}",
    "rate_limit_per_min": 30
  }'

  response = http.request(request)
  puts JSON.parse(response.body)
  ```
</RequestExample>

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "id": 3,
    "uuid": "9a3b7c8d-2e1f-4a5b-8c9d-0e1f2a3b4c5d",
    "user_id": 1,
    "name": "GitHub Tools",
    "slug": "github-tools",
    "server_id": "c3d4e5f6a1b2c3d4",
    "status": "active",
    "transport_type": "streamable-http",
    "auth_type": "bearer",
    "auth_config": null,
    "outbound_auth_type": "none",
    "outbound_auth_config": null,
    "cors_origins": null,
    "rate_limit_per_min": 30,
    "settings": {
      "description": "Tools for managing GitHub repositories"
    },
    "endpoint_url": "https://yoursite.com/mcp/github-tools",
    "tool_count": 0,
    "prompt_count": 0,
    "resource_count": 0,
    "created_at": "2025-03-18T10:00:00Z",
    "updated_at": "2025-03-18T10:00:00Z"
  }
  ```

  ```json 403 Forbidden theme={null}
  {
    "code": "rest_forbidden",
    "message": "Invalid or missing API key.",
    "data": { "status": 403 }
  }
  ```

  ```json 500 Server Error theme={null}
  {
    "code": "getmcp_create_failed",
    "message": "Failed to create server.",
    "data": { "status": 500 }
  }
  ```
</ResponseExample>
