github / github/copilot-sdk

How to use MCP tools or built-in tools in a remote Copilot session from client

未关闭
#1,173 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
question
主要语言
Java
星标
10.5k
派生
1.5k
平均合并
1 天 14 小时
30 天内合并 PR
129

描述

I have a Copilot process running on a remote Linux sever started with the following command line
```
node /usr/local/bin/copilot --headless --host 0.0.0.0 --port 30007 --add-dir /opt/copilot-agents --log-dir /mnt/copilot/logs/30007 --log-level debug --allow-all-tools --disable-builtin-mcps
```
I see the copilot process is running and listen on the port 30007 correctly. I have set up a MCP tool under the folder **[home of user running the above copilot process]/.copilot/mcp-config.json**, I launched the copilot cli on the server as the same user and checked the MCP tool works correctly
```json
"jira_confluence_tools": {
"type": "local",
"command": "npx",
"tools": [
"*"
],
"args": [ "mcp-remote", "http://127.0.0.1:38000/mcp"
]
}

```

also I created a python script on client side (a Windows machine), it creates a Copilot session to the remote server, here I want to use the above mcp tool `jira_confluence_tools` defined on the server in the remote session from the client, how can I make it?

I tried with the below code, but it doesn't work, I started the session and sent a message to Copilot server for triggering the MCP tool, but it returned that ```The `jira_confluence_tools` MCP server is **not connected or not registered** in this agent's session. This session appears to be running with a **very limited tool set** — only the two meta-tools (`skill` and `report_intent`) are present. Neither shell execution nor MCP integrations (Jira, Confluence) are connected.```

can someone share how to add the MCP tool on remote server to the session? the agent claimed only have access to 2 tools, how can I use the built-in tools like `create`, `edit`, `view`, `bash` and so on in the remote session?

also I tried to set the parameter `agent` to None when calling the method `client.create_session()`, then the session gets access to all tools in `sub_agent_tools`, but I must specify an agent for my real use case

```python
client = CopilotClient(ExternalServerConfig(url=base_url))
await client.start()
sub_agent_tools=["report_intent", "jira_confluence_tools-getJiraIssue", "create", "view", "edit", "bash"]
session = await asyncio.wait_for(
client.create_session(
on_permission_request=PermissionHandler.approve_all,
session_id=SESSION_ID,
agent="agent1", ### I have the agent agent1 defined under the folder /opt/copilot-agents/.github/agents/agent1.agent.md
streaming=True,
working_directory="/opt/copilot-agents",
system_message=SystemMessageReplaceConfig(mode="replace", content="you have access to all bash commands"),
available_tools=sub_agent_tools, ### I claims the available built-in tools here, but it doesn't work
),
timeout=TIMEOUT,
)
```

# environment

github-copilot-sdk==0.3.0
GitHub Copilot CLI 1.0.39
Python 3.12.10

贡献指南

打开贡献指南

调研方向

从 Python create_session 调用以及 issue 中显示的远程 CLI 配置开始。比较 agent="agent1" 和 available_tools 如何与服务器端的 mcp-config.json 和 .github/agents/agent1.agent.md 交互。完成的标准是远程会话暴露所请求的内置工具和 jira_confluence_tools,或清楚地记录受支持的配置和限制。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
api, developer-experience
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。