---
title: "Docs MCP 服务器"
description: "通过 Mintlify 托管的 MCP 服务器从 AI 工具搜索 Twexapi 文档。"
---

Twexapi 文档作为 MCP 服务器运行于 `https://docs.twexapi.io/mcp`。AI 工具可在对话中搜索完整文档站并检索已索引公开页。这与位于 `https://api.twexapi.io/mcp` 的 [Twexapi API MCP 服务器](/mcp/overview) 不同，后者与 live Twexapi API 端点交互。文档搜索工具无需认证且不调用 live Twexapi API。

:::note
  `https://docs.twexapi.io/mcp` 是 MCP 传输端点，不是浏览器页面。用普通 `GET` 打开可能返回 JSON-RPC 方法错误。MCP 客户端应连接同一 URL 并调用 `tools/list` 等 MCP 方法。
:::

## Docs MCP Server

在 `https://docs.twexapi.io/mcp` 搜索文档并读取已索引公开页。无需认证。免费。部分客户端可能还显示 Mintlify 的 `submit_feedback` 工具用于文档反馈。

## API MCP Server

在 `https://api.twexapi.io/mcp` 与 X/Twitter 数据交互。使用 API 密钥或 OAuth 2.1。调用按底层端点消耗额度。

## Agent 路由清单

### 先读文档

公开文档、API 参数、示例、错误码、SDK 指南与无认证页检索用 Docs MCP `https://docs.twexapi.io/mcp`。

### 运行账号操作

live X/Twitter 读取、写、搜索、趋势、提取、社区、列表、DM、文章或时间线作业用 API MCP `https://api.twexapi.io/mcp`。以 API 密钥或 OAuth 2.1 认证。

### 在聊天外持久化

后端须拥有重试、游标存储、文件下载、队列、定时作业或批量编排时用 REST 或生成 SDK。

### Hand off 结果

结束Agent 运行前存储端点路径、请求参数、返回 ID、`has_more`、`next_cursor`、导出路由与 charged credits。

## 快速连接

使用任意文档页顶部的上下文菜单即时连接：

- Copy MCP Server URL — 复制 `https://docs.twexapi.io/mcp` 到剪贴板
- Copy MCP Install Command — 复制 `npx add-mcp` 安装命令
- Connect to Cursor — 在 Cursor 安装 docs MCP 服务器
- Connect to VS Code — 在 VS Code 安装 docs MCP 服务器

## 设置

### Web 与终端客户端

