Provides tools to search, list, inspect, and instantiate .NET project templates, analyze solution structures, and validate template configurations through natural language intent.
Enables searching for and installing .NET template packages from NuGet.org, and automatically resolving the latest package versions for project dependencies and Central Package Management (CPM).
Microsoft.TemplateEngine.MCP
An MCP server that lets AI agents work with dotnet new templates — search, inspect, preview, and create projects through natural conversation instead of memorizing CLI flags.
Instead of this:
dotnet new list --language C#
dotnet new webapi --help
dotnet new webapi --auth Individual --use-controllers --name MyApi --output ./MyApiYour AI agent just says: "I need a web API with authentication and controllers" — and the MCP server figures out the rest.
Template Validation for Authors
Building a custom dotnet new template? template_validate catches mistakes before you publish — no more guessing if your template.json is correct:
Agent calls: template_validate("./my-template")
← Returns:
{
"valid": false,
"summary": "2 error(s), 1 warning(s), 3 suggestion(s)",
"errors": [
"Missing required field 'shortName'.",
"Parameter 'Framework': default value 'net7.0' is not in the choices list."
],
"warnings": [
"Missing 'sourceName'. Without it, the generated project name won't be customizable via --name."
],
"suggestions": [
"Consider adding a 'description' field to help users understand what this template creates.",
"Consider adding 'language' tag (e.g., 'C#') for better discoverability.",
"Consider adding 'type' tag (e.g., 'project', 'item') for filtering."
]
}What it catches: missing required fields, invalid identity format, short name conflicts with CLI commands, parameter issues (missing defaults, empty choices, prefix collisions, type mismatches), broken computed symbols, constraint misconfiguration, and missing tags.
No existing tooling does this — most template authors discover issues only after dotnet new install fails or produces wrong output.
Tools
Tool | What it does |
| Search locally and on NuGet.org — one call, ranked results |
| List what's installed, filter by language/type/classification |
| Parameters, constraints, post-actions — all in one shot |
| Create a project. Not installed? Auto-resolves from NuGet. Elicits missing params interactively |
| Preview files without touching disk |
| Install a package (idempotent — skips if already there) |
| Remove a template package |
| Inventory of everything installed |
| "web API with auth" → webapi + |
| Analyze a .csproj → generate a reusable template matching repo conventions |
| Execute a sequence of templates (project + items) in one workflow |
| Suggest parameter values with rationale based on cross-parameter relationships |
| Validate a local template directory for authoring issues before publishing |
| Analyze a solution/workspace — project structure, frameworks, CPM status |
Quick Start
Global tool (.NET 8+)
dotnet tool install --global DotnetTemplateMCP --version 1.2.0Zero-install with dnx (.NET 10+)
dnx -y DotnetTemplateMCP --version 1.2.0VS Code / GitHub Copilot
Add to mcp.json:
{
"servers": {
"dotnet-templates": {
"type": "stdio",
"command": "dnx",
"args": ["-y", "DotnetTemplateMCP", "--version", "1.2.0"]
}
}
}📖 Claude Desktop, Cursor, and more →
Transport Modes
Stdio (default)
Standard I/O transport for local CLI and tool usage:
template-engine-mcp # stdio is the default
template-engine-mcp --transport stdio # explicitHTTP (remote / cloud / team-shared)
Streamable HTTP transport for remote, multi-tenant, or CI/CD deployment:
template-engine-mcp --transport http
# or via environment variable:
MCP_TEMPLATE_TRANSPORT=http template-engine-mcpThe HTTP server exposes:
/mcp— MCP streamable HTTP endpoint/health— Health check endpoint
Configure the listen URL:
MCP_TEMPLATE_HTTP_URL=http://0.0.0.0:8080 template-engine-mcp --transport httpConnect your MCP client:
{
"servers": {
"dotnet-templates": {
"type": "http",
"url": "http://localhost:5005/mcp"
}
}
}Interactive Elicitation
When a template has required parameters that weren't provided, the server asks the user interactively via MCP elicitation — instead of failing. Template parameter types are mapped to form fields:
Template Parameter | Elicitation Field |
| Text input |
| Checkbox |
| Number input |
Choice parameter | Single-select dropdown |
Disable with MCP_TEMPLATE_ELICITATION=false.
How it works
You: "I need a web API with authentication, controllers, and Docker support"
→ template_from_intent extracts keywords: web api, authentication, controllers, docker
→ Matches: webapi (confidence: 0.85)
→ Resolves: auth=Individual, UseControllers=true, EnableDocker=true
→ template_instantiate creates the projectThe server also does smart defaults (AOT → latest framework, auth → HTTPS stays on), parameter validation before writing files, constraint checking (OS, SDK, workload), interactive elicitation of missing required parameters, and auto-resolves templates from NuGet if they're not installed.
CPM & Latest Package Versions
When creating a project inside a solution that uses Central Package Management, the server automatically:
Detects
Directory.Packages.propsby walking up the directory treeStrips
Versionattributes from generated.csprojPackageReferencesAdds missing
<PackageVersion>entries toDirectory.Packages.propsResolves latest stable NuGet versions — no more stale hardcoded versions from templates
Before (what dotnet new generates):
<PackageReference Include="Serilog" Version="3.1.0" /> ← stale, breaks CPM
After (what template_instantiate produces):
.csproj: <PackageReference Include="Serilog" />
Directory.Packages.props: <PackageVersion Include="Serilog" Version="4.2.0" />Works for standalone projects too — versions are updated directly in the .csproj.
Multi-Template Composition
Chain multiple templates in one call with template_compose:
[
{"templateName": "webapi", "name": "MyApi", "parametersJson": "{\"auth\": \"Individual\"}"},
{"templateName": "gitignore", "target": "."}
]📖 Architecture & smart behaviors →
Tool Profiles (Lite vs Full)
By default, all 13 tools are available. If your agent works better with fewer tools, set the MCP_TEMPLATE_TOOL_PROFILE environment variable:
Profile | Tools | When to use |
| All 13 tools | Full control — advanced workflows, composition, custom templates |
| 5 core tools | Simpler agents that just need to find and create projects |
Lite profile tools: template_from_intent, template_instantiate, template_inspect, template_search, template_dry_run
{
"servers": {
"dotnet-template-mcp": {
"command": "dotnet-template-mcp",
"env": {
"MCP_TEMPLATE_TOOL_PROFILE": "lite"
}
}
}
}Non-lite tools will return a helpful message explaining they're disabled and how to enable them.
Documentation
Doc | What's in it |
VS Code, Claude Desktop, Cursor setup + troubleshooting | |
Every tool's parameters, types, and examples | |
Template cache, smart behaviors, telemetry, project structure | |
Why MCP over Copilot Skills — benefits and downsides | |
Side-by-side: what a plain LLM does vs. the MCP tool (4 scenarios) | |
What it'd take to cover this with Skills instead |
Building & Testing
dotnet build
dotnet test # 185+ tests — unit, integration, and E2ECI runs on push/PR via GitHub Actions (Ubuntu + Windows).
Contributing
Contributions are welcome! Please open an issue to discuss proposed changes before submitting a PR.
# Setup
dotnet restore
dotnet build
# Run tests
dotnet test
# Pack locally
dotnet pack src/Microsoft.TemplateEngine.MCP -o nupkg/Changelog
See CHANGELOG.md for release history.