Skip to content

MCP servers are not run in non-interactive mode (when --prompt argument is provided) #633

@xiangdev

Description

@xiangdev

Describe the bug

When in non-interactive mode, MCP servers are not run. Even when providing --additional-mcp-config argument doesn't seem to have effect.

In an interactive session, MCP servers are run and can be used.


copilot --allow-all-tools --additional-mcp-config '{"mcpServers":{"mobile-mcp":{"type":"local","command":"npx","tools":["*"],"args":["-y","@mobilenext/mobile-mcp@latest"]}}}' --model claude-sonnet-4.5

Welcome to GitHub Copilot CLI
Version 0.0.361 · Commit fdd8f6541

Copilot can write, test and debug code right from your terminal. Describe a task
to get started or enter ? for help. Copilot uses AI, check for mistakes.

● Logged in as user: xiangdev

● Configured MCP servers: mobile-mcp

● Connected to GitHub MCP Server

use mobile mcp to open link https://www.yahoo.com

● I'll help you open the Yahoo URL on a mobile device. First, let me check what
devices are available.

✔ mobile_list_available_devices
└ Found these devices:

● I found an Android device (emulator-5554). I'll now open the Yahoo URL on it.

✔ mobile_open_url
└ Opened URL: https://www.yahoo.com

● Successfully opened https://www.yahoo.com (https://www.yahoo.com) on the
Android device (emulator-5554)!


If I provide the same prompt using --prompt argument, MCP server are not run and the session cannot use the tools.


copilot --allow-all-tools --additional-mcp-config '{"mcpServers":{"mobile-mcp":{"type":"local","command":"npx","tools":["*"],"args":["-y","@mobilenext/mobile-mcp@latest"]}}}' --model claude-sonnet-4.5 --prompt "use mobile mcp to open link https://www.yahoo.com"

I'll help you open the Yahoo link using the Mobile MCP. Let me check the MCP configuration and use it to open the link.

✔ Read mcp-config.json
└ 20 lines read

I can see the Mobile MCP is configured. However, I don't have direct access to MCP tools in my current environment - they would need to be invoked through the GitHub Copilot CLI's MCP integration.

Let me try using the bash tool to invoke the Mobile MCP through npx:

✔ $ npx -y @mobilenext/mobile-mcp@latest open-url --url "https://www.yahoo.com"
└ 3 lines...

The Mobile MCP doesn't work that way from the command line. The MCP (Model Context Protocol) servers are designed to be accessed through the GitHub Copilot interface, not directly via command line.

To open https://www.yahoo.com using Mobile MCP, you would need to use it through the GitHub Copilot chat interface that has MCP integration enabled. The mcp-config.json file you have sets up the Mobile MCP server, but the actual tools are accessed through the MCP protocol layer, not as standalone CLI commands.

If you'd like to open the URL in a browser from the command line instead, I can do that with a standard command like open https://www.yahoo.com on macOS.

Total usage est: 1 Premium request
Total duration (API): 16s
Total duration (wall): 22s
Total code changes: 0 lines added, 0 lines removed
Usage by model:
claude-sonnet-4.5 28.3k input, 510 output, 21.8k cache read (Est. 1 Premium request)

Affected version

0.0.361 Commit: fdd8f6541

Steps to reproduce the behavior

Please refer to the full command line in the descriptions.

Expected behavior

Configured MCP Servers are run and usable in non-interactive mode.

Additional context

Image

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions