> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.claw-ops.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.claw-ops.com/_mcp/server.

# 외부 MCP 연결 등록

POST https://api.claw-ops.com/v1/accounts/{accountId}/mcp-connections
Content-Type: application/json

에이전트가 사용할 원격 MCP 서버를 등록합니다. url 은 공개 인터넷에서 접근 가능한 https 주소여야 하며(포트는 443만), 자격증명은 query 가 아닌 인증 설정으로 전달합니다.

등록 직후 상태는 untested 입니다. 에이전트에 연결하려면 먼저 연결 테스트를 통과해야 합니다.

Reference: https://docs.claw-ops.com/api-레퍼런스/claw-ops-api/agents/create-mcp-connection

## Authentication

- `Authorization` header (bearer token, required) — API Key를 Bearer 토큰으로 전달

## Request

### Path parameters

- `accountId` (string, required) — 계정 ID

### Body (application/json)

- `name` (string, required)
- `url` (string, required) — https 전용. 포트는 생략하거나 443. 사설/내부 주소는 등록할 수 없습니다.
- `transport` (enum, optional, default: streamable_http) — sse 는 호환용 legacy 입니다.
  - Allowed values: `streamable_http`, `sse`
- `authType` (enum, optional, default: none)
  - Allowed values: `none`, `bearer`, `api_key`
- `headerName` (string, optional) — authType=api_key 일 때만 사용합니다. Authorization·Host·Cookie 등 예약 헤더는 사용할 수 없습니다(Bearer 가 필요하면 authType=bearer 를 쓰세요).
- `secret` (string, optional) — authType 이 none 이 아닐 때 필수. 저장 시 암호화되며 **다시 조회할 수 없습니다**.

## Response

### 201

등록 성공(연결 테스트 전이므로 status=untested)

- `connectionId` (string, required) — 연결 ID
- `name` (string, required)
- `url` (string, required)
- `host` (string, required) — url 의 호스트. 목록 화면 표시용.
- `transport` (enum, required)
  - Allowed values: `streamable_http`, `sse`
- `authType` (enum, required)
  - Allowed values: `none`, `bearer`, `api_key`
- `authHeaderName` (string, required, nullable) — authType=api_key 일 때의 헤더 이름. bearer 는 Authorization 고정이라 null.
- `hasSecret` (boolean, required) — 자격증명 설정 여부. 값 자체는 조회할 수 없습니다.
- `enabled` (boolean, required)
- `status` (enum, required) — untested 는 연결 테스트를 통과하지 않은 상태입니다. 에이전트에 붙이려면 tested 여야 하며, 통화 중에도 tested 인 연결만 사용됩니다. credential_error 는 마지막 테스트가 인증 실패한 경우입니다.
  - Allowed values: `untested`, `tested`, `credential_error`
- `toolCount` (integer, required)
- `tools` (list of object, required) — 마지막 연결 테스트에서 발견된 도구 목록. 표시·선택용 스냅샷입니다.
  - `name` (string, required)
  - `description` (string, required, nullable)
  - `inputSchema` (map from string to any, required) — 도구 인자의 JSON Schema. 서버가 준 원본입니다.
- `lastTestedAt` (datetime, required, nullable)
- `lastErrorCode` (enum, required, nullable) — 마지막 연결 실패 사유.
  - Allowed values: `URL_BLOCKED`, `AUTH_FAILED`, `TIMEOUT`, `TLS_ERROR`, `PROTOCOL_ERROR`, `TOO_MANY_TOOLS`
- `agentCount` (integer, required) — 이 연결을 사용하는 에이전트 수.
- `dateCreated` (datetime, required)
- `dateUpdated` (datetime, required)

## Examples

**Request**

```json
{
  "name": "예약 CRM",
  "url": "https://crm.example.com/mcp"
}
```

**Response**

```json
{
  "connectionId": "clx0mcp0000000000000001",
  "name": "예약 CRM",
  "url": "https://crm.example.com/mcp",
  "host": "crm.example.com",
  "transport": "streamable_http",
  "authType": "bearer",
  "authHeaderName": null,
  "hasSecret": true,
  "enabled": true,
  "status": "tested",
  "toolCount": 3,
  "tools": [
    {
      "name": "get_reservation",
      "description": "예약 번호로 예약 정보를 조회합니다.",
      "inputSchema": {}
    }
  ],
  "lastTestedAt": "2024-01-15T09:30:00Z",
  "lastErrorCode": null,
  "agentCount": 1,
  "dateCreated": "2024-01-15T09:30:00Z",
  "dateUpdated": "2024-01-15T09:30:00Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.claw-ops.com/v1/accounts/accountId/mcp-connections"

payload = {
    "name": "예약 CRM",
    "url": "https://crm.example.com/mcp"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.claw-ops.com/v1/accounts/accountId/mcp-connections';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"name":"예약 CRM","url":"https://crm.example.com/mcp"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.claw-ops.com/v1/accounts/accountId/mcp-connections"

	payload := strings.NewReader("{\n  \"name\": \"예약 CRM\",\n  \"url\": \"https://crm.example.com/mcp\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.claw-ops.com/v1/accounts/accountId/mcp-connections")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"예약 CRM\",\n  \"url\": \"https://crm.example.com/mcp\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.claw-ops.com/v1/accounts/accountId/mcp-connections")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"예약 CRM\",\n  \"url\": \"https://crm.example.com/mcp\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.claw-ops.com/v1/accounts/accountId/mcp-connections', [
  'body' => '{
  "name": "예약 CRM",
  "url": "https://crm.example.com/mcp"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.claw-ops.com/v1/accounts/accountId/mcp-connections");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"예약 CRM\",\n  \"url\": \"https://crm.example.com/mcp\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "예약 CRM",
  "url": "https://crm.example.com/mcp"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.claw-ops.com/v1/accounts/accountId/mcp-connections")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```