MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Mcp-Create-Declarative-Agent

Mcp-Create-Declarative-Agent是一款code方向的AI技能,核心价值是Skill converted from mcp-create-declarative-agent,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Skill converted from mcp-create-declarative-agent.prompt.md

Last verified on: 2026-05-30
mkdir -p ./skills/mcp-create-declarative-agent && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/mcp-create-declarative-agent/SKILL.md -o ./skills/mcp-create-declarative-agent/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

text
---
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:

{

"$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"

}

]

}

}

text

**appPackage/declarativeAgent.json** - Agent definition:

{

"$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"

}

]

}

text

**appPackage/ai-plugin.json** - MCP plugin manifest:

{

"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}}"

}

}

]

}

text

**/.vscode/mcp.json** - MCP server configuration:

{

"serverUrl": "https://api.service.com/mcp/",

"pluginFilePath": "appPackage/ai-plugin.json"

}

text

## 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)**

"auth": {

"type": "OAuthPluginVa

🎯 Best For

  • Claude users
  • GitHub Copilot users
  • Software engineers
  • Development teams
  • Tech leads

💡 Use Cases

  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Mcp-Create-Declarative-Agent to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Is Mcp-Create-Declarative-Agent compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Mcp-Create-Declarative-Agent?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Mcp-Create-Declarative-Agent?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/mcp-create-declarative-agent/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills