This repo demonstrates how a classic WebAPI application can be turned into a MCP Server by simply swapping the WebAPI project for a MCP project, considering that the project is using a Clean Arch-ish structure.
Due to the little complexity of the project, there's no domain layer, just the Application and Infrastructure layers below the presentation layer (MCP Server / WebAPI), but it demonstrates the basic idea: a clean separation of concerns makes the front-end and back-end code much more independent and easier to maintain. It also demonstrates how the MCP Server front-end can work perfectly well with a project originally built to be a WebAPI.
Here's a demonstration of an integration with Copilot's Agent mode in Visual Studio Code:
And here's the configuration used for the MCP Server:
{
"servers": {
"my-mcp-server-4845c32d": {
"type": "stdio",
"command": "dotnet",
"args": [
"run",
"--project",
"C:\\<absolute-path-to>\\MCPStudy.MCPServer.csproj"
]
}
}
}