Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .aspire/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"appHostPath": "../mcp-server/src/AwesomeCopilot.AppHost/AwesomeCopilot.AppHost.csproj"
}
63 changes: 63 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: CI - Build and push Docker images

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read
packages: write
id-token: write

jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/awesome-copilot-mcp-server

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Restore
working-directory: ./mcp-server
run: dotnet restore src/AwesomeCopilot.McpServer/AwesomeCopilot.McpServer.csproj

- name: Run unit tests (if any)
working-directory: ./mcp-server
run: |
if [ -f "src/AwesomeCopilot.McpServer/Tests.csproj" ]; then
dotnet test --no-build --verbosity normal
else
echo "No tests found, skipping"
fi

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v4
with:
context: ./mcp-server
file: ./mcp-server/Dockerfile
platforms: linux/amd64
push: true
tags: |
${{ env.IMAGE_NAME }}:latest
${{ env.IMAGE_NAME }}:${{ github.sha }}
build-args: |
RUNTIME=linux-x64

- name: Image cleanup
run: docker image prune -f || true
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
"*.chatmode.md": "markdown",
"*.instructions.md": "markdown",
"*.prompt.md": "markdown"
}
},
"python-envs.defaultEnvManager": "ms-python.python:system",
"python-envs.pythonProjects": []
}
32 changes: 32 additions & 0 deletions mcp-server/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/

**/.DS_Store
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
10 changes: 10 additions & 0 deletions mcp-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
src/awesome-copilot/

!.vscode/mcp.json
.azure
.vs
bin
obj
*.user
*.suo
appsettings.*.json
12 changes: 12 additions & 0 deletions mcp-server/AwesomeCopilot.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Solution>
<Configurations>
<Platform Name="Any CPU" />
<Platform Name="x64" />
<Platform Name="x86" />
</Configurations>
<Folder Name="/src/">
<Project Path="src/AwesomeCopilot.AppHost/AwesomeCopilot.AppHost.csproj" />
<Project Path="src/AwesomeCopilot.McpServer/AwesomeCopilot.McpServer.csproj" />
<Project Path="src/AwesomeCopilot.ServiceDefaults/AwesomeCopilot.ServiceDefaults.csproj" />
</Folder>
</Solution>
21 changes: 21 additions & 0 deletions mcp-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# syntax=docker/dockerfile:1

FROM mcr.microsoft.com/dotnet/sdk:10.0-noble-aot AS build
WORKDIR /src

# Copy everything and restore/publish
COPY . .

ARG CONFIG=Release
ARG RUNTIME=linux-x64

RUN dotnet restore src/AwesomeCopilot.McpServer/AwesomeCopilot.McpServer.csproj

# Publish: if PUBLISH_AOT=true, enable Native AOT publish flags
RUN dotnet publish src/AwesomeCopilot.McpServer -c $CONFIG -r $RUNTIME -p:PublishAot=true -p:PublishTrimmed=true -p:TrimMode=link -p:PublishSingleFile=true -o /app/publish;

FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-noble-chiseled AS release
WORKDIR /app
COPY --from=build /app/publish/ .
EXPOSE 8080
ENTRYPOINT ["/app/AwesomeCopilot.McpServer"]
17 changes: 17 additions & 0 deletions mcp-server/NuGet.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json" />
<add key="https://api.nuget.org/v3/index.json" value="https://api.nuget.org/v3/index.json" />
</packageSources>
<packageSourceMapping>
<packageSource key="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json">
<package pattern="Aspire*" />
<package pattern="Microsoft.Extensions.ServiceDiscovery*" />
</packageSource>
<packageSource key="https://api.nuget.org/v3/index.json">
<package pattern="*" />
</packageSource>
</packageSourceMapping>
</configuration>
139 changes: 139 additions & 0 deletions mcp-server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# MCP Server: Awesome Copilot

This is an MCP server that retrieves GitHub Copilot customizations from the [awesome-copilot](https://github.com/github/awesome-copilot) repository.

## Install

[![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/mcp/vscode) [![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/mcp/vscode-insiders)

## Prerequisites

- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
- Aspire CLI nightly: `iex "& { $(irm https://aspire.dev/install.ps1) } -Quality dev"`
- [Visual Studio Code](https://code.visualstudio.com/) with
- [C# Dev Kit](https://marketplace.visualstudio.com/items/?itemName=ms-dotnettools.csdevkit) extension
- [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd)
- [Docker Desktop](https://docs.docker.com/get-started/get-docker/)

## What's Included

Awesome Copilot MCP server includes:

| Building Block | Name | Description | Usage |
| -------------- | --------------------- | --------------------------------------------------------------------- | ---------------------------------------- |
| Tools | `search_instructions` | Searches custom instructions based on keywords in their descriptions. | `#search_instructions` |
| Tools | `load_instruction` | Loads a custom instruction from the repository. | `#load_instruction` |
| Prompts | `get_search_prompt` | Get a prompt for searching copilot instructions. | `/mcp.awesome-copilot.get_search_prompt` |

## Getting Started

- [Getting repository root](#getting-repository-root)
- [Running MCP server](#running-mcp-server)
- [On a local machine](#on-a-local-machine)
- [In a container](#in-a-container)
- [On Azure](#on-azure)
- [Connect MCP server to an MCP host/client](#connect-mcp-server-to-an-mcp-hostclient)
- [VS Code + Agent Mode + Local MCP server](#vs-code--agent-mode--local-mcp-server)

### Running MCP server

#### On a local machine

1. Run the MCP server app using Aspire.

```bash
aspire run
```

Once running, the Aspire dashboard will be loaded in your default web browser, or you can click the URL provided in the terminal. From here, you'll have access to the MCP server endpoint, logs and metrics.

#### In a container

1. Build the MCP server app as a container image.

```bash
cd mcp-server
docker build -f Dockerfile -t awesome-copilot:latest .
```

1. Run the MCP server app in a container.

```bash
docker run -i --rm -p 8080:8080 awesome-copilot:latest
```

Alternatively, use the container image from the container registry.

```bash
docker run -i --rm -p 8080:8080 ghcr.io/github/awesome-copilot:latest
```

#### On Azure

1. Navigate to the directory.

```bash
cd mcp-server
```

1. Login to Azure.

```bash
# Login with Azure Developer CLI
azd auth login
```

1. Deploy the MCP server app to Azure.

```bash
azd up
```

While provisioning and deploying, you'll be asked to provide subscription ID, location, environment name.

1. After the deployment is complete, get the information by running the following commands:

- Azure Container Apps FQDN:

```bash
azd env get-value AZURE_RESOURCE_MCP_AWESOME_COPILOT_FQDN
```

### Connect MCP server to an MCP host/client

#### Install the MCP server:

[![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/mcp/vscode) [![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/mcp/vscode-insiders)

1. Open Command Palette by typing `F1` or `Ctrl`+`Shift`+`P` on Windows or `Cmd`+`Shift`+`P` on Mac OS, and search `MCP: List Servers`.
1. Choose `awesome-copilot` then click `Start Server`.
1. When prompted, enter one of the following values:
- The absolute directory path of the `AwesomeCopilot.McpServer` project
- The FQDN of Azure Container Apps.
1. Use a prompt by typing `/mcp.awesome-copilot.get_search_prompt` and enter keywords to search. You'll get a prompt like:

```text
Please search all the chatmodes, instructions and prompts that are related to the search keyword, `{keyword}`.

Here's the process to follow:

1. Use the `awesome-copilot` MCP server.
1. Search all chatmodes, instructions, and prompts for the keyword provided.
1. DO NOT load any chatmodes, instructions, or prompts from the MCP server until the user asks to do so.
1. Scan local chatmodes, instructions, and prompts markdown files in `.github/chatmodes`, `.github/instructions`, and `.github/prompts` directories respectively.
1. Compare existing chatmodes, instructions, and prompts with the search results.
1. Provide a structured response in a table format that includes the already exists, mode (chatmodes, instructions or prompts), filename, title and description of each item found. Here's an example of the table format:

| Exists | Mode | Filename | Title | Description |
|--------|--------------|------------------------|---------------|---------------|
| ✅ | chatmodes | chatmode1.json | ChatMode 1 | Description 1 |
| ❌ | instructions | instruction1.json | Instruction 1 | Description 1 |
| ✅ | prompts | prompt1.json | Prompt 1 | Description 1 |

✅ indicates that the item already exists in this repository, while ❌ indicates that it does not.

1. If any item doesn't exist in the repository, ask which item the user wants to save.
1. If the user wants to save it, save the item in the appropriate directory (`.github/chatmodes`, `.github/instructions`, or `.github/prompts`) using the mode and filename, with NO modification.
```

1. Confirm the result.
16 changes: 16 additions & 0 deletions mcp-server/azure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json

name: awesome-copilot

metadata:
template: azd-init@1.14.0

services:
awesome-copilot:
project: src/AwesomeCopilot.McpServer
host: containerapp
language: dotnet
docker:
path: ../../../Dockerfile.awesome-copilot-azure
context: ../../../
remoteBuild: true
Loading
Loading