Skip to content

Commit c030f3c

Browse files
committed
Bringing the MCP server into the repo
1 parent b469c89 commit c030f3c

39 files changed

+4513
-1
lines changed

.aspire/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"appHostPath": "../mcp-server/src/AwesomeCopilot.AppHost/AwesomeCopilot.AppHost.csproj"
3+
}

.github/workflows/docker-image.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CI - Build and push Docker images
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: read
11+
packages: write
12+
id-token: write
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
env:
18+
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/awesome-copilot-mcp-server
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v4
26+
with:
27+
dotnet-version: "9.0.x"
28+
29+
- name: Restore
30+
working-directory: ./mcp-server
31+
run: dotnet restore src/AwesomeCopilot.McpServer/AwesomeCopilot.McpServer.csproj
32+
33+
- name: Run unit tests (if any)
34+
working-directory: ./mcp-server
35+
run: |
36+
if [ -f "src/AwesomeCopilot.McpServer/Tests.csproj" ]; then
37+
dotnet test --no-build --verbosity normal
38+
else
39+
echo "No tests found, skipping"
40+
fi
41+
42+
- name: Login to GHCR
43+
uses: docker/login-action@v2
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.actor }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Build and push image
50+
uses: docker/build-push-action@v4
51+
with:
52+
context: ./mcp-server
53+
file: ./mcp-server/Dockerfile
54+
platforms: linux/amd64
55+
push: true
56+
tags: |
57+
${{ env.IMAGE_NAME }}:latest
58+
${{ env.IMAGE_NAME }}:${{ github.sha }}
59+
build-args: |
60+
RUNTIME=linux-x64
61+
62+
- name: Image cleanup
63+
run: docker image prune -f || true

.vscode/settings.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
"*.chatmode.md": "markdown",
2323
"*.instructions.md": "markdown",
2424
"*.prompt.md": "markdown"
25-
}
25+
},
26+
"python-envs.defaultEnvManager": "ms-python.python:system",
27+
"python-envs.pythonProjects": []
2628
}

mcp-server/.dockerignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Include any files or directories that you don't want to be copied to your
2+
# container here (e.g., local build artifacts, temporary files, etc.).
3+
#
4+
# For more help, visit the .dockerignore file reference guide at
5+
# https://docs.docker.com/go/build-context-dockerignore/
6+
7+
**/.DS_Store
8+
**/.classpath
9+
**/.dockerignore
10+
**/.env
11+
**/.git
12+
**/.gitignore
13+
**/.project
14+
**/.settings
15+
**/.toolstarget
16+
**/.vs
17+
**/.vscode
18+
**/*.*proj.user
19+
**/*.dbmdl
20+
**/*.jfm
21+
**/bin
22+
**/charts
23+
**/docker-compose*
24+
**/compose.y*ml
25+
**/Dockerfile*
26+
**/node_modules
27+
**/npm-debug.log
28+
**/obj
29+
**/secrets.dev.yaml
30+
**/values.dev.yaml
31+
LICENSE
32+
README.md

mcp-server/.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
src/awesome-copilot/
2+
3+
!.vscode/mcp.json
4+
.azure
5+
.vs
6+
bin
7+
obj
8+
*.user
9+
*.suo
10+
appsettings.*.json

mcp-server/AwesomeCopilot.slnx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<Solution>
2+
<Configurations>
3+
<Platform Name="Any CPU" />
4+
<Platform Name="x64" />
5+
<Platform Name="x86" />
6+
</Configurations>
7+
<Folder Name="/src/">
8+
<Project Path="src/AwesomeCopilot.AppHost/AwesomeCopilot.AppHost.csproj" />
9+
<Project Path="src/AwesomeCopilot.McpServer/AwesomeCopilot.McpServer.csproj" />
10+
<Project Path="src/AwesomeCopilot.ServiceDefaults/AwesomeCopilot.ServiceDefaults.csproj" />
11+
</Folder>
12+
</Solution>

mcp-server/Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM mcr.microsoft.com/dotnet/sdk:10.0-noble-aot AS build
4+
WORKDIR /src
5+
6+
# Copy everything and restore/publish
7+
COPY . .
8+
9+
ARG CONFIG=Release
10+
ARG RUNTIME=linux-x64
11+
12+
RUN dotnet restore src/AwesomeCopilot.McpServer/AwesomeCopilot.McpServer.csproj
13+
14+
# Publish: if PUBLISH_AOT=true, enable Native AOT publish flags
15+
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;
16+
17+
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-noble-chiseled AS release
18+
WORKDIR /app
19+
COPY --from=build /app/publish/ .
20+
EXPOSE 8080
21+
ENTRYPOINT ["/app/AwesomeCopilot.McpServer"]

mcp-server/NuGet.config

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<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" />
6+
<add key="https://api.nuget.org/v3/index.json" value="https://api.nuget.org/v3/index.json" />
7+
</packageSources>
8+
<packageSourceMapping>
9+
<packageSource key="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet9/nuget/v3/index.json">
10+
<package pattern="Aspire*" />
11+
<package pattern="Microsoft.Extensions.ServiceDiscovery*" />
12+
</packageSource>
13+
<packageSource key="https://api.nuget.org/v3/index.json">
14+
<package pattern="*" />
15+
</packageSource>
16+
</packageSourceMapping>
17+
</configuration>

mcp-server/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# MCP Server: Awesome Copilot
2+
3+
This is an MCP server that retrieves GitHub Copilot customizations from the [awesome-copilot](https://github.com/github/awesome-copilot) repository.
4+
5+
## Install
6+
7+
[![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)
8+
9+
## Prerequisites
10+
11+
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
12+
- Aspire CLI nightly: `iex "& { $(irm https://aspire.dev/install.ps1) } -Quality dev"`
13+
- [Visual Studio Code](https://code.visualstudio.com/) with
14+
- [C# Dev Kit](https://marketplace.visualstudio.com/items/?itemName=ms-dotnettools.csdevkit) extension
15+
- [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd)
16+
- [Docker Desktop](https://docs.docker.com/get-started/get-docker/)
17+
18+
## What's Included
19+
20+
Awesome Copilot MCP server includes:
21+
22+
| Building Block | Name | Description | Usage |
23+
| -------------- | --------------------- | --------------------------------------------------------------------- | ---------------------------------------- |
24+
| Tools | `search_instructions` | Searches custom instructions based on keywords in their descriptions. | `#search_instructions` |
25+
| Tools | `load_instruction` | Loads a custom instruction from the repository. | `#load_instruction` |
26+
| Prompts | `get_search_prompt` | Get a prompt for searching copilot instructions. | `/mcp.awesome-copilot.get_search_prompt` |
27+
28+
## Getting Started
29+
30+
- [Getting repository root](#getting-repository-root)
31+
- [Running MCP server](#running-mcp-server)
32+
- [On a local machine](#on-a-local-machine)
33+
- [In a container](#in-a-container)
34+
- [On Azure](#on-azure)
35+
- [Connect MCP server to an MCP host/client](#connect-mcp-server-to-an-mcp-hostclient)
36+
- [VS Code + Agent Mode + Local MCP server](#vs-code--agent-mode--local-mcp-server)
37+
38+
### Running MCP server
39+
40+
#### On a local machine
41+
42+
1. Run the MCP server app using Aspire.
43+
44+
```bash
45+
aspire run
46+
```
47+
48+
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.
49+
50+
#### In a container
51+
52+
1. Build the MCP server app as a container image.
53+
54+
```bash
55+
cd mcp-server
56+
docker build -f Dockerfile -t awesome-copilot:latest .
57+
```
58+
59+
1. Run the MCP server app in a container.
60+
61+
```bash
62+
docker run -i --rm -p 8080:8080 awesome-copilot:latest
63+
```
64+
65+
Alternatively, use the container image from the container registry.
66+
67+
```bash
68+
docker run -i --rm -p 8080:8080 ghcr.io/github/awesome-copilot:latest
69+
```
70+
71+
#### On Azure
72+
73+
1. Navigate to the directory.
74+
75+
```bash
76+
cd mcp-server
77+
```
78+
79+
1. Login to Azure.
80+
81+
```bash
82+
# Login with Azure Developer CLI
83+
azd auth login
84+
```
85+
86+
1. Deploy the MCP server app to Azure.
87+
88+
```bash
89+
azd up
90+
```
91+
92+
While provisioning and deploying, you'll be asked to provide subscription ID, location, environment name.
93+
94+
1. After the deployment is complete, get the information by running the following commands:
95+
96+
- Azure Container Apps FQDN:
97+
98+
```bash
99+
azd env get-value AZURE_RESOURCE_MCP_AWESOME_COPILOT_FQDN
100+
```
101+
102+
### Connect MCP server to an MCP host/client
103+
104+
#### Install the MCP server:
105+
106+
[![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)
107+
108+
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`.
109+
1. Choose `awesome-copilot` then click `Start Server`.
110+
1. When prompted, enter one of the following values:
111+
- The absolute directory path of the `AwesomeCopilot.McpServer` project
112+
- The FQDN of Azure Container Apps.
113+
1. Use a prompt by typing `/mcp.awesome-copilot.get_search_prompt` and enter keywords to search. You'll get a prompt like:
114+
115+
```text
116+
Please search all the chatmodes, instructions and prompts that are related to the search keyword, `{keyword}`.
117+
118+
Here's the process to follow:
119+
120+
1. Use the `awesome-copilot` MCP server.
121+
1. Search all chatmodes, instructions, and prompts for the keyword provided.
122+
1. DO NOT load any chatmodes, instructions, or prompts from the MCP server until the user asks to do so.
123+
1. Scan local chatmodes, instructions, and prompts markdown files in `.github/chatmodes`, `.github/instructions`, and `.github/prompts` directories respectively.
124+
1. Compare existing chatmodes, instructions, and prompts with the search results.
125+
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:
126+
127+
| Exists | Mode | Filename | Title | Description |
128+
|--------|--------------|------------------------|---------------|---------------|
129+
| ✅ | chatmodes | chatmode1.json | ChatMode 1 | Description 1 |
130+
| ❌ | instructions | instruction1.json | Instruction 1 | Description 1 |
131+
| ✅ | prompts | prompt1.json | Prompt 1 | Description 1 |
132+
133+
✅ indicates that the item already exists in this repository, while ❌ indicates that it does not.
134+
135+
1. If any item doesn't exist in the repository, ask which item the user wants to save.
136+
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.
137+
```
138+
139+
1. Confirm the result.

mcp-server/azure.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/Azure/azure-dev/main/schemas/v1.0/azure.yaml.json
2+
3+
name: awesome-copilot
4+
5+
metadata:
6+
7+
8+
services:
9+
awesome-copilot:
10+
project: src/AwesomeCopilot.McpServer
11+
host: containerapp
12+
language: dotnet
13+
docker:
14+
path: ../../../Dockerfile.awesome-copilot-azure
15+
context: ../../../
16+
remoteBuild: true

0 commit comments

Comments
 (0)