csharp-mcp-server-blazor
C# MCP Server & Blazor WebAssembly Inspector
ブログ記事「BlazorフロントエンドでC# MCP Serverを構築する」の付属コードリポジトリです。
このリポジトリは、.NET 9上のC#で本番品質のModel Context Protocol (MCP)実装を提供し、インタラクティブなBlazor WebAssembly Tool Inspector & Protocol Monitorと組み合わせたものです。
🚀 アーキテクチャのハイライト
Standard MCP Protocol Engine: 公式のModel Context ProtocolをServer-Sent Events(
GET /sse)とJSON-RPC 2.0(POST /messages)で実装し、Claude Desktop、Cursor、VS Code、Anthropic MCP Inspector CLIなどの外部AIクライアントをサポートします。Native C# Tool Reflection: 型指定されたC#メソッドを、
Microsoft.Extensions.AI(AIFunctionFactory)とSystem.Text.Jsonによる自動スキーマ生成を使用して、検出可能なMCPツールとして公開します。Interactive Blazor WASM Inspector: 生成されたJSONスキーマを検査し、カスタムパラメータフォームでツール実行をテストし、リアルタイムのJSON-RPC通信ログを監視する開発者向けGUIです。
Zero-Config Local Dev vs Guarded Production: ローカル開発はシークレットなしで摩擦なく実行できます。非Development環境ではJWT Bearer認証、レート制限、リクエストタイムアウトが適用されます。
Related MCP server: sharplens-mcp
📁 ソリューション構成
McpServerApp/McpServerApp:/sse、/messages、/api/mcpエンドポイントをホストするASP.NET Coreサーバー。McpServerApp/McpServerApp.Client: インタラクティブなInspector UIを提供するBlazor WebAssemblyクライアント。McpServerApp/McpServerApp.Tests: 完全な自動テストスイート(ユニットテスト、WebApplicationFactoryによる統合テスト、bUnit UIコンポーネントテスト)。e2e/: ツールの検出、実行、スクリーンショット取得を検証するPlaywrightブラウザテスト。
🛠️ はじめに
前提条件
.NET 9.0 SDK(または.NET 10プレビュー)
Node.js 20+(Playwrightブラウザテスト用)
ローカルでの実行
リポジトリをクローンします:
git clone https://github.com/cmalpass/csharp-mcp-server-blazor.git cd csharp-mcp-server-blazor/McpServerAppアプリケーションを実行します:
dotnet run --project McpServerAppブラウザを開き、
https://localhost:7150(またはターミナルに表示されるポート)にアクセスして、MCP Inspectorを確認してください。
🔌 外部AIクライアントの接続
1. Claude Desktop
このエントリをclaude_desktop_config.jsonに追加してください:
{
"mcpServers": {
"csharp-blazor-server": {
"url": "http://localhost:5000/sse"
}
}
}2. Cursor
Settings > Features > MCPに移動し、+ Add New MCP Serverをクリックして、SSEを選択し、http://localhost:5000/sseを指定します。
3. Anthropic CLI Inspector
npx @modelcontextprotocol/inspector http://localhost:5000/sse🧪 テスト
決定論的テストスイート(.NET)
ユニットテスト、統合テスト、bUnitコンポーネントテストを実行します:
dotnet test McpServerApp/McpServerApp.sln --configuration ReleaseブラウザE2Eテスト(Playwright)
npm ci
npm run test:e2eこれにより、ブラウザの完全なフローが実行され、docs/evidence/mcp-inspector-execution.pngにスクリーンショットの証拠が生成されます。
📜 ライセンス
このプロジェクトはMIT Licenseの下でライセンスされています。
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