메인 콘텐츠로 건너뛰기
Bridger Gateway의 핵심 MCP 호출 엔드포인트입니다. JSON-RPC 2.0 규격을 그대로 따릅니다.

Request 헤더

POST /mcp HTTP/1.1
Content-Type: application/json
x-api-key: dk_live_...

공통 에러 코드

코드의미
-32600Invalid JSON-RPC request
-32601Method not found
-32602Invalid params (예: 도구 이름 누락)
-32000Internal gateway error

tools/list

Bridger에 등록된 모든 도구의 메타데이터를 반환합니다.

Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

Response 200

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "pingtool",
        "description": "Ping endpoint",
        "inputSchema": { "type": "object", "properties": {} },
        "annotations": {
          "readOnlyHint": true,
          "destructiveHint": false,
          "openWorldHint": false
        }
      }
    ]
  }
}

tools/call

도구 한 개를 실행합니다.

Request

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "pingtool",
    "arguments": { "q": "hello" }
  }
}

Response 200

{
  "jsonrpc": "2.0",
  "id": 2,
  "result": {
    "tool": "pingtool",
    "upstream": {
      "method": "GET",
      "url": "http://127.0.0.1:9921/ping?q=hello",
      "status": 200
    },
    "data": { "ok": true, "q": "hello" },
    "cacheStatus": "MISS",
    "auditId": "aud_..."
  }
}
필드설명
result.tool호출된 도구 이름
result.upstream.methodupstream HTTP 메서드
result.upstream.urlupstream 최종 URL (ServiceKey 등 미들웨어 주입 후)
result.upstream.statusupstream HTTP 상태 코드
result.dataupstream 응답 본문 (XML→JSON 정규화 후)
result.cacheStatus캐시 적중 여부 (HIT/MISS 등)
result.auditId이 호출의 감사 로그 식별자

cURL 전체 예시

curl -X POST https://mcp.datari.kr/mcp \
  -H "x-api-key: $DATA_BRIDGE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

공공데이터 미들웨어 자동 동작

isPublicData=true인 프리셋의 도구 호출 시 다음이 자동 적용됩니다.
  1. ServiceKey 주입 (PUBLIC_DATA_SERVICE_KEY)
  2. lat/lonnx/ny 격자좌표 변환 (기상청 DFS)
  3. XML/JSON payload 정규화
  4. 공공데이터 에러코드 → 사람이 읽는 메시지 매핑
코드메시지
00정상
30등록되지 않은 서비스키
31활용기간 만료 서비스키
32등록되지 않은 IP
기타알 수 없는 공공데이터 에러 (<code>)