Files
agent-fox/docs/clients/github-copilot.md
2026-04-12 20:15:41 +08:00

72 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GitHub Copilot
GitHub Copilot 通过 VS Code 的 MCP 支持连接 AgentFox。
## 前提条件
- VS Code 版本 1.99 或更高
- GitHub Copilot 扩展已安装并激活
- GitHub Copilot Chat 扩展已安装
## 配置步骤
### 方式一:项目级配置(推荐)
在项目根目录创建 `.vscode/mcp.json`
```json
{
"servers": {
"my-api": {
"type": "http",
"url": "https://www.agentfoxapp.com/mcp/{projectId}",
"headers": {
"Authorization": "Bearer {your-api-key}"
}
}
}
}
```
> **注意**VS Code MCP 配置的顶层键是 `servers`,不是 `mcpServers`。
### 方式二:用户级配置
在 VS Code 的 `settings.json` 中添加:
```json
{
"mcp": {
"servers": {
"my-api": {
"type": "http",
"url": "https://www.agentfoxapp.com/mcp/{projectId}",
"headers": {
"Authorization": "Bearer {your-api-key}"
}
}
}
}
}
```
## 使用方法
在 Copilot Chat 中使用 Agent 模式(`@workspace` 或直接对话):
```
你:帮我查看支付相关的 API 端点
Copilot[调用 search_endpoints keyword="payment"]
找到以下支付相关端点:...
```
## 验证连接
1. 打开 VS Code 命令面板(`Cmd/Ctrl + Shift + P`
2. 搜索 "MCP: List Servers"
3. 确认 AgentFox 服务器状态为已连接
## 安全提示
建议将 `.vscode/mcp.json` 添加到 `.gitignore`,或使用 VS Code 的用户级配置来避免 API Key 泄露。