mcp-create-declarative-agent
github/awesome-copilot
Create declarative agents for Microsoft 365 Copilot by integrating MCP servers with authentication and tool selection.
What is mcp-create-declarative-agent?
This skill scaffolds a complete declarative agent for Microsoft 365 Copilot that connects to a Model Context Protocol (MCP) server. It handles MCP server integration, tool selection, OAuth/SSO authentication setup, and generates the required manifest, plugin, and configuration files.
- Scaffold declarative agent project structure via Microsoft 365 Agents Toolkit
- Import and select tools from MCP servers automatically
- Configure OAuth 2.0 or SSO authentication with environment variables
- Generate manifest.json, declarativeAgent.json, and ai-plugin.json files
- Define response semantics to map API responses to Copilot-friendly formats
- Support MCP server endpoints for metadata, tool listing, and execution
How to install mcp-create-declarative-agent
npx skills add https://github.com/github/awesome-copilot --skill mcp-create-declarative-agent- Microsoft 365 Agents Toolkit installed
- Access to an MCP server (URL and supported endpoints)
- OAuth credentials or SSO configuration for the target service
- Node.js environment for running the skill
How to use mcp-create-declarative-agent
- 1.Answer workflow questions: MCP server URL, tools to expose, authentication method, agent purpose, and response semantics needs
- 2.Review the generated appPackage/ structure with manifest.json, declarativeAgent.json, and ai-plugin.json
- 3.Configure .env.local with OAuth credentials or SSO settings
- 4.Update mcp.json with your MCP server URL and plugin file path
- 5.Provision the agent using Agents Toolkit and start debugging to sideload in Teams
- 6.Test in Microsoft 365 Copilot at https://m365.cloud.microsoft/chat and validate tool execution
Use cases
- Integrate GitHub, Jira, or custom APIs as MCP servers into Microsoft 365 Copilot
- Build agents that expose specific external tools while restricting access for security
- Create agents with OAuth-protected access to third-party services
- Map complex API responses to structured data for Copilot consumption
- Set up local testing and sideloading of agents in Teams
- Microsoft 365 Copilot developers
- Teams app developers building AI agents
- Integration engineers connecting external systems to Copilot
- Enterprise developers implementing SSO-based agent authentication
mcp-create-declarative-agent FAQ
An MCP (Model Context Protocol) server exposes external tools and data to Copilot. It provides endpoints for metadata, tool listing, and tool execution. You need one to connect external systems like GitHub, Jira, or custom APIs to your agent.
Use OAuth 2.0 for production scenarios with third-party services. Use SSO when the agent runs within your organization's identity system. OAuth requires client credentials; SSO uses existing organizational authentication.
During tool selection, choose only the specific tools you need from the MCP server. Only selected tools will be included in ai-plugin.json, restricting what Copilot can access.
response_semantics maps API response fields to Copilot-friendly formats (title, subtitle, url). Use it when your MCP server returns complex JSON that needs restructuring for Copilot to display properly.
Provision the agent in Agents Toolkit, start debugging to sideload in Teams, then test in Microsoft 365 Copilot at https://m365.cloud.microsoft/chat. Authenticate when prompted and query the agent using natural language.
Full instructions (SKILL.md)
Source of truth, from github/awesome-copilot.
name: mcp-create-declarative-agent description: 'Skill converted from mcp-create-declarative-agent.prompt.md'
---
mode: 'agent'
tools: ['changes', 'search/codebase', 'edit/editFiles', 'problems']
description: 'Create a declarative agent for Microsoft 365 Copilot by integrating an MCP server with authentication, tool selection, and configuration'
model: 'gpt-4.1'
tags: [mcp, m365-copilot, declarative-agent, model-context-protocol, api-plugin]
---
# Create MCP-based Declarative Agent for Microsoft 365 Copilot
Create a complete declarative agent for Microsoft 365 Copilot that integrates with a Model Context Protocol (MCP) server to access external systems and data.
## Requirements
Generate the following project structure using Microsoft 365 Agents Toolkit:
### Project Setup
1. **Scaffold declarative agent** via Agents Toolkit
2. **Add MCP action** pointing to MCP server
3. **Select tools** to import from MCP server
4. **Configure authentication** (OAuth 2.0 or SSO)
5. **Review generated files** (manifest.json, ai-plugin.json, declarativeAgent.json)
### Key Files Generated
**appPackage/manifest.json** - Teams app manifest with plugin reference:
```json
{
"$schema": "https://developer.microsoft.com/json-schemas/teams/vDevPreview/MicrosoftTeams.schema.json",
"manifestVersion": "devPreview",
"version": "1.0.0",
"id": "...",
"developer": {
"name": "...",
"websiteUrl": "...",
"privacyUrl": "...",
"termsOfUseUrl": "..."
},
"name": {
"short": "Agent Name",
"full": "Full Agent Name"
},
"description": {
"short": "Short description",
"full": "Full description"
},
"copilotAgents": {
"declarativeAgents": [
{
"id": "declarativeAgent",
"file": "declarativeAgent.json"
}
]
}
}
```
**appPackage/declarativeAgent.json** - Agent definition:
```json
{
"$schema": "https://aka.ms/json-schemas/copilot/declarative-agent/v1.0/schema.json",
"version": "v1.0",
"name": "Agent Name",
"description": "Agent description",
"instructions": "You are an assistant that helps with [specific domain]. Use the available tools to [capabilities].",
"capabilities": [
{
"name": "WebSearch",
"websites": [
{
"url": "https://learn.microsoft.com"
}
]
},
{
"name": "MCP",
"file": "ai-plugin.json"
}
]
}
```
**appPackage/ai-plugin.json** - MCP plugin manifest:
```json
{
"schema_version": "v2.1",
"name_for_human": "Service Name",
"description_for_human": "Description for users",
"description_for_model": "Description for AI model",
"contact_email": "support@company.com",
"namespace": "serviceName",
"capabilities": {
"conversation_starters": [
{
"text": "Example query 1"
}
]
},
"functions": [
{
"name": "functionName",
"description": "Function description",
"capabilities": {
"response_semantics": {
"data_path": "$",
"properties": {
"title": "$.title",
"subtitle": "$.description"
}
}
}
}
],
"runtimes": [
{
"type": "MCP",
"spec": {
"url": "https://api.service.com/mcp/"
},
"run_for_functions": ["functionName"],
"auth": {
"type": "OAuthPluginVault",
"reference_id": "${{OAUTH_REFERENCE_ID}}"
}
}
]
}
```
**/.vscode/mcp.json** - MCP server configuration:
```json
{
"serverUrl": "https://api.service.com/mcp/",
"pluginFilePath": "appPackage/ai-plugin.json"
}
```
## MCP Server Integration
### Supported MCP Endpoints
The MCP server must provide:
- **Server metadata** endpoint
- **Tools listing** endpoint (exposes available functions)
- **Tool execution** endpoint (handles function calls)
### Tool Selection
When importing from MCP:
1. Fetch available tools from server
2. Select specific tools to include (for security/simplicity)
3. Tool definitions are auto-generated in ai-plugin.json
### Authentication Types
**OAuth 2.0 (Static Registration)**
```json
"auth": {
"type": "OAuthPluginVault",
"reference_id": "${{OAUTH_REFERENCE_ID}}",
"authorization_url": "https://auth.service.com/authorize",
"client_id": "${{CLIENT_ID}}",
"client_secret": "${{CLIENT_SECRET}}",
"scope": "read write"
}
```
**Single Sign-On (SSO)**
```json
"auth": {
"type": "SSO"
}
```
## Response Semantics
### Define Data Mapping
Use `response_semantics` to extract relevant fields from API responses:
```json
"capabilities": {
"response_semantics": {
"data_path": "$.results",
"properties": {
"title": "$.name",
"subtitle": "$.description",
"url": "$.link"
}
}
}
```
### Add Adaptive Cards (Optional)
See the `mcp-create-adaptive-cards` prompt for adding visual card templates.
## Environment Configuration
Create `.env.local` or `.env.dev` for credentials:
```env
OAUTH_REFERENCE_ID=your-oauth-reference-id
CLIENT_ID=your-client-id
CLIENT_SECRET=your-client-secret
```
## Testing & Deployment
### Local Testing
1. **Provision** agent in Agents Toolkit
2. **Start debugging** to sideload in Teams
3. Test in Microsoft 365 Copilot at https://m365.cloud.microsoft/chat
4. Authenticate when prompted
5. Query the agent using natural language
### Validation
- Verify tool imports in ai-plugin.json
- Check authentication configuration
- Test each exposed function
- Validate response data mapping
## Best Practices
### Tool Design
- **Focused functions**: Each tool should do one thing well
- **Clear descriptions**: Help the model understand when to use each tool
- **Minimal scoping**: Only import tools the agent needs
- **Descriptive names**: Use action-oriented function names
### Security
- **Use OAuth 2.0** for production scenarios
- **Store secrets** in environment variables
- **Validate inputs** on the MCP server side
- **Limit scopes** to minimum required permissions
- **Use reference IDs** for OAuth registration
### Instructions
- **Be specific** about the agent's purpose and capabilities
- **Define behavior** for both successful and error scenarios
- **Reference tools** explicitly in instructions when applicable
- **Set expectations** for users about what the agent can/cannot do
### Performance
- **Cache responses** when appropriate on MCP server
- **Batch operations** where possible
- **Set timeouts** for long-running operations
- **Paginate results** for large datasets
## Common MCP Server Examples
### GitHub MCP Server
```
URL: https://api.githubcopilot.com/mcp/
Tools: search_repositories, search_users, get_repository
Auth: OAuth 2.0
```
### Jira MCP Server
```
URL: https://your-domain.atlassian.net/mcp/
Tools: search_issues, create_issue, update_issue
Auth: OAuth 2.0
```
### Custom Service
```
URL: https://api.your-service.com/mcp/
Tools: Custom tools exposed by your service
Auth: OAuth 2.0 or SSO
```
## Workflow
Ask the user:
1. What MCP server are you integrating with (URL)?
2. What tools should be exposed to Copilot?
3. What authentication method does the server support?
4. What should the agent's primary purpose be?
5. Do you need response semantics or Adaptive Cards?
Then generate:
- Complete appPackage/ structure (manifest.json, declarativeAgent.json, ai-plugin.json)
- mcp.json configuration
- .env.local template
- Provisioning and testing instructions
## Troubleshooting
### MCP Server Not Responding
- Verify server URL is correct
- Check network connectivity
- Validate MCP server implements required endpoints
### Authentication Fails
- Verify OAuth credentials are correct
- Check reference ID matches registration
- Confirm scopes are requested properly
- Test OAuth flow independently
### Tools Not Appearing
- Ensure mcp.json points to correct server
- Verify tools were selected during import
- Check ai-plugin.json has correct function definitions
- Re-fetch actions from MCP if server changed
### Agent Not Understanding Queries
- Review instructions in declarativeAgent.json
- Check function descriptions are clear
- Verify response_semantics extract correct data
- Test with more specific queries
Related skills
More from github/awesome-copilot and the wider catalog.

mcp-deploy-manage-agents
Guidance for deploying, managing, and governing MCP-based declarative agents in the Microsoft 365 admin center.

mcp-security-audit
|

meeting-minutes
Generate concise, actionable meeting minutes with decisions, action items, and owners for internal meetings under 60 minutes.

memory-merger
Consolidate domain learnings from memory files into instruction files with zero knowledge loss.

mentoring-juniors
Socratic mentoring for junior developers—guides through questions, never answers.

microsoft-agent-framework
Create and refactor Microsoft Agent Framework solutions with language-specific guidance for .NET and Python.