- Display Json-Rpc formatted metadata of the MCP server. This will be callable via Swagger, contacting a Web Api controller.
- Browse documentation and use the tools of the MCP server via a freely available tool called ModelInspector.
https://github.com/toreaurstadboss/WeatherMCPDemo
Let's first see now we can set up Swagger and set up a MVC Web Api controller to expose metadata about the MCP server.
Exposing metadata about the MCP server
Inside Program.cs of our project WeatherServer.Web.Http, we set up Swagger like this:
Program.cs
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
//more code
//Add swagger support
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
// some more code
app.UseSwagger();
app.UseSwaggerUI();
Swagger and its UI is provided via Nuget packages :
WeatherServer.Web.Http.csproj
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
Next up, let's see how the metadata about the MCP server can be exposed via an MVC controller.
ToolsController.cs
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using ModelContextProtocol.Client;
namespace WeatherServer.Web.Http.Controllers
{
[ApiController]
[Route("[controller]")]
public class ToolsController : ControllerBase
{
private readonly IMcpClient _client;
private readonly IOptions<ModelContextProtocol.Protocol.Implementation> _mcpServerOptions;
public ToolsController(IMcpClient client, IOptions<ModelContextProtocol.Protocol.Implementation> mcpServerOptions)
{
_client = client;
_mcpServerOptions = mcpServerOptions;
}
[HttpGet(Name = "Overview")]
[Produces("application/json")]
public async Task<IActionResult> GetOverview()
{
var rpcRequest = new
{
jsonrpc = "2.0",
method = "tools/list",
id = 1
};
var tools = await _client.ListToolsAsync();
//var prompts = await _client.ListPromptsAsync();
//var resources = await _client.ListResourcesAsync();
return Ok(new
{
ServerName = _mcpServerOptions.Value.Title,
Version = _mcpServerOptions.Value.Version,
Tools = tools,
//Prompts = prompts,
// Resources = resources
});
}
}
}
We will list the tools on the MCP server. In our server, we have added connection ability to the MCP server itself to achiveve this. Since my MCP demo server only got some tools and has not added prompts or resources, only this will be exposed.
Please note that an anonymous object is created with
jsonrpc = "2.0",
method = "tools/list"
id = 1
These "magic" fields with their values instructs MCP to deliver Json RCP data.
Getting the Json-Rpc metadata
The Json-Rpc metadata is then easily obtained from Swagger UI. The following screenshot shows this.
Download the entire .json document. You can use an online Json browser to browse through the Json document. For example the web site JsonCrack offers a powerful tool to browse larger Json document. Url to JsonCrack:
https://jsoncrack.com/editor
Screenshot showing it displaying Json-Rpc document in JsonCrack :
Next up, let's see how ModelInspector can be used to discover metadata about the MCP server.
Node must be installed on the PC, at least Node version that supports modern ES modules and fetch API. I use Node version 25 when I tested this.
Use npx (Node must be installed and setup with PATH environment variable) to have npx available.
npx @modelcontextprotocol/inspector --startup-url "https://localhost:7145/mcp"
In case you get SSL troubles and want to bypass SSL security in case you for example rely on self-signed certificates and browser are giving you difficulties, you can use the following in LocalDEV from commandline:
$env:NODE_TLS_REJECT_UNAUTHORIZED=0
npx @modelcontextprotocol/inspector --startup-url "https://localhost:7145/mcp"
This will temporarily skip TLS errors and allow you to bypass troubles with self-signed certificates. In production environments, you of course will not use this 'trick'.
Once inside ModelContextInspector, choose
- Transport Type set to :
Streamable HTTP
- URL set to:
https://localhost:7145/sse
- Connection Type set to:
Via Proxy
Once ready, enter the button Connect : Connect
It should say Connected with a green diode indicator.
Note that Program.cs sets up the MCP endpoint to SSE :
app.MapMcp("/sse"); // This exposes the SSE endpoint at /sse
Screenshot showing the tool in use :
Hit the button List Tools to list the tools in the MCP demo.
You will get the description of each tool and by selecting a tool, you can provide its input
parameters and also see Description / Instruction usage. You can then invoke the tool by running the button 'Run Tool' and also see additional information such as description of the tool and also the description of each method. This is even more readable than the raw Json-Rpc document we downloaded using Swagger described above.
For more advanced MCP servers, you can inspect additional information from Resources, Prompts and additional information. This makes it possible to debug your MCP servers without having to test via a client or chat via for example a Swagger endpoint.
The following Nuget packages are used for the server project of the DEMO.
<PackageReference Include="ModelContextProtocol.AspNetCore" Version="0.3.0-preview.2" /<
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.6" />
<PackageReference Include="ModelContextProtocol" Version="0.3.0-preview.2" />
<PackageReference Include="Anthropic.SDK" Version="5.5.1" />
<PackageReference Include="Microsoft.Extensions.AI" Version="9.9.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0-preview.6.25358.103" />
To sum up, to inspect your MCP server in greater detail and if you use technology similar to the Nugets shown here, you can:
- Add Swagger and Swagger UI to the serverside and expose an endpoint that lists the Json-Rpc metadata for the MCP server such as listing the tools of the MCP server. Or Prompts and Resources, if they have been added to the MCP server.
- Use the free tool Model Inspector to inspect the MCP server and invoke for example the tools of the MCP server.