Skip to main content
Glama
cmalpass

csharp-mcp-server-blazor

by cmalpass

C# MCP Server & Blazor WebAssembly Inspector

A companion repository for the blog post: Building a C# MCP Server with a Blazor WebAssembly Inspector.

This is a local, pedagogical MCP server built on .NET 10. It uses the official MCP C# SDK v2.2.0 and its stateless Streamable HTTP transport at POST /mcp, alongside a Blazor WebAssembly page for inspecting the sample tools. Customer and weather responses are simulated fixtures; the system-metrics tool intentionally reports live data from the local process. No tool queries an external system.

IMPORTANT

The Blazor page is a diagnostic UI, not an MCP client: its buttons use the application-specific/api/mcp/* API to inspect and invoke the sample tools. The actual MCP transport is POST /mcp.

Protocol and transport

The server uses the current 2026-07-28 MCP HTTP wire format through MCP C# SDK v2.2.0. It is stateless: each POST /mcp request is independent, and the server does not issue or retain an Mcp-Session-Id. The current revision uses server/discover for bootstrap rather than the historical initialize handshake, and HTTP requests carry the protocol version in the MCP-Protocol-Version header.

Streamable HTTP is the recommended HTTP transport for new MCP servers. See the official MCP C# SDK transport guidance and stateless HTTP guidance for the protocol behaviour and production deployment options.

Related MCP server: sharplens-mcp

Solution structure

  • McpServerApp/McpServerApp: ASP.NET Core host for POST /mcp and the diagnostic inspector API.

  • McpServerApp/McpServerApp.Client: Blazor WebAssembly diagnostic inspector UI.

  • McpServerApp/McpServerApp.Tests: unit, integration, and bUnit component tests.

  • e2e/: Playwright browser test for local diagnostic inspection and invocation.

Run locally

Prerequisites: .NET 10 SDK. Install Node.js only when running the browser test.

git clone https://github.com/cmalpass/csharp-mcp-server-blazor.git
cd csharp-mcp-server-blazor
dotnet run --project McpServerApp/McpServerApp

Open the local address printed by ASP.NET Core (normally http://localhost:5000) to explore the sample tools and local diagnostic log. For a client integration, point a current MCP client at the local POST /mcp endpoint and follow that client’s official, up-to-date configuration documentation.

Production considerations

This repository teaches the protocol and tool-inspection flow; it is not a complete production deployment template. Before exposing an MCP server, design authentication and authorization for the tool surface, validate allowed origins and host names, apply request/concurrency/rate limits, avoid logging secrets or raw untrusted payloads, and run behind HTTPS and an appropriate reverse proxy. The official C# SDK documentation is the source of truth for current transport and deployment behaviour.

If a reverse proxy terminates TLS, configure it to overwrite the forwarded headers and set Mcp:TrustedProxyAddress to that proxy's exact IP address (for example, Mcp__TrustedProxyAddress=10.0.0.10 as an environment variable). The application ignores forwarded headers unless this exact proxy is configured; never enable trust for arbitrary client-supplied X-Forwarded-* headers.

Testing

Run the .NET test suite:

dotnet test --solution McpServerApp/McpServerApp.sln --configuration Release

Run the local browser test:

npm ci
npm run test:e2e

Playwright keeps screenshots, traces, and its HTML report in ignored test-output directories (test-results/ and playwright-report/). Running the test never updates tracked documentation images.

License

This project is licensed under the 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