Skip to content

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

@jinlxz

Description

@jinlxz

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

    "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

        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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions