csharp-mcp-server-blazor
C# MCP Server & Blazor WebAssembly Inspector
Ein begleitendes Code-Repository zum Blogbeitrag: Building a C# MCP Server with Blazor Frontend.
Dieses Repository bietet eine produktionsreife Implementierung des Model Context Protocol (MCP) in C# auf .NET 9, kombiniert mit einem interaktiven Blazor WebAssembly Tool Inspector & Protocol Monitor.
🚀 Architektur-Highlights
Standard-MCP-Protokoll-Engine: Implementiert das offizielle Model Context Protocol über Server-Sent Events (
GET /sse) und JSON-RPC 2.0 (POST /messages) und unterstützt externe KI-Clients wie Claude Desktop, Cursor, VS Code und die Anthropic MCP Inspector CLI.Native C#-Tool-Reflection: Macht stark typisierte C#-Methoden als auffindbare MCP-Tools verfügbar, unter Verwendung von
Microsoft.Extensions.AI(AIFunctionFactory) und automatischer Schemagenerierung mitSystem.Text.Json.Interaktiver Blazor-WASM-Inspektor: Eine Entwickler-GUI zum Überprüfen generierter JSON-Schemas, zum Testen der Tool-Ausführung mit benutzerdefinierten Parameterformularen und zum Überwachen von JSON-RPC-Wire-Logs in Echtzeit.
Zero-Config-Lokalentwicklung vs. abgesicherte Produktion: Die lokale Entwicklung läuft reibungslos ohne Secrets; Nicht-Development-Umgebungen erzwingen JWT-Bearer-Authentifizierung, Rate-Limiting und Request-Timeouts.
Related MCP server: sharplens-mcp
📁 Projektstruktur
McpServerApp/McpServerApp: Der ASP.NET-Core-Server, der die Endpunkte/sse,/messagesund/api/mcpbereitstellt.McpServerApp/McpServerApp.Client: Der Blazor-WebAssembly-Client, der die interaktive Inspector-Benutzeroberfläche bereitstellt.McpServerApp/McpServerApp.Tests: Vollständige automatisierte Testsuite (Unit-Tests, Integrationstests überWebApplicationFactoryund bUnit-UI-Komponententests).e2e/: Playwright-Browsertest, der Tool-Erkennung, Tool-Ausführung und Screenshot-Erfassung validiert.
🛠️ Erste Schritte
Voraussetzungen
.NET 9.0 SDK (oder .NET-10-Preview)
Node.js 20+ (für Playwright-Browsertests)
Lokale Ausführung
Klonen Sie das Repository:
git clone https://github.com/cmalpass/csharp-mcp-server-blazor.git cd csharp-mcp-server-blazor/McpServerAppStarten Sie die Anwendung:
dotnet run --project McpServerAppÖffnen Sie Ihren Browser und navigieren Sie zu
https://localhost:7150(oder dem in Ihrem Terminal angezeigten Port), um den MCP Inspector zu erkunden.
🔌 Externe KI-Clients verbinden
1. Claude Desktop
Fügen Sie diesen Eintrag zu Ihrer claude_desktop_config.json hinzu:
{
"mcpServers": {
"csharp-blazor-server": {
"url": "http://localhost:5000/sse"
}
}
}2. Cursor
Gehen Sie zu Settings > Features > MCP, klicken Sie auf + Add New MCP Server, wählen Sie SSE und geben Sie http://localhost:5000/sse an.
3. Anthropic CLI Inspector
npx @modelcontextprotocol/inspector http://localhost:5000/sse🧪 Testen
Deterministische Testsuite (.NET)
Führen Sie die Unit-, Integrations- und bUnit-Komponententests aus:
dotnet test McpServerApp/McpServerApp.sln --configuration ReleaseBrowser-E2E-Test (Playwright)
npm ci
npm run test:e2eDies führt den vollständigen Browserablauf aus und erzeugt Screenshot-Nachweise unter docs/evidence/mcp-inspector-execution.png.
📜 Lizenz
Dieses Projekt ist unter der MIT-Lizenz lizenziert.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA dual-transport MCP server that exposes your API as tools to LLM clients, supporting both stdio transport for local clients like Claude Desktop and HTTP/SSE transport for remote clients like OpenAI's Responses API.
- AlicenseAqualityAmaintenanceA Model Context Protocol (MCP) server providing 62 AI-optimized tools for .NET/C# semantic code analysis, navigation, refactoring, and code generation using Microsoft Roslyn. Built for AI coding agents - provides compiler-accurate code understanding that AI cannot infer from reading source files alone.6231MIT
- FlicenseAqualityDmaintenanceMinimal MCP server bridging a Roslyn C# language server to AI agents, exposing tools for diagnostics, call hierarchy, and type hierarchy.1
- AlicenseNot gradedqualityAmaintenanceGive your AI assistant superpowers for .NET development! This MCP server connects GitHub Copilot, Claude, and other AI assistants directly to the .NET SDK, enabling them to create projects, manage packages, run builds, and more—all through natural language.31MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cmalpass/csharp-mcp-server-blazor'
If you have feedback or need assistance with the MCP directory API, please join our Discord server