---
title: Hosted MCP | RunAPI
description: 使用 OAuth 将 Claude Desktop、Cursor、VS Code、Windsurf 或其他 MCP 客户端连接到 RunAPI。
url: https://runapi.ai/zh-CN/docs/resources/mcp/hosted.md
canonical: https://runapi.ai/zh-CN/docs/resources/mcp/hosted
locale: zh-CN
---

> HTML version: https://runapi.ai/zh-CN/docs/resources/mcp/hosted
> Site index for agents: https://runapi.ai/llms.txt

# Hosted MCP

Hosted MCP 是使用 RunAPI 工具的推荐方式。MCP 客户端直接连接 RunAPI，因此无需安装
Node.js，也无需保持本机进程运行。

使用这个 endpoint：

```text
https://mcp.runapi.ai/mcp
```

在下方选择你的 MCP 客户端。当客户端在浏览器中打开 RunAPI 时，请登录、选择要使用的 Account，然后批准访问。

## Claude Desktop

1.  打开 **Settings > Connectors**，添加 custom connector。
2.  将名称设为 **RunAPI**，并填写上方 endpoint。
3.  选择 **Connect**，在浏览器中完成 RunAPI 授权。
4.  在对话中打开 **+ > Connectors**，启用 RunAPI。

如果 RunAPI 没有出现在对话中，请返回 **Settings > Connectors** 重新连接，并确认已为当前对话启用。

## Cursor

将 RunAPI 添加到 Cursor 的 `mcp.json`，例如项目级 `.cursor/mcp.json`：

```json
{
  "mcpServers": {
    "runapi": {
      "url": "https://mcp.runapi.ai/mcp"
    }
  }
}
```

在 Cursor sidebar 中打开 **Customize**，找到并启用 RunAPI，然后在浏览器中完成授权。

RunAPI 应显示为已连接并提供工具。遇到连接或认证错误时，打开 **Output** 面板并选择 **MCP Logs**。

## VS Code

1.  打开 Command Palette，运行 **MCP: Add Server**。
2.  选择 **HTTP**，填写上方 endpoint，并将 server 命名为 **RunAPI**。
3.  启动 server，根据提示信任它，然后在浏览器中完成授权。

RunAPI 工具应出现在 Chat 中。遇到错误时，运行 **MCP: List Servers**，选择 RunAPI，然后选择
**Show Output**。

## Windsurf

以下步骤适用于 Cascade agent。Devin Local 使用 Devin CLI 配置。

1.  打开 **Devin Settings > Cascade > MCP Servers**，编辑 raw
    `~/.codeium/windsurf/mcp_config.json` 文件。
2.  将 RunAPI 添加为 remote HTTP server：

```json
{
  "mcpServers": {
    "runapi": {
      "serverUrl": "https://mcp.runapi.ai/mcp"
    }
  }
}
```

1.  保存文件，刷新 MCP servers，启用 RunAPI，然后在浏览器中完成授权。

如果工具没有出现，请打开 MCP settings，确认 RunAPI 已启用，然后重新连接。

## 其他 MCP 客户端

将上方 endpoint 添加为 Streamable HTTP server。客户端必须支持 Remote MCP 和浏览器
OAuth。根据提示完成授权，然后在客户端中启用 RunAPI 工具。

## 验证连接

向客户端提问：

> RunAPI 有哪些可用的图片模型？

客户端应调用 `list_models` 并返回可用的图片模型。这表示连接和工具调用均正常工作。

## 改用 API key

OAuth 是推荐路径。仅当客户端无人值守或无法使用 OAuth 时，才使用专用的 standard API
key；请按照[身份验证指南](https://runapi.ai/zh-CN/docs/guides/authentication)创建密钥。不要把 key 放入
endpoint URL，也不要提交到代码仓库。

* **Claude Desktop：** 如果 custom connector 支持 Request headers，请添加
  `Authorization` header，值为 `Bearer YOUR_API_KEY`。
* **Cursor：** 在 Cursor 应用可见的环境中设置 `RUNAPI_API_KEY`，然后在 server `headers`
  中使用 `Authorization: Bearer ${env:RUNAPI_API_KEY}`。Remote server 不读取
  Cursor 的 `envFile` 设置。
* **VS Code：** 在 server 的 `Authorization` header 中引用 password 类型的
  `${input:...}`，让 VS Code 提示输入并保存 key，避免将其写入 `mcp.json`。
* **Windsurf：** 在 `~/.codeium/windsurf/mcp_config.json` 的
  `Authorization` header 中引用 `${env:RUNAPI_API_KEY}` 或 `${file:...}`。

客户端停用或 key 可能泄露时，请在 API Keys 页面撤销该 key。

## 排查问题

* 授权没有完成：从客户端重新连接 RunAPI，再次完成浏览器授权。
* RunAPI 已连接但没有显示工具：确认 server 已启用，删除后使用准确的 endpoint 重新添加，再开始新对话。
* 验证问题执行失败：查看对应客户端小节中的日志入口，重新连接 RunAPI 后再试。

需要客户端在你的电脑上启动 RunAPI？[配置 Local MCP](https://runapi.ai/zh-CN/docs/resources/mcp/local)。

---

## More from RunAPI

- [Home](https://runapi.ai/.md)
- [模型](https://runapi.ai/zh-CN/models.md)
- [AI 视频 API 对比](https://runapi.ai/zh-CN/ai-video-api-comparison.md)
- [OpenClaw 集成](https://runapi.ai/zh-CN/openclaw.md)
- [OpenClaw 最佳 API](https://runapi.ai/zh-CN/best-api-for-openclaw.md)
- [OpenClaw 图片生成](https://runapi.ai/zh-CN/openclaw-image-generation.md)
- [Hermes 智能体集成](https://runapi.ai/zh-CN/hermes-agent.md)
- [定价](https://runapi.ai/zh-CN/pricing.md)
- [Claude API 定价](https://runapi.ai/zh-CN/claude-api-pricing.md)
- [ChatGPT API 定价](https://runapi.ai/zh-CN/chatgpt-api-pricing.md)
- [OpenAI API 定价](https://runapi.ai/zh-CN/openai-api-pricing.md)
- [Gemini API 定价](https://runapi.ai/zh-CN/gemini-api-pricing.md)
- [Claude Code 定价](https://runapi.ai/zh-CN/claude-code-pricing.md)
- [Claude Code API](https://runapi.ai/zh-CN/claude-code-api.md)
- [Claude Code 对比 Cursor](https://runapi.ai/zh-CN/claude-code-vs-cursor.md)
- [Claude Max 对比 API](https://runapi.ai/zh-CN/claude-max-vs-api.md)
- [Requesty 替代方案](https://runapi.ai/zh-CN/requesty-alternative.md)
- [文档](https://runapi.ai/zh-CN/docs/guides)
- [SDK](https://runapi.ai/zh-CN/sdk.md)
- [Skills](https://runapi.ai/zh-CN/skills.md)
- [MCP Server](https://runapi.ai/zh-CN/mcp.md)
- [CLI](https://runapi.ai/zh-CN/cli.md)
- [反馈](https://runapi.ai/)
- [联系](mailto:support@runapi.ai)
- [服务条款](https://runapi.ai/zh-CN/terms.md)
- [隐私政策](https://runapi.ai/zh-CN/privacy.md)
- [Site index for agents](https://runapi.ai/llms.txt)

Contact: contact@runapi.ai

## Structured data

```json
[
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "WebSite",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "potentialAction": {
      "@type": "SearchAction",
      "target": {
        "@type": "EntryPoint",
        "urlTemplate": "https://runapi.ai/zh-CN/models?q={search_term_string}"
      },
      "query-input": "required name=search_term_string"
    }
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "Organization",
    "name": "RunAPI",
    "url": "https://runapi.ai/zh-CN",
    "logo": {
      "@type": "ImageObject",
      "url": "https://runapi.ai/zh-CNicon.svg"
    },
    "sameAs": [
      "https://github.com/runapi-ai"
    ]
  },
  {
    "@context": "https://schema.org",
    "inLanguage": "zh-CN",
    "@type": "TechArticle",
    "headline": "Hosted MCP",
    "description": "使用 OAuth 将 Claude Desktop、Cursor、VS Code、Windsurf 或其他 MCP 客户端连接到 RunAPI。",
    "url": "https://runapi.ai/zh-CN/docs/resources/mcp/hosted",
    "mainEntityOfPage": "https://runapi.ai/zh-CN/docs/resources/mcp/hosted"
  }
]
```
