
Microsoft Copilot Studio Direct Line
Connects to Microsoft Copilot Studio bots through the Direct Line API to send messages, retrieve chat history, and manage conversations programmatically.
Integrates with Microsoft Copilot Studio agents through Direct Line 3.0 API to enable conversational interactions, message handling, chat history retrieval, and conversation lifecycle management for custom bot integration scenarios.
What it does
- Send messages to Copilot Studio bots
- Retrieve conversation history
- Start and manage chat sessions
- Handle bot responses and activities
- Monitor conversation lifecycle events
Best for
About Microsoft Copilot Studio Direct Line
Microsoft Copilot Studio Direct Line is a community-built MCP server published by bradcstevens that provides AI assistants with tools and capabilities via the Model Context Protocol. Integrate custom bots with Microsoft Copilot Studio for artificial intelligence chat online, chat history, and conversat It is categorized under communication, developer tools.
How to install
You can install Microsoft Copilot Studio Direct Line in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
License
Microsoft Copilot Studio Direct Line is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
β Copilot Studio Agent Direct Line MCP Server
Easily install the Copilot Studio Agent Direct Line MCP Server for VS Code or VS Code Insiders:
This TypeScript project provides a local MCP server for Microsoft Copilot Studio Agents, enabling you to interact with your Copilot Studio Agents directly from your code editor via the Direct Line 3.0 API.
π Table of Contents
- β Copilot Studio Agent Direct Line MCP Server
πΊ Overview
The Copilot Studio Agent Direct Line MCP Server brings Microsoft Copilot Studio Agent context to your development environment. Try prompts like:
- "Start a conversation with my Copilot Studio Agent"
- "Ask my agent about product sizing"
- "Send a message to the agent: What are your capabilities?"
- "Get the conversation history"
- "End the current conversation"
π Expectations
The Copilot Studio Agent Direct Line MCP Server is built with tools that are concise, simple, focused, and easy to useβeach designed for a specific scenario. We intentionally avoid complex tools that try to do too much. The goal is to provide a thin abstraction layer over the Direct Line 3.0 API, making agent interaction straightforward and letting the language model handle complex reasoning.
βοΈ Features
- β Direct Line 3.0 Integration - Full support for Microsoft Bot Framework Direct Line API
- β Token Management - Automatic token caching and proactive refresh
- β Conversation State - Manages conversation lifecycle with 30-minute idle timeout
- β MCP Tools - Four tools for agent interaction: send_message, start_conversation, end_conversation, get_conversation_history
- β Comprehensive Error Handling - 11 specialized error types, OAuth-specific retry strategies, MCP error transformation
- β Circuit Breaker Pattern - Intelligent failure classification, excludes user errors from circuit state
- β Retry Logic - Exponential backoff with jitter, OAuth-aware retry strategies
- β Input Validation - Zod schemas for type-safe validation
- β Security - Secret masking in logs, secure environment configuration, no disk persistence
- β HTTP Transport Mode - Optional HTTP server with Azure Entra ID OAuth authentication
- β Testing Suite - 45+ tests with 80%+ coverage on critical components
- β Production Ready - Deployment templates for Azure Container Apps, Docker, Kubernetes
βοΈ Supported Tools
Interact with your Copilot Studio Agent using these tools:
- send_message: Send a message to the Copilot Studio Agent and receive a response.
- start_conversation: Start a new conversation with the Agent, optionally with an initial message.
- end_conversation: End a conversation and clean up resources.
- get_conversation_history: Retrieve message history for a conversation.
π Installation & Getting Started
For the best experience, use Visual Studio Code and GitHub Copilot. See the getting started documentation to use our MCP Server with other tools such as Claude Code and Cursor.
Prerequisites
- Install VS Code or VS Code Insiders
- Install Node.js 18+
- Microsoft Copilot Studio Agent with Direct Line 3.0 enabled
- Direct Line secret key from your Copilot Studio Agent
Installation
β¨ One-Click Install (Recommended)
After installation, select GitHub Copilot Agent Mode and refresh the tools list. Learn more about Agent Mode in the VS Code Documentation.
𧨠Manual Install with NPX
This installation method is the easiest for all users of Visual Studio Code.
In your project, add a .vscode/mcp.json file with the following content:
{
"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 file, then click 'Start' in the MCP Server panel.
In chat, switch to Agent Mode.
Click "Select Tools" and choose the available tools.
Open GitHub Copilot Chat and try a prompt like Start a conversation with my Copilot Studio Agent. The first time a tool is executed, you will be prompted for your Direct Line secret.
π₯ We strongly recommend creating a
.github/copilot-instructions.mdin your project. This will enhance your experience using the Copilot Studio MCP Server with GitHub Copilot Chat. To start, just include "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" in your copilot instructions file.
See the getting started documentation for additional installation methods, including local development setup.
π Troubleshooting
See the Troubleshooting guide for help with common issues and logging.
π© Examples & Best Practices
Explore example prompts and usage patterns in our Examples documentation.
For detailed tool reference and usage guides, refer to the Usage Guide.
πββοΈ Frequently Asked Questions
For answers to common questions about the Copilot Studio Agent Direct Line MCP Server, see the Frequently Asked Questions.
π Contributing
We welcome contributions! During preview, please file issues for bugs, enhancements, or documentation improvements.
See our Contributions Guide for:
- π οΈ Development setup
- β¨ Adding new features
- π Code style & testing
- π Pull request process
π€ Code of Conduct
This project follows standard open-source community guidelines. We expect all contributors to be respectful and constructive in their interactions.
License
Licensed under the MIT License.
Disclaimer: This is a personal project by Brad Stevens.
It is not affiliated with or endorsed by Microsoft Corporation.
Alternatives
Related Skills
Browse all skillsExpert MCP (Model Context Protocol) orchestration with n8n workflow automation. Master bidirectional MCP integration, expose n8n workflows as AI agent tools, consume MCP servers in workflows, build agentic systems, orchestrate multi-agent workflows, and create production-ready AI-powered automation pipelines with Claude Code integration.
Guide for building TypeScript CLIs with Bun. Use when creating command-line tools, adding subcommands to existing CLIs, or building developer tooling. Covers argument parsing, subcommand patterns, output formatting, and distribution.
Compose rich, readable Telegram messages using HTML formatting via direct Telegram API. Use when: (1) Sending any Telegram message beyond a simple one-line reply, (2) Creating structured messages with sections, lists, or status updates, (3) Need formatting unavailable via Clawdbot's Markdown conversion (underline, spoilers, expandable blockquotes, user mentions by ID), (4) Sending alerts, reports, summaries, or notifications to Telegram, (5) Want professional, scannable message formatting with visual hierarchy. Default to this skill for substantive Telegram communication.
Build real-time voice AI applications using Azure AI Voice Live SDK (azure-ai-voicelive). Use this skill when creating Python applications that need real-time bidirectional audio communication with Azure AI, including voice assistants, voice-enabled chatbots, real-time speech-to-speech translation, voice-driven avatars, or any WebSocket-based audio streaming with AI models. Supports Server VAD (Voice Activity Detection), turn-based conversation, function calling, MCP tools, avatar integration, and transcription.
Persistent long term memory for for continuity in ai sessions between providers and codegen tools. TRIGGERS - Activate this skill when: - User explicitly mentions "satori", "remember this", "save", "add", "save this for later", "store this", "add to memory" - User asks to recall/search past decisions: "what did we decide", "remind me", "search my notes", "what do I know about" - Conversation contains notable facts worth persisting: decisions, preferences, deadlines, names, tech stack choices, strategic directions - Starting a new conversation where proactive context retrieval would help - Use Satori search when user asks a question
Microsoft 365 Agents SDK for .NET. Build multichannel agents for Teams/M365/Copilot Studio with ASP.NET Core hosting, AgentApplication routing, and MSAL-based auth. Triggers: "Microsoft 365 Agents SDK", "Microsoft.Agents", "AddAgentApplicationOptions", "AgentApplication", "AddAgentAspNetAuthentication", "Copilot Studio client", "IAgentHttpAdapter".