mcp-server-example
Copilot instructions1 starsChanged 19 months agoMITView on GitHub
Debug interactively with the MCP Inspector: Connect the inspector using Transport Type: Streamable HTTP to http://localhost:5168/ (root endpoint — not /sse). As of SDK v1.2.0, legacy SSE is disabled by default. No test project exists — use the MCP Inspector for integration testing. This is an ASP.NET Core MCP server using ModelContextProtocol.AspNetCore (v1.2.0). The three MCP primitives map to three folders: Program.cs wires everything together via a fluent builder: ResourceGenerator.cs pre-generates 100 mock resources at startup (alternating plaintext/base64) for the…
The file
We split this copilot-instructions.md into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
No test project exists — use the MCP Inspector for integration testing.
- Very specific: line 46
Create a class in Tools/ decorated with [McpServerToolType] and [Description("...")]
- Very specific: line 47
Add methods decorated with [McpServerTool] and [Description("...")] on parameters
- Very specific: line 51
Create a class in Resources/ with [McpServerResourceType]
- Very specific: line 52
Use [McpServerResource(UriTemplate = "scheme://path/{param}")] for template resources
- Very specific: line 57
Add methods with [McpServerPrompt]
- Very specific: line 62
Icons: Add IconSource = "https://..." to [McpServerTool], [McpServerResource], and [McpServerPrompt] attributes — use Fluent UI Emoji SVG …
- Very specific: line 67
Secret masking: Use GitLabExtensions.MaskValue() (shows first 4 chars) when returning sensitive values in tool responses
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions
Build & Run
dotnet build
dotnet run # Starts MCP server on http://localhost:5168Debug interactively with the MCP Inspector:
npx @modelcontextprotocol/inspector dotnet runConnect the inspector using Transport Type: Streamable HTTP to http://localhost:5168/ (root endpoint — not /sse). As of SDK v1.2.0, legacy SSE is disabled by default.
No test project exists — use the MCP Inspector for integration testing.
Architecture
This is an ASP.NET Core MCP server using ModelContextProtocol.AspNetCore (v1.2.0). The three MCP primitives map to three folders:
| Folder | MCP Primitive | Purpose |
Tools/ | Tool | Actions the LLM can invoke |
Resources/ | Resource | Data/content the LLM can read |
Prompts/ | Prompt | Instruction templates |
Program.cs wires everything together via a fluent builder:
builder.Services.AddMcpServer()
.WithHttpTransport()
.WithTools<GitLabTools>()
.WithResources<UserResources>()
.WithPrompts<TextPrompts>();
app.MapMcp();ResourceGenerator.cs pre-generates 100 mock resources at startup (alternating plaintext/base64) for the test://template/resource/{id} URI template.
Adding New Tools / Resources / Prompts
Tool:
- Create a class in
Tools/decorated with[McpServerToolType]and[Description("...")] - Add methods decorated with
[McpServerTool]and[Description("...")]on parameters - Register in
Program.cs:.WithTools<YourToolClass>()
Resource:
- Create a class in
Resources/with[McpServerResourceType] - Use
[McpServerResource(UriTemplate = "scheme://path/{param}")]for template resources - Register:
.WithResources<YourResourceClass>()
Prompt:
- Create a class in
Prompts/with[McpServerPromptType] - Add methods with
[McpServerPrompt] - Register:
.WithPrompts<YourPromptClass>()
Key Conventions
- Icons: Add
IconSource = "https://..."to[McpServerTool],[McpServerResource], and[McpServerPrompt]attributes — use Fluent UI Emoji SVG URLs (e.g.https://raw.githubusercontent.com/microsoft/fluentui-emoji/main/assets/Cloud/Flat/cloud_flat.svg) - Naming:
[Feature]Tools,[Feature]Resources,[Feature]Prompts - Async: Async methods use the
Asyncsuffix - DI: Inject
ILogger<T>,IConfiguration,ArmClient, orMcpServervia constructor - YAML:
UserResourcesserializes data as YAML usingYamlDotNet— follow this pattern for structured resource output - Secret masking: Use
GitLabExtensions.MaskValue()(shows first 4 chars) when returning sensitive values in tool responses - Git operations:
GitLabToolsshells out viaProcessStartInfofor git commands — follow the same pattern for any CLI subprocess calls
Configuration & Secrets
GitLab credentials are stored in user secrets (never in appsettings):
dotnet user-secrets set "GitLab:Token" "<PAT>"
dotnet user-secrets set "GitLab:Domain" "<gitlab-domain-url>"Access via ConfigurationExtensions:
var token = configuration.GetGitLabToken();
var domain = configuration.GetGitLabDomain();Azure auth uses DefaultAzureCredential — no explicit credentials in config.
Docker & CI
docker build -t mcp-server-example . # Multi-stage build, exposes port 8080The CI pipeline (docker-build.yml) is generated by setup-workflow.sh — edit the shell script, not the workflow file directly. It builds multi-platform images (linux/amd64, linux/arm64) and tags as VERSION on main or VERSION-preview-TIMESTAMP on feature branches.
Secrets required in the GitHub repo: DOCKER_USERNAME, DOCKER_PASSWORD.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

