Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This guide shows you how to integrate your service with a declarative agent for Microsoft 365 Copilot by adding an MCP server as a plugin using the Microsoft 365 Agents Toolkit. By following these steps, you enable conversational, AI-powered access to your MCP-exposed services for business users.
This walkthrough uses the GitHub MCP server as an example. The GitHub MCP server is a remote MCP server, provided and maintained by GitHub, that exposes tools for working with repositories, issues, pull requests, and other GitHub features. You use it here to build an agent that can search GitHub repositories and users from natural language prompts. You can follow the same steps with your own MCP server.
Build and use the plugin in four steps: create an OAuth client for authentication, create the agent, publish and sideload the agent, and use the agent.
Prerequisites
Before you begin, make sure that you have the following prerequisites:
- Requirements specified in Requirements for Copilot extensibility options
- Visual Studio Code
- Microsoft 365 Agents Toolkit version 6.12.0 or later
To complete the GitHub example in this walkthrough, you also need a GitHub account. A GitHub account isn't required to build a plugin from your own MCP server.
Step 1: Create an OAuth client for authentication
The GitHub MCP server requires each user to sign in before it returns data, so the plugin needs an OAuth client. In this guide, use OAuth (with static registration). When you create the agent and select this authentication type, Agents Toolkit immediately prompts you for those values, so create the client first. Copilot then uses the registration to obtain an access token on behalf of the signed-in user each time the agent calls the MCP server.
Tip
If your MCP server supports OAuth 2.0 dynamic client registration (DCR), you can skip this section. When you create the agent, select OAuth (with dynamic registration) as the authentication type. The MCP server registers a client at runtime, so no client ID or secret is needed. Agents Toolkit writes the registration to the plugin manifest for you.
To create an OAuth client:
Go to https://github.com/settings/developers in your browser. Select OAuth Apps > New OAuth App.
Add a name and homepage URL for your app, and set
https://teams.microsoft.com/api/platform/v1.0/oAuthRedirectas the Authorization callback URL. Select Register application.After the app is created, select Generate a new client secret. Copy the secret and the Client ID to enter when you create the agent.
Note
These steps are specific to GitHub. For your own MCP server, create an OAuth client with the identity provider your server uses, and set https://teams.microsoft.com/api/platform/v1.0/oAuthRedirect as the redirect (callback) URL. When you create the agent and select OAuth (with static registration), Agents Toolkit prompts you for the client ID, client secret, and optional scopes. If your MCP server supports dynamic client registration (DCR), you can instead select OAuth (with dynamic registration), and the MCP server registers a client at runtime - no manual client creation, client ID, or secret required. If your MCP server uses Microsoft Entra single sign-on (SSO) instead of OAuth, select Entra SSO, and Agents Toolkit prompts you for the Microsoft Entra app client ID instead. In every case, Agents Toolkit updates the plugin manifest for you. For details on each option, see Configure authentication for MCP and API plugins in agents.
Step 2: Create the agent
To create the agent:
Open Visual Studio Code and select the Microsoft 365 Agents Toolkit icon in the Activity Bar.
Select Create a New Agent/App in the Agents Toolkit task pane.
Select Declarative Agent.
Select Add an Action, and then select Start with an MCP Server.
Enter the GitHub MCP server URL
https://api.githubcopilot.com/mcp/.
Select the authentication type. For this exercise, select OAuth (with static registration).
When prompted, enter the Client ID from the OAuth app you registered, and then enter the client secret.
When prompted for scopes, press Enter to continue.
Choose a location for the agent project.
Enter a name for the agent.
After you complete these steps, Agents Toolkit generates the required files for the agent and opens a new Visual Studio Code window with the agent project loaded.
Agents Toolkit configures the generated plugin manifest (ai-plugin.json) for dynamic tool discovery, so the agent resolves the MCP server's tools - including any that return UI widgets (MCP apps) - at runtime, and you don't add tools manually. To pin a fixed, curated set of tools instead, see Configure pinned tools with Agents Toolkit.
Step 3: Publish and sideload the agent
To publish and sideload the agent:
In the Agents Toolkit Accounts pane, select Sign in to Microsoft 365. (If you're already signed in, continue to the next step).
Confirm that both Custom App Upload Enabled and Copilot Access Enabled display under your Microsoft 365 account. If they don't, check with your organization admin. See Requirements for Copilot extensibility options for details.
In the Lifecycle pane, select Provision.
Read the message in the dialog and select Confirm to continue.
Wait for the toolkit to report that it's finished provisioning.
Step 4: Use the agent
To use the agent:
In your browser, go to https://m365.cloud.microsoft/chat.
In the Agents section of the sidebar, locate your agent. It's listed as the name you gave in Step 2: Create the agent, with
devappended at the end. Select the agent.Ask the agent to find a repository or user. For example,
can you find a repo for kiota?.When prompted, select Sign in to {agent-name}. In the pop-up window, sign in with your GitHub account and authorize the agent.
When the pop-up window closes, the agent returns a response.
If the tool that the agent calls returns a UI widget (MCP app), confirm that the agent renders the widget inline in the response. For more information, see Add MCP apps to declarative agents in Microsoft 365 Copilot.