> ## 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.

# Import from cURL

> Parse a cURL command and return the equivalent tool configuration.

This endpoint accepts a raw `curl` command string, parses it, and **automatically creates a new tool** in the specified server with the extracted configuration. The tool is created with status `draft` so you can review and activate it from the dashboard.

<Note>
  The tool is created automatically — no second request needed. The response is the full created tool object, not just a parsed preview.
</Note>

<Note>
  If auth credentials are detected in the cURL command (e.g. `Authorization: Bearer sk_test_xxx`), they are saved as **Test Credentials** only and a `_notice` field is added to the response. You must configure Production Authentication separately in the server's Authentication tab.
</Note>

## Path Parameters

<ParamField path="server_id" type="string" required>
  The UUID of the server the tool will belong to (e.g. `836995ae-1cff-41ec-823e-a4f07ccca3a0`). Numeric IDs are also accepted for backwards compatibility.
</ParamField>

## Body Parameters

<ParamField body="curl_command" type="string" required>
  The complete `curl` command string to parse.
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
       --url https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl \
       --header 'Authorization: Bearer gmcp_your_api_key' \
       --header 'content-type: application/json' \
       --data '
  {
    "curl_command": "curl -X POST https://api.stripe.com/v1/customers -H \"Authorization: Bearer sk_test_abc123\" -H \"Content-Type: application/x-www-form-urlencoded\" -d \"email=test@example.com\" -d \"name=John Doe\""
  }
  '
  ```

  ```python Python theme={null}
  import requests
  curl_command = (
      'curl -X POST https://api.stripe.com/v1/customers '
      '-H "Authorization: Bearer sk_test_abc123" '
      '-H "Content-Type: application/x-www-form-urlencoded" '
      '-d "email=test@example.com" -d "name=John Doe"'
  )

  response = requests.post(
      "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl",
      headers={
          "Authorization": "Bearer gmcp_your_api_key",
          "Content-Type": "application/json"
      },
      json={"curl_command": curl_command}
  )
  print(response.json())
  ```

  ```javascript JavaScript theme={null}
  const curlCommand = `curl -X POST https://api.stripe.com/v1/customers \
    -H "Authorization: Bearer sk_test_abc123" \
    -H "Content-Type: application/x-www-form-urlencoded" \
    -d "email=test@example.com" -d "name=John Doe"`;

  const response = await fetch(
    "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl",
    {
      method: "POST",
      headers: {
        "Authorization": "Bearer gmcp_your_api_key",
        "Content-Type": "application/json"
      },
      body: JSON.stringify({ curl_command: curlCommand })
    }
  );
  const data = await response.json();
  ```

  ```php PHP theme={null}
  $curlCommand = 'curl -X POST https://api.stripe.com/v1/customers '
      . '-H "Authorization: Bearer sk_test_abc123" '
      . '-d "email=test@example.com"';

  $response = wp_remote_post(
      "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl",
      [
          "headers" => [
              "Authorization" => "Bearer gmcp_your_api_key",
              "Content-Type"  => "application/json"
          ],
          "body" => json_encode(["curl_command" => $curlCommand])
      ]
  );
  $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(`{
    "curl_command": "curl -X POST https://api.stripe.com/v1/customers -H \"Authorization: Bearer sk_test_abc123\" -H \"Content-Type: application/x-www-form-urlencoded\" -d \"email=test@example.com\" -d \"name=John Doe\""
  }`)

  	req, _ := http.NewRequest("POST", "https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl", 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  \"curl_command\": \"curl -X POST https://api.stripe.com/v1/customers -H \\\"Authorization: Bearer sk_test_abc123\\\" -H \\\"Content-Type: application/x-www-form-urlencoded\\\" -d \\\"email=test@example.com\\\" -d \\\"name=John Doe\\\"\"\n}";

          HttpRequest request = HttpRequest.newBuilder()
              .uri(URI.create("https://yoursite.com/wp-json/getmcp/v1/servers/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl"))
              .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/836995ae-1cff-41ec-823e-a4f07ccca3a0/tools/import-curl')
  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 = '{
    "curl_command": "curl -X POST https://api.stripe.com/v1/customers -H \"Authorization: Bearer sk_test_abc123\" -H \"Content-Type: application/x-www-form-urlencoded\" -d \"email=test@example.com\" -d \"name=John Doe\""
  }'

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

<ResponseExample>
  ```json 201 Created theme={null}
  {
    "id": 12,
    "uuid": "7c4a1e3b-9f2d-4a8b-b5c6-0d1e2f3a4b5c",
    "server_id": 2,
    "name": "imported_tool",
    "description": "",
    "endpoint_url": "https://api.stripe.com/v1/customers",
    "http_method": "POST",
    "input_schema": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "description": "email"
        },
        "name": {
          "type": "string",
          "description": "name"
        }
      },
      "required": []
    },
    "parameter_mapping": {
      "email": {"target": "body", "key": "email"},
      "name": {"target": "body", "key": "name"}
    },
    "response_mapping": {
      "selector": "",
      "format": "json",
      "template": ""
    },
    "headers": {
      "Content-Type": "application/x-www-form-urlencoded"
    },
    "cache_ttl": 0,
    "timeout": 30,
    "rate_limit_per_min": 60,
    "retry_count": 0,
    "retry_backoff": "exponential",
    "sort_order": 0,
    "status": "draft",
    "tags": [],
    "last_tested_at": null,
    "last_test_response_ms": null,
    "server_uuid": "836995ae-1cff-41ec-823e-a4f07ccca3a0",
    "server_hex": "a1b2c3d4e5f6a1b2",
    "created_at": "2025-03-18T10:00:00Z",
    "updated_at": "2025-03-18T10:00:00Z",
    "_notice": "Auth credentials detected in cURL (bearer) and saved as Test Credentials only. To use this tool in production, configure Authentication in the server's Authentication tab."
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "code": "getmcp_missing_curl",
    "message": "cURL command is required.",
    "data": { "status": 400 }
  }
  ```
</ResponseExample>
