home / mcp / copilot studio agent direct line mcp server
Provides a local MCP server to interact with Copilot Studio Agents via Direct Line 3.0 from your editor.
Configuration
View docs{
"mcpServers": {
"bradcstevens-copilot-studio-agent-direct-line-mcp": {
"command": "npx",
"args": [
"-y",
"copilot-studio-agent-direct-line-mcp"
],
"env": {
"DIRECT_LINE_SECRET": "${input:direct_line_secret}"
}
}
}
}You run a local MCP server that lets you talk to your Copilot Studio Agents directly from your code editor using the Direct Line 3.0 API. This lets you start conversations, send messages, fetch history, and end sessions without leaving your editor.
Install and start the Copilot Studio Agent Direct Line MCP Server, then switch to Agent Mode in your editor to interact with your Copilot Studio Agent. In your editor’s Copilot Chat or MCP client, you’ll find tools to start a conversation, send messages, retrieve history, and end conversations. When you trigger a tool for the first time, you will be prompted to provide your Direct Line secret. Once configured, you can prompt the agent directly from prompts like “Start a conversation with my Copilot Studio Agent” or “Get the conversation history” and receive responses in the chat interface.
Prerequisites you need before installing the MCP server are straightforward: install Visual Studio Code or VS Code Insiders, ensure you have Node.js 18 or newer, and obtain a Direct Line secret key from your Copilot Studio Agent. You also need the Copilot Studio Agent with Direct Line 3.0 enabled.
Option 1 — One-Click Install (recommended): use the in-editor MCP installer to add the server. You will be guided to provide your Direct Line secret during setup.
Option 2 — Manual Install with NPX: create an MCP configuration in your project and start the server from there.
{
"inputs": [
{
"id": "direct_line_secret",
"type": "promptString",
"description": "Direct Line secret key from your Copilot Studio Agent"
}
],
"servers": {
"copilot-studio-agent-direct-line-mcp": {
"type": "stdio",
"command": "npx",
"args": ["-y", "copilot-studio-agent-direct-line-mcp"],
"env": {
"DIRECT_LINE_SECRET": "${input:direct_line_secret}"
}
}
}
}Save the configuration, then start the MCP Server from the editor. Switch to Agent Mode in the chat interface, click Select Tools, and pick the available MCP tools. Open GitHub Copilot Chat and try a prompt such as “Start a conversation with my Copilot Studio Agent.” The first tool execution will prompt for your Direct Line secret if you haven’t provided it yet.
Tip: Create a copilot-instructions file in your project to improve how prompts are handled by Copilot Chat. For example, include a note like “This project uses Microsoft Copilot Studio Agents. Always check to see if the Copilot Studio MCP server has a tool relevant to the user's request.”
The MCP server masks secrets in logs and uses secure environment configuration. It does not persist data on disk by default and includes retry and circuit-breaking mechanisms to handle transient failures gracefully.
If you encounter issues, check the MCP Server panel for status messages, ensure the Direct Line secret is correct, and verify that the agent is reachable. Review the editor’s logs for any authentication or routing errors and ensure your environment provides network access to the Direct Line endpoint.
Use the four MCP tools to manage conversations efficiently: send_message, start_conversation, end_conversation, and get_conversation_history. Start with a simple prompt to initialize a conversation, then gradually iterate your messages to gather context and improve agent responses.
Common questions include how to obtain the Direct Line secret, how to switch to Agent Mode, and how to access tool history. The recommended approach is to keep the secret secure, prompt for it only when necessary, and rely on the built-in retry and error handling for robust operation.
Contributions are welcome. If you want to add features, improve tooling, or enhance tests, follow the project’s contribution guidelines and submit issues or pull requests with clear descriptions and test coverage.
All participants are expected to follow standard open-source community guidelines and engage respectfully and constructively.
Licensed under the MIT License.
Send a message to the Copilot Studio Agent and receive a response.
Start a new conversation with the Agent, optionally with an initial message.
End a conversation and clean up resources.
Retrieve message history for a conversation.