Skip to main content
Glama
cmalpass

csharp-mcp-server-blazor

by cmalpass

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 DesktopCursorVS CodeAnthropic MCP Inspector CLIなどの外部AIクライアントをサポートします。

  • Native C# Tool Reflection: 型指定されたC#メソッドを、Microsoft.Extensions.AIAIFunctionFactory)と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ブラウザテスト。


🛠️ はじめに

前提条件

ローカルでの実行

  1. リポジトリをクローンします:

    git clone https://github.com/cmalpass/csharp-mcp-server-blazor.git
    cd csharp-mcp-server-blazor/McpServerApp
  2. アプリケーションを実行します:

    dotnet run --project McpServerApp
  3. ブラウザを開き、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の下でライセンスされています。

A
license - permissive license
Not graded
quality - not tested
B
maintenance

Maintenance

0Releases (12mo)
Commit activity

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

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A 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.
  • A
    license
    A
    quality
    A
    maintenance
    A 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.
    62
    31
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    Minimal MCP server bridging a Roslyn C# language server to AI agents, exposing tools for diagnostics, call hierarchy, and type hierarchy.
    1
  • A
    license
    Not graded
    quality
    A
    maintenance
    Give 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.
    31
    MIT

View all related MCP servers

Latest Blog Posts

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