.NET MCP Server: Return supported tools based on query parameter
Authorised Territory demonstrates how to build an MCP server in .NET that returns different supported tools depending on a query parameter, plus a .NET Minimal API client with endpoints to list tools and invoke one of them.
Full summary based on transcript
What the video builds
- An MCP server implemented in .NET that returns its supported tools based on a query parameter in the client connection URL.
- An MCP client implemented as a .NET Minimal API with two endpoints:
- One endpoint that returns a list of the server’s tools.
- One endpoint that calls/uses one of the tools exposed by the server.
Returning supported tools based on a query parameter
- The server’s tool discovery/advertisement behavior is made conditional on a query string value.
- The intent is that different clients (or different client modes) can connect using different URLs and receive different tool sets.
Minimal API client endpoints
- The client is built with ASP.NET Core Minimal APIs.
- It exposes:
- A tool-listing endpoint (to fetch and return the tools the server reports).
- A tool-invocation endpoint (to select one of the tools and execute it via the MCP interaction).
Key idea
- Use the connection URL (specifically a query parameter) as a simple way to control which tools an MCP server reports as available to the connecting client.