Skip to content

Instantly share code, notes, and snippets.

builder.Services
.AddMcpServer()
.WithResources<ProjectResources>()
.WithHttpTransport()
.WithResourcesFromAssembly();
[McpServerResource(UriTemplate = "project://analyze")]
[Description("Performs deep analysis of the project codebase")]
public async Task<string> AnalyzeProject(
IProgress<ProgressNotificationValue> progress)
{
progress.Report(new ProgressNotificationValue
{
Progress = 0,
Total = 100
});
builder.Services
.AddMcpServer()
.WithResources<ProjectResources>()
.WithStdioServerTransport()
.WithResourcesFromAssembly();
[McpServerResourceType]
public class ProjectResources
{
private readonly ILogger<ProjectResources> _logger;
public ProjectResources(ILogger<ProjectResources> logger)
{
_logger = logger;
}
[McpServerResource(UriTemplate = "project://files/list")]
[Description("Returns a list of all files in the project")]
public static ReadResourceResult ListProjectFiles()
{
var files = Directory.GetFiles(Directory.GetCurrentDirectory(), "*.*",
SearchOption.AllDirectories);
var fileList = string.Join("\n", files.Select(f =>
Path.GetRelativePath(Directory.GetCurrentDirectory(), f)));
[McpServerResource(UriTemplate = "project://file/{path}")]
[Description("Returns the content of a file at the specified path")]
public static async Task<string> GetFileContent(
[Description("The relative file path")] string path)
{
try
{
// Security: Only allow access to files in current directory
var fullPath = Path.GetFullPath(path);
var baseDir = Directory.GetCurrentDirectory();
using ModelContextProtocol.Server;
using System.ComponentModel;
namespace ProjectDocsServer;
[McpServerResourceType]
public static class ProjectResources
{
[McpServerResource(UriTemplate = "project://readme")]
[Description("Returns the project README file content")]
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using ModelContextProtocol.Server;
var builder = Host.CreateApplicationBuilder(args);
// Configure logging to stderr (required for MCP)
builder.Logging.AddConsole(options =>
{
agent tools description
agent
edit/editFiles
search
fetch
Diátaxis Documentation Expert. An expert technical writer specializing in creating high-quality software documentation, guided by the principles and structure of the Diátaxis technical documentation authoring framework.

Diátaxis Documentation Expert

You are an expert technical writer specializing in creating high-quality software documentation. Your work is strictly guided by the principles and structure of the Diátaxis Framework (https://diataxis.fr/).

agent tools description
agent
edit/editFiles
search
fetch
Diátaxis Documentation Expert. An expert technical writer specializing in creating high-quality software documentation, guided by the principles and structure of the Diátaxis technical documentation authoring framework.

Diátaxis Documentation Expert

You are an expert technical writer specializing in creating high-quality software documentation. Your work is strictly guided by the principles and structure of the Diátaxis Framework (https://diataxis.fr/).