ProjectDocsServer
Example implementation of an MCP server that uses MCP resources
Ask AI about ProjectDocsServer
Powered by Claude Β· Grounded in docs
I know everything about ProjectDocsServer. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
ProjectDocsServer
A Model Context Protocol (MCP) server that exposes project documentation and resources through a standardized protocol. This server demonstrates how to create an MCP server using .NET 9 and C# that provides various types of resources including static content, dynamic file access, project statistics, and progress-reporting operations.
What is MCP?
The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context to Large Language Models (LLMs). This project implements an MCP server that exposes project-related resources that can be consumed by MCP clients.
Features
This MCP server exposes the following resources:
project://readme- Returns the project README contentproject://config- Returns project configuration as JSONproject://file/{path}- Returns the content of a file at the specified path (with security restrictions)project://logs/{date}- Returns application logs for a specific date (yyyy-MM-dd format)project://files/list- Returns a list of all files in the projectproject://stats- Returns project statistics (file counts, size, timestamp)project://analyze- Performs deep analysis of the project with progress reportingproject://diagram- Returns a project architecture diagram (PNG image)
Technology Stack
- .NET 9.0 - Target framework
- C# 13.0 - Programming language
- ModelContextProtocol (v0.4.1-preview.1) - Core MCP protocol implementation
- ModelContextProtocol.AspNetCore (v0.4.1-preview.1) - ASP.NET Core integration
- Microsoft.Extensions.Hosting - Host builder and dependency injection
Project Structure
ProjectDocsServer/
βββ Program.cs # Entry point and MCP server configuration
βββ ProjectResource.cs # Resource implementations
βββ ProjectDocsServer.csproj # Project file
βββ README.md # This file
Building the Project
dotnet build
Running the Server
dotnet run
The server runs using STDIO transport, which means it communicates through standard input/output. All logging is directed to stderr to avoid interfering with the MCP protocol communication.
Testing with Model Context Inspector
The Model Context Inspector is a developer tool for testing and debugging MCP servers. Here's how to test this server:
Installation
Install the Model Context Inspector globally:
npm install -g @modelcontextprotocol/inspector
Testing the Server
- Start the Inspector:
npx @modelcontextprotocol/inspector dotnet run
- Configure the Server Connection:
In the Inspector UI, add your server configuration:
{
"command": "dotnet",
"args": ["run", "--project", "path/to/ProjectDocsServer/ProjectDocsServer.csproj"]
}
Or if you've already built the project:
{
"command": "dotnet",
"args": ["path/to/ProjectDocsServer/bin/Debug/net9.0/ProjectDocsServer.dll"]
}
- Connect to the Server:
Click "Connect" in the Inspector interface. You should see the server initialize and the available resources listed.
Testing Resources
Once connected, you can test each resource:
Test Static Resources
- README: Request
project://readmeto get the project documentation - Config: Request
project://configto get configuration JSON - Stats: Request
project://statsto get project statistics
Test Dynamic Resources
- File Access: Request
project://file/Program.csto read the Program.cs file - Logs: Request
project://logs/2024-01-15to get logs for January 15, 2024 - File List: Request
project://files/listto see all project files
