Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/datadog-synthetics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# (File deleted: Remove .github/workflows/datadog-synthetics.yml from the PR)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This repository provides a comprehensive toolkit for enhancing GitHub Copilot wi
- **👉 [Awesome Prompts](docs/README.prompts.md)** - Focused, task-specific prompts for generating code, documentation, and solving specific problems
- **👉 [Awesome Instructions](docs/README.instructions.md)** - Comprehensive coding standards and best practices that apply to specific file patterns or entire projects
- **👉 [Awesome Collections](docs/README.collections.md)** - Curated collections of related prompts, instructions, and chat modes organized around specific themes and workflows
- **👉 [MCP Server API](docs/README.mcp-api.md)** - Complete API documentation for the Awesome Copilot MCP Server, including available tools, usage examples, and integration guides

## 🌟 Featured Collections

Expand All @@ -30,6 +31,8 @@ Discover our curated collections of prompts, instructions, and agents organized

To make it easy to add these customizations to your editor, we have created a [MCP Server](https://developer.microsoft.com/blog/announcing-awesome-copilot-mcp-server) that provides a prompt for searching and installing prompts, instructions, and chat modes directly from this repository. You'll need to have Docker installed and running to run the server.

**📖 [View complete API documentation](docs/README.mcp-api.md)** for detailed information on available tools, usage examples, and integration guides.

[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode) [![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vscode-insiders) [![Install in Visual Studio](https://img.shields.io/badge/Visual_Studio-Install-C16FDE?logo=visualstudio&logoColor=white)](https://aka.ms/awesome-copilot/mcp/vs)

<details>
Expand Down
2 changes: 2 additions & 0 deletions docs/README.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ Team and project-specific instructions to enhance GitHub Copilot's behavior for
| [Best Practices and Guidance for Code Components](../instructions/pcf-best-practices.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fpcf-best-practices.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fpcf-best-practices.instructions.md) | Best practices and guidance for developing PCF code components |
| [Bicep Code Best Practices](../instructions/bicep-code-best-practices.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fbicep-code-best-practices.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fbicep-code-best-practices.instructions.md) | Infrastructure as Code with Bicep |
| [Blazor](../instructions/blazor.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fblazor.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fblazor.instructions.md) | Blazor component and application patterns |
| [C# 14 Best Practices for AI Code Generation Instructions](../instructions/csharp-14-best-practices.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-14-best-practices.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-14-best-practices.instructions.md) | C# 14 best practices and formatting guidelines for AI code generation. |
| [C# Best Practices for AI Code Generation Instructions](../instructions/csharp-best-practices.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-best-practices.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-best-practices.instructions.md) | C# best practices and formatting guidelines for AI code generation (all versions). |
| [C# Development](../instructions/csharp.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp.instructions.md) | Guidelines for building C# applications |
| [C# MCP Server Development](../instructions/csharp-mcp-server.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-mcp-server.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-mcp-server.instructions.md) | Instructions for building Model Context Protocol (MCP) servers using the C# SDK |
| [C# 코드 작성 규칙](../instructions/csharp-ko.instructions.md)<br />[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-ko.instructions.md)<br />[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://aka.ms/awesome-copilot/install/instructions?url=vscode-insiders%3Achat-instructions%2Finstall%3Furl%3Dhttps%3A%2F%2Fraw.githubusercontent.com%2Fgithub%2Fawesome-copilot%2Fmain%2Finstructions%2Fcsharp-ko.instructions.md) | C# 애플리케이션 개발을 위한 코드 작성 규칙 by @jgkim999 |
Expand Down
352 changes: 352 additions & 0 deletions docs/README.mcp-api.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,352 @@
# (This file should be removed from the current PR and moved to a separate PR focused on MCP Server documentation.)
**回傳:**
- Prompt 清單,包含名稱、描述、標籤和檔案路徑

**範例:**
```typescript
// 搜尋所有 prompts
await searchPrompts({});

// 依關鍵字搜尋
await searchPrompts({ query: "README" });

// 依標籤篩選
await searchPrompts({ tags: ["documentation", "github"] });
```

### 2. `search_instructions`

搜尋可用的 instructions。

**參數:**
- `query` (string, 選填): 搜尋關鍵字
- `language` (string, 選填): 依程式語言篩選
- `applyTo` (string, 選填): 依套用模式篩選

**回傳:**
- Instruction 清單,包含名稱、描述、套用模式和檔案路徑

**範例:**
```typescript
// 搜尋 TypeScript 相關的 instructions
await searchInstructions({ language: "TypeScript" });

// 搜尋套用於特定檔案模式的 instructions
await searchInstructions({ applyTo: "*.js" });
```

### 3. `search_chatmodes`

搜尋可用的 chat modes。

**參數:**
- `query` (string, 選填): 搜尋關鍵字
- `role` (string, 選填): 依角色類型篩選(如 "architect", "expert", "specialist")

**回傳:**
- Chat mode 清單,包含名稱、描述、工具和模型資訊

**範例:**
```typescript
// 搜尋所有 chat modes
await searchChatmodes({});

// 搜尋特定角色的 chat modes
await searchChatmodes({ role: "architect" });
```

### 4. `search_agents`

搜尋可用的 custom agents。

**參數:**
- `query` (string, 選填): 搜尋關鍵字
- `mcpServer` (string, 選填): 依需要的 MCP 伺服器篩選

**回傳:**
- Agent 清單,包含名稱、描述、所需 MCP 伺服器和安裝連結

**範例:**
```typescript
// 搜尋所有 agents
await searchAgents({});

// 搜尋使用特定 MCP 伺服器的 agents
await searchAgents({ mcpServer: "github" });
```

### 5. `get_content`

取得特定 prompt、instruction、chat mode 或 agent 的完整內容。

**參數:**
- `path` (string, 必填): 檔案相對路徑(如 `prompts/create-readme.prompt.md`)

**回傳:**
- 檔案完整內容,包含 frontmatter 和主體文字

**範例:**
```typescript
// 取得特定 prompt 的內容
await getContent({ path: "prompts/create-readme.prompt.md" });

// 取得特定 agent 的內容
await getContent({ path: "agents/terraform.agent.md" });
```

### 6. `install_item`

協助安裝 prompt、instruction、chat mode 或 agent 到使用者的環境。

**參數:**
- `path` (string, 必填): 要安裝的項目路徑
- `target` (string, 選填): 安裝目標位置(預設為 VS Code 設定)

**回傳:**
- 安裝指示和確認訊息

**範例:**
```typescript
// 安裝 prompt
await installItem({ path: "prompts/create-readme.prompt.md" });

// 安裝 chat mode
await installItem({ path: "chatmodes/architect.chatmode.md" });
```

### 7. `list_collections`

列出可用的集合。

**參數:**

**回傳:**
- Collection 清單,包含名稱、描述和包含的項目

**範例:**
```typescript
// 列出所有集合
await listCollections();
```

### 8. `get_collection_items`

取得特定集合中的所有項目。

**參數:**
- `collection` (string, 必填): 集合名稱

**回傳:**
- 集合中所有項目的詳細資訊

**範例:**
```typescript
// 取得特定集合的內容
await getCollectionItems({ collection: "awesome-copilot" });
```

## 使用情境範例

### 範例 1:搜尋並安裝 README 生成器

```typescript
// 1. 搜尋 README 相關的 prompts
const results = await searchPrompts({ query: "README" });

// 2. 查看第一個結果的詳細內容
const content = await getContent({ path: results[0].path });

// 3. 安裝到本地環境
await installItem({ path: results[0].path });
```

### 範例 2:尋找適合的 Architecture Agent

```typescript
// 1. 搜尋 architecture 相關的 agents
const agents = await searchAgents({ query: "architect" });

// 2. 篩選需要特定工具的 agents
const filteredAgents = agents.filter(a => a.mcpServers.includes("github"));

// 3. 查看 agent 詳細資訊
const agentDetails = await getContent({ path: filteredAgents[0].path });
```

### 範例 3:探索集合

```typescript
// 1. 列出所有集合
const collections = await listCollections();

// 2. 取得 "awesome-copilot" 集合的內容
const items = await getCollectionItems({ collection: "awesome-copilot" });

// 3. 安裝集合中的項目
for (const item of items) {
await installItem({ path: item.path });
}
```

## 錯誤處理

MCP Server 可能回傳以下錯誤:

### 常見錯誤碼

- **404 Not Found**: 請求的項目不存在
- **400 Bad Request**: 參數格式錯誤或缺少必填參數
- **500 Internal Server Error**: 伺服器內部錯誤

### 錯誤回應格式

```json
{
"error": {
"code": "NOT_FOUND",
"message": "The requested item was not found",
"details": "Path 'prompts/nonexistent.prompt.md' does not exist"
}
}
```

### 處理錯誤的最佳實務

1. **檢查路徑**: 確認檔案路徑正確,使用相對於儲存庫根目錄的路徑
2. **驗證參數**: 確保所有必填參數都已提供且格式正確
3. **處理網路問題**: MCP Server 透過 Docker 執行,確保 Docker 服務正常運作
4. **重試機制**: 對於暫時性錯誤,實作指數退避重試策略

## 進階設定

### 自訂 Docker 映像

如果你想使用自訂的 Docker 映像:

```json
{
"servers": {
"awesome-copilot": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"your-registry/awesome-copilot:custom-tag"
]
}
}
}
```

### 環境變數

可透過 Docker args 傳遞環境變數:

```json
{
"servers": {
"awesome-copilot": {
"type": "stdio",
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e", "CUSTOM_SETTING=value",
"ghcr.io/microsoft/mcp-dotnet-samples/awesome-copilot:latest"
]
}
}
}
```

### 本地開發模式

在本地開發時,可以直接執行伺服器而不透過 Docker:

```json
{
"servers": {
"awesome-copilot": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"/path/to/awesome-copilot-server"
]
}
}
}
```

## 效能最佳化

### 快取策略

MCP Server 會快取搜尋結果以提升效能。快取會在以下情況下自動更新:
- 伺服器重啟時
- 儲存庫內容更新時

### 批次操作

當需要安裝多個項目時,建議使用批次操作以減少網路請求:

```typescript
// 較佳做法:批次取得內容
const paths = ["prompts/item1.prompt.md", "prompts/item2.prompt.md"];
const contents = await Promise.all(paths.map(path => getContent({ path })));

// 然後批次安裝
await Promise.all(paths.map(path => installItem({ path })));
```

## 疑難排解

### Docker 相關問題

**問題**: MCP Server 無法啟動

**解決方案**:
1. 確認 Docker 已安裝並執行:`docker --version`
2. 確認可以拉取映像:`docker pull ghcr.io/microsoft/mcp-dotnet-samples/awesome-copilot:latest`
3. 檢查 Docker 日誌:`docker logs <container_id>`

### 搜尋結果為空

**問題**: 搜尋工具回傳空結果

**解決方案**:
1. 確認搜尋關鍵字拼寫正確
2. 嘗試使用更寬鬆的搜尋條件
3. 使用不帶參數的搜尋以列出所有項目

### 安裝失敗

**問題**: 安裝項目時失敗

**解決方案**:
1. 確認目標路徑可寫入
2. 檢查是否有足夠的磁碟空間
3. 確認 VS Code/Visual Studio 設定權限正確

## 相關資源

- [MCP Server 官方公告](https://developer.microsoft.com/blog/announcing-awesome-copilot-mcp-server)
- [Model Context Protocol 規範](https://modelcontextprotocol.io/)
- [VS Code Copilot 自訂文件](https://code.visualstudio.com/docs/copilot/copilot-customization)
- [儲存庫主頁](https://github.com/github/awesome-copilot)

## 貢獻與回饋

如有問題或建議,請:
1. 在 [GitHub Issues](https://github.com/github/awesome-copilot/issues) 提交問題
2. 參考 [貢獻指南](../CONTRIBUTING.md)
3. 加入社群討論

## 授權

本專案採用 MIT 授權 - 詳見 [LICENSE](../LICENSE) 檔案。
Loading