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

# Claude

> 将 Claude Desktop 或 Claude Code 连接到 SocQ MCP 并验证采集。

# Claude

Claude Desktop 和 Claude Code 可以将发布的 `@socq/mcp` 桥作为本地 stdio 服务器运行。该桥将工具发现和调用转发到托管的 SocQ MCP 端点。

## 前置条件

* SocQ API 密钥；
* Node.js 20 或更高版本；
* 当前的 Claude Desktop 或 Claude Code 安装。

## 配置 Claude Desktop

打开 Claude Desktop 开发者配置并添加：

```json theme={"system"}
{
  "mcpServers": {
    "socq": {
      "command": "npx",
      "args": ["-y", "@socq/mcp"],
      "env": {
        "SOCQ_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}
```

保存后重新启动 Claude Desktop。

<Warning>
  此本地配置包含凭据。不要提交或分享它。对于分布式集成，将桥打包为桌面扩展并将 API 密钥字段标记为敏感，以便 Claude 可以使用操作系统安全存储。
</Warning>

## 配置 Claude Code

在启动 Claude Code 的 shell 中设置 `SOCQ_API_KEY`：

```bash theme={"system"}
export SOCQ_API_KEY="YOUR_API_KEY"
```

```powershell theme={"system"}
$env:SOCQ_API_KEY="YOUR_API_KEY"
```

在 macOS、Linux 或 WSL 上为您的用户账户添加 SocQ：

```bash theme={"system"}
claude mcp add socq --scope user -- npx -y @socq/mcp
```

在本机 Windows 上，用 `cmd /c` 包装 `npx`：

```powershell theme={"system"}
claude mcp add socq --scope user -- cmd /c npx -y @socq/mcp
```

从同一环境启动 Claude Code，以便桥继承 `SOCQ_API_KEY`。

<Warning>
  将 API 密钥保留在您的环境中。不要通过 `--env` 传递它，因为它将明文值存储在 Claude Code 的 MCP 配置中。
</Warning>

## 限制工具列表

对于 Claude Desktop，将平台过滤器添加到桥参数：

```json theme={"system"}
"args": ["-y", "@socq/mcp", "--platforms", "youtube"]
```

对于 macOS、Linux 或 WSL 上的 Claude Code，在添加服务器时包含相同的过滤器：

```bash theme={"system"}
claude mcp add socq-youtube --scope user -- npx -y @socq/mcp --platforms youtube
```

在本机 Windows 上，在 `npx` 之前插入 `cmd /c`。有关模式选择和过滤限制，请参阅[选择 MCP 工具](/zh/integrations/mcp-filtering)。

## 验证

对于 Claude Code，首先确认服务器已注册：

```bash theme={"system"}
claude mcp get socq
```

然后向 Claude Desktop 或 Claude Code 提问：

```text theme={"system"}
Use SocQ to check my account, then collect the latest 20 comments from this
YouTube video. Wait for the task to finish and return the results as a table:
https://www.youtube.com/watch?v=VIDEO_ID
```

当 Claude 发现 SocQ 工具、调用 `socq_account`、提交采集并使用 `socq_get_task` 读取返回的任务时，连接正在工作。

## 故障排除

* Claude Desktop：配置更改后重新启动应用程序，以便刷新工具列表。
* Claude Code：使用 `claude mcp list` 检查已配置的服务器，使用 `/mcp` 查看连接状态。如果在启动后才设置 `SOCQ_API_KEY`，请重新启动 Claude Code。

请参阅[集成故障排除](/zh/integrations/troubleshooting)、Anthropic 的[Claude Desktop 本地 MCP 指南](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop) 和 [Claude Code MCP 指南](https://docs.anthropic.com/en/docs/claude-code/mcp)。
