Skip to content
Clean Model Context Protocol
Lean Mean Clean Apps

Five templates, one search box. Everything in the docs is in here, including the bits we hoped you'd skim.

Try one of these

Results say which template they came from, so you won't end up reading about Lambda when you wanted GraphQL. Again.

Get started

By the end of this page you’ll have your own solution, an MCP server running on your machine, and a tool answering back. It takes about five minutes, or ten if NuGet decides to download the internet first.

You need the .NET 10 SDK. Docker is optional, but it gets you the MCP Inspector and Seq without installing anything else, so it’s worth having around.

  1. Install the template from NuGet.

    Terminal window
    dotnet new install CleanModelContextProtocol.Template
  2. Create a solution. The name becomes your namespace, project names and folder, so pick something you’re happy to see a lot of.

    Terminal window
    dotnet new cleanmodelcontextprotocol --name Acme.Movies --authorName "Your Name"
    cd Acme.Movies
  3. Have a look around. Everything you need is already here.

    • Acme.Movies.sln
    • Dockerfile
    • docker-compose.yml
    • Directorysrc/
      • DirectoryApplication/ the rules, queries and validation
        • …
      • DirectoryInfrastructure/ the database and repositories
        • …
      • DirectoryPresentation/ the tools, resources and prompts
        • …
    • Directorytests/
      • DirectoryApplication.Tests.Unit/
        • …
      • DirectoryInfrastructure.Tests.Integration/
        • …
      • DirectoryPresentation.Tests.Integration/
        • …
      • DirectoryPresentation.Tests.Unit/
        • …
  4. Run it. The local environment seeds sample data and logs to the console, so there’s nothing to set up.

    Terminal window
    dotnet run --project ./src/Presentation
  5. Call a tool. The server speaks Streamable HTTP at /mcp, and because it’s stateless you can send a single JSON-RPC request with nothing before it.

    Terminal window
    curl -X POST "http://localhost:5032/mcp" \
    -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"movies_search","arguments":{"query":"global","limit":2}}}'

    The answer arrives as a server-sent event. Inside it, the tool’s result is there twice: once as text for models that read, once as structuredContent for clients that parse.

    {
    "items": [
    { "id": "30fca414-247a-779e-105a-d81aa2506f58", "title": "Assimilated global infrastructure", "reviewCount": 1, "averageStars": 1 },
    { "id": "c27d6600-79a6-9346-2595-a52b7f07dc3e", "title": "Automated global alliance", "reviewCount": 3, "averageStars": 3.3 }
    ],
    "totalCount": 2
    }

    Yes, the movies are named by a corporate buzzword generator. Assimilated global infrastructure only got one star. Critics can be harsh.

  6. Or skip curl and use the Inspector. Docker Compose starts it already pointed at the server.

    Terminal window
    docker compose up -d --build

    Open http://localhost:6274, connect, and the Tools, Resources and Prompts tabs show everything the server offers, with a form for each.

  7. Run the tests while you’re here.

    Terminal window
    dotnet test