Get the FREE Ultimate OpenClaw Setup Guide →

DotnetFastMCP

A lightweight .NET framework for building Model Context Protocol (MCP) servers. Integrates seamlessly with Azure AD, AWS Cognito, Auth0, OpenAI and other providers

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio tekspry-dotnetfastmcp dotnet run --project ./DotnetFastMCP/src/FastMCP.csproj -c Release --urls http://0.0.0.0:5000 \
  --env FASTMCP_LOG_LEVEL="Information" \
  --env ASPNETCORE_ENVIRONMENT="Production" \
  --env FASTMCP_SERVER_AUTH_AZUREAD_CLIENT_ID="your-client-id" \
  --env FASTMCP_SERVER_AUTH_AZUREAD_TENANT_ID="your-tenant-id" \
  --env FASTMCP_SERVER_AUTH_AZUREAD_CLIENT_SECRET="your-client-secret"

How to use

DotnetFastMCP is a production-ready MCP server framework for .NET that exposes JSON-RPC 2.0 compliant endpoints with built-in OAuth2/OpenID Connect authentication. It provides an attribute-based model to declare tools and resources, a native C# client library, and extensive observability capabilities through OpenTelemetry. Use it to quickly build secure, scalable MCP servers where tools are protected by authorization policies and can be invoked via a JSON-RPC interface. The framework also supports prompts for LLM integration and a robust hosting model based on ASP.NET Core, making it suitable for enterprise deployments.

To use the server, define your MCP tools and resources in assemblies scanned by the server, configure authentication providers (e.g., Azure AD, Google, GitHub), and run the server. Clients can connect via the McpClient library, choose the transport (Stdio or SSE), and call tools with CallToolAsync<T>. The server exposes discovery and OAuth endpoints for token issuance and client authentication, and it includes built-in support for streaming responses from LLM providers when using the integrated LLM pipeline.

How to install

Prerequisites:

  • .NET 8.0 SDK or later installed on your machine
  • Git
  • (Optional) Docker if you choose container deployment

Installation steps:

  1. Clone the repository:
git clone https://github.com/tekspry/.NetFastMCP.git
cd DotnetFastMCP
  1. Restore and build the solution in Release configuration:
dotnet build -c Release
  1. Navigate to the example or project that contains the FastMCP server and run:
dotnet run --project ./DotnetFastMCP/src/FastMCP.csproj -c Release --urls http://0.0.0.0:5000
  1. (Optional) Run via Docker:
  • Build the image from the repository and run with proper environment variables for authentication.

Note: If you plan to use OAuth providers, ensure you set the required environment variables for your chosen provider (e.g., Azure AD, Google, etc.).

Additional notes

Tips and caveats:

  • The server relies on ASP.NET Core hosting; ensure your environment allows binding to the configured URL.
  • For secure deployments, configure OAuth providers and environment-based secrets; prefer using a secret manager or vault in production.
  • Enable OpenTelemetry or other exporters as needed through the builder extensions (e.g., builder.WithTelemetry()).
  • Tools and resources are discovered automatically via reflection; organize code into clearly separated files (Tools.cs, Resources.cs).
  • If you encounter port conflicts, change the --urls flag to a free port and update clients accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers