> ## 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.

# VS Code

> 通过 SocQ stdio 转接程序连接 VS Code，并安全保存 API 密钥。

# VS Code

VS Code 将 MCP 服务器定义存储在 `mcp.json` 中。对所有工作区使用用户级配置，或对一个可信工作区使用 `.vscode/mcp.json`。

## 前置条件

* Node.js 20 或更高版本；
* SocQ API 密钥；
* 支持 MCP 的新版 VS Code。

## 配置

从命令面板运行 **MCP：打开用户配置** 并添加：

```json theme={"system"}
{
  "servers": {
    "socq": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@socq/mcp"],
      "env": {
        "SOCQ_API_KEY": "${input:socq-api-key}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "socq-api-key",
      "description": "SocQ API key",
      "password": true
    }
  ]
}
```

VS Code 在服务器启动时提示输入密钥并安全存储输入以供以后使用。

> [!WARNING]
>
> 避免将 API 密钥硬编码到工作区文件中或将其提交给源代码管理。

## 限制工具列表

要只加载 YouTube 的类型化工具（Typed tools），请将转接程序参数更改为：

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

有关模式选择和过滤限制，请参阅[选择 MCP 工具](https://docs.socq.ai/zh/integrations/mcp-filtering)。

## 验证

从 **MCP：列出服务器** 启动或重新启动 `socq`，批准服务器信任提示，然后询问：

```text theme={"system"}
请使用 SocQ 检查我的账户，然后采集这个 YouTube 视频最新的 20 条评论。
等待任务完成后，以表格形式返回结果：
https://www.youtube.com/watch?v=VIDEO_ID
```

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

## 故障排除

当进程未启动或工具丢失时，使用 **MCP：列出服务器 → 显示输出**。有关身份验证、缺少工具和任务错误，请参阅[集成故障排除](https://docs.socq.ai/zh/integrations/troubleshooting)。

请参阅官方 VS Code 指南，了解[添加 MCP 服务器](https://code.visualstudio.com/docs/agent-customization/mcp-servers) 和 [`mcp.json` 配置参考](https://code.visualstudio.com/docs/agents/reference/mcp-configuration)。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.