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

# 远程MCP

极客智坊 Response API 允许 OpenAI 模型通过内置 `mcp` 工具使用远程 MCP 服务器来执行任务。

> 模型上下文协议（MCP）是一个开放协议，旨在标准化应用程序向 LLMs 提供工具和上下文的方式。Responses API 中的 MCP 工具使开发者能够让模型访问托管在远程 MCP 服务器上的工具。这些 MCP 服务器由互联网上的开发者和组织维护，它们将这些工具开放给 MCP 客户端使用，例如 Responses API。

以下是调用远程 MCP 的请求示例：

<CodeGroup>
  ```bash curl theme={null}
  curl --location --request POST 'https://geekai.co/api/v1/responses' \
  --header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
  --header 'Content-Type: application/json' \
  --data-raw '{
    "model": "gpt-5-mini",
    "tools": [
      {
        "type": "mcp",
        "server_label": "deepwiki",
        "server_url": "https://mcp.deepwiki.com/mcp",
        "require_approval": "never"
      }
    ],
    "input": "2025年3月26日版本的MCP规范支持哪些传输协议？"
  }'
  ```

  ```bash python theme={null}
  # 先安装 OpenAI SDK: `pip3 install openai`
  from openai import OpenAI
  client = OpenAI(api_key="$GEEKAI_API_KEY", base_url="https://geekai.co/api/v1")
  response = client.responses.create(
      model="gpt-5-mini",
      input="2025年3月26日版本的MCP规范支持哪些传输协议？",
      tools=[
          {
              "type": "mcp",
              "server_label": "deepwiki",
              "server_url": "https://mcp.deepwiki.com/mcp",
              "require_approval": "never"
          }
      ]
  )
  print(response)
  ```

  ```bash javascript theme={null}
  // 先安装 OpenAI SDK: `npm install openai`
  import OpenAI from "openai";
  const openai = new OpenAI({
      baseURL: 'https://geekai.co/api/v1',
      apiKey: '$GEEKAI_API_KEY'
  });
  async function main() {
      const response = await openai.responses.create({
          model: "gpt-5-mini",
          input: "2025年3月26日版本的MCP规范支持哪些传输协议？",
          tools: [
              {
                      type: "mcp",
                      server_label: "deepwiki",
                      server_url: "https://mcp.deepwiki.com/mcp",
                      require_approval: "never"
              }
          ]
      });
      console.log(response);
  }
  main();
  ```

  ```bash go theme={null}
  package main

  import (
  	"bytes"
  	"encoding/json"
  	"fmt"
  	"io"
  	"net/http"
  )

  func main() {
  	requestBody := map[string]any{
  		"model": "gpt-5-mini",
  		"input": "2025年3月26日版本的MCP规范支持哪些传输协议?",
  		"tools": []any{
  			map[string]any{
  				"type":               "mcp",
  				"server_label":       "deepwiki",
  				"server_url":         "https://mcp.deepwiki.com/mcp",
  				"require_approval":   "never",
  			},
  		},
  	}

  	jsonData, err := json.Marshal(requestBody)
  	if err != nil {
  		panic(err)
  	}

  	client := &http.Client{}
  	req, err := http.NewRequest("POST", "https://geekai.co/api/v1/responses", bytes.NewBuffer(jsonData))
  	if err != nil {
  		panic(err)
  	}

  	req.Header.Set("Authorization", "Bearer $GEEKAI_API_KEY")
  	req.Header.Set("Content-Type", "application/json")

  	resp, err := client.Do(req)
  	if err != nil {
  		panic(err)
  	}
  	defer resp.Body.Close()

  	body, err := io.ReadAll(resp.Body)
  	if err != nil {
  		panic(err)
  	}

  	fmt.Println(string(body))
  }
  ```
</CodeGroup>

MCP 工具仅适用于 Responses API，并支持我们所有的[支持 Response API 的模型](https://docs.geekai.co/cn/docs/response/create)。使用 MCP 工具时，您只需支付导入工具定义或进行工具调用所消耗的令牌费用，无需额外付费。