- [Claude.ai](#claude-ai)
- [Claude Code](#claude-code)
- [Codex CLI](#codex-cli)

<a id="claude-ai"></a>

#### Claude.ai

1. 在 Claude 打开 [Settings > Connectors](https://claude.ai/settings/connectors)。
2. 选择 **Add custom connector**。
3. 输入：
   - Name: `Twexapi Docs`
   - URL: `https://docs.twexapi.io/mcp`
4. 选择 **Add**。
5. 在任意聊天中点击附件按钮并选择 **Twexapi Docs**。

<a id="claude-code"></a>

#### Claude Code

添加 docs MCP 服务器：

```bash
claude mcp add --transport http twexapi-docs https://docs.twexapi.io/mcp
```

验证：

```bash
claude mcp list
```

<a id="codex-cli"></a>

#### Codex CLI

添加到 `~/.codex/config.toml`：

```toml
[mcp_servers.twexapi_docs]
url = "https://docs.twexapi.io/mcp"
```

### 编辑器客户端

- [Cursor](#cursor)
- [VS Code](#vs-code)
- [Windsurf](#windsurf)
- [OpenCode](#opencode)

<a id="cursor"></a>

#### Cursor

添加到 `~/.cursor/mcp.json`（全局）或 `.cursor/mcp.json`（项目）：

```json
{
  "mcpServers": {
    "twexapi-docs": {
      "url": "https://docs.twexapi.io/mcp"
    }
  }
}
```

<a id="vs-code"></a>

#### VS Code

添加到 `.vscode/mcp.json`（项目）或使用 **MCP: Open User Configuration**（全局）：

```json
{
  "servers": {
    "twexapi-docs": {
      "type": "http",
      "url": "https://docs.twexapi.io/mcp"
    }
  }
}
```

<a id="windsurf"></a>

#### Windsurf

添加到 `~/.codeium/windsurf/mcp_config.json`：

```json
{
  "mcpServers": {
    "twexapi-docs": {
      "serverUrl": "https://docs.twexapi.io/mcp"
    }
  }
}
```

<a id="opencode"></a>

#### OpenCode

添加到 `opencode.json`：

```json
{
  "mcp": {
    "twexapi-docs": {
      "type": "remote",
      "url": "https://docs.twexapi.io/mcp"
    }
  }
}
```

## 同时使用两个 MCP 服务器

最佳体验是同时连接：

1. Docs MCP（`docs.twexapi.io/mcp`）— AI 搜索文档以理解 API 参数、错误码与用法模式。
2. API MCP（`api.twexapi.io/mcp`）— AI 执行认证操作，如搜索、查询、趋势、提取与写操作。

AI 按上下文选择服务器。关于请求参数的问题应查 docs 服务器；获取 live X/Twitter 数据应查 API 服务器。

### Claude Code

```bash
claude mcp add --transport http twexapi-docs https://docs.twexapi.io/mcp
claude mcp add --transport http twexapi https://api.twexapi.io/mcp --header "x-api-key:twexapi_YOUR_KEY_HERE"
```

### Cursor

```json
{
  "mcpServers": {
    "twexapi-docs": {
      "url": "https://docs.twexapi.io/mcp"
    },
    "twexapi": {
      "url": "https://api.twexapi.io/mcp",
      "headers": {
        "x-api-key": "twexapi_YOUR_KEY_HERE"
      }
    }
  }
}
```

### VS Code

```json
{
  "servers": {
    "twexapi-docs": {
      "type": "http",
      "url": "https://docs.twexapi.io/mcp"
    },
    "twexapi": {
      "type": "http",
      "url": "https://api.twexapi.io/mcp",
      "headers": {
        "x-api-key": "twexapi_YOUR_KEY_HERE"
      }
    }
  }
}
```

## 可用工具

Mintlify 根据站点名生成 docs 工具名。`name` 设为 `twexapi` 的 docs 配置部署后，docs MCP 服务器暴露：

| 工具 | 用途 |
| --- | --- |
| `search_twexapi` | 按端点、参数、错误码、工作流或指南主题搜索已索引 Twexapi 文档。 |
| `query_docs_filesystem_twexapi` | 读取已索引文档文件并检查精确页内容。 |
| `submit_feedback` | 客户端支持时发送页级文档反馈。 |

:::tip
  当前生产部署在更新 `docs.json` 部署前可能仍返回 `search_twexapi_io` 与 `query_docs_filesystem_twexapi_io`。部署后 `tools/list` 应返回 `search_twexapi` 与 `query_docs_filesystem_twexapi`。
:::

## 搜索范围

docs MCP 服务器索引公开 Twexapi 文档：

- API 参考操作与请求 schema
- 认证、速率限制、错误与计费指南
- MCP 服务器设置与工具参考
- LangChain、CrewAI、Pydantic AI、Google ADK、Haystack、Mastra、无代码工具与工作流平台的框架指南
- 搜索、资料、趋势、文章、社区、列表、时间线与提取的工作流指南
- `llms.txt` 与其他 Mintlify 生成的文档索引

## 示例 prompt

```txt
Use Twexapi Docs MCP to find the authentication guide, then explain how to configure the API MCP server with x-api-key.
```

```txt
Search the Twexapi docs for advanced search parameters, then tell me which API MCP call should be used for recent tweets about AI agents.
```

```txt
Find the docs for article Markdown fetches and generate a minimal Python example using the documented request shape.
```
