😄 Don’t worry — this time it’s not another BODMAS post!
We’re shifting gears from math rules to building some cool integration tools with ASP.NET Core.
🧭 Overview
The Model Context Protocol (MCP) is an open standard that lets AI models call structured APIs called tools — similar to function calling.
In this article, we’ll build a custom MCP server in .NET 8 using the ModelContextProtocol.AspNetCore package.
We’ll define a simple toolset for data conversions (JSON ↔ XML, Base64 encode/decode), then test it using the MCP Playground.
⚙️ 1. Create a project
dotnet new webapi -n IntegrationSuite
dotnet add package ModelContextProtocol.AspNetCore --prerelease
🧠 2. Define your tool class
using ModelContextProtocol.Server;
[McpServerToolType]
public class ConversionTools
{
private readonly IFormatConverter _converter;
public ConversionTools(IFormatConverter converter) => _converter = converter;
[McpServerTool]
public ConversionResponse JsonToXml(string json, string? root = null, bool indented = true)
=> _converter.ConvertJsonToXml(json, root, indented);
[McpServerTool]
public ConversionResponse XmlToJson(string xml, bool indented = true)
=> _converter.ConvertXmlToJson(xml, indented);
}
🖼️ Screenshot: Tool class implementation
🧩 3. Wire up the server
builder.Services.AddScoped<IFormatConverter, FormatConverter>();
builder.Services.AddScoped<ConversionTools>();
builder.Services.AddMcpServer(o =>
{
o.ServerInfo = new() { Name = "IntegrationSuite", Version = "0.1.0" };
})
.WithHttpTransport()
.WithToolsFromAssembly();
var app = builder.Build();
app.MapMcp("/api/mcp");
app.Run();
🖼️ Screenshot: Server setup in Program.cs
🖥️ 4. Launch & Session Logs
Once the MCP server is running, the console output confirms that the server and Postman client have successfully initialized and exchanged messages.
🖼️ Screenshot: Session logs on server startup
What’s happening:
- The server starts and listens on
http://localhost:5098/api/mcp. - Postman connects and sends
initializeandtools/listrequests to discover available tools. - You may see warnings like:
method 'prompts/list' is not available
method 'resources/list' is not available
These are normal — they simply indicate optional handlers not implemented in your server.
✅ This confirms your MCP session is active and Postman can now invoke any of your defined tools (json_to_xml, xml_to_json, etc.).
🧪 5. Test via Postman
You can easily test your MCP server using Postman, which now includes built-in support for the Model Context Protocol (MCP).
- Open Postman and click New → MCP.
- Enter your MCP server URL:
http://localhost:<port>/api/mcp
- Click Connect.
- Once connected, open the Tools tab to see all available MCP tools.
- Select a tool → provide arguments → click Run.
- You’ll see structured results in JSON — for example:
{
"output": "<xmlroot><item>1</item><item>2</item><item>3</item></xmlroot>",
"operation": "json->xml",
"success": true
}
🖼️ Screenshot: Postman MCP run
🚀 Done!
You now have a working MCP server built with ASP.NET Core, exposing your own .NET tools through a simple HTTP endpoint — ready to integrate with AI or automation workflows.
🔌 More Integration Tool Ideas
Once your MCP server is up and running, you can easily expand it with additional integration tools to connect various services and automate workflows.
Here are a few examples:
- HTTP Relay Tool — Forward requests or data payloads to external APIs or internal endpoints.
- Azure Service Bus Tool — Publish or consume messages to streamline event-driven architecture.
- Azure Blob Storage Tool — Upload, download, or list blobs for file automation.
- Logic Apps / Power Automate Tool — Trigger or monitor workflows.
- OneLake Tool — Write event data directly into Microsoft Fabric for data pipeline ingestion.
- SharePoint / Graph API Tools — Retrieve or update documents and metadata.
- Email Tools — Send notifications or automated messages through SMTP or Microsoft Graph.
- Validation Tools — Perform JSON Schema or XML XSD validation.
🧠 Tip: Keep each tool focused on one clear task — like upload_file, trigger_logicapp, or publish_event — and return structured responses with fields like Success, StatusCode, or Message.




Top comments (1)
If you already have an API that you would like to make "AI", or you already know APIs, have a look at ZeroMcp. It spins up an MCP endpoint within your existing API, using all your existing ASP.net bells and whistles.