MCP server for dotnet new: discover, inspect, preview and create .NET projects from templates.
MCP server for dotnet new templates. It enables AI agents to discover, inspect, preview, and create .NET projects from templates via natural conversation, rather than relying on memorizing dotnet CLI options. This focuses on template workflows: searching available templates, examining details, and generating new projects.
๐ ๏ธ Key Features
Discover dotnet new templates
Inspect template information
Preview template output
Create projects from templates
๐ Use Cases
Find and review .NET templates before generation
Generate new .NET projects based on template selection
Assist agents in working with dotnet new without CLI flag knowledge
โก Developer Benefits
Integrates template-engine operations (search/inspect/preview/create) into MCP
Supports template-driven project creation through structured agent interaction
โ ๏ธ Limitations
Scope is specifically dotnet new templates and related .NET project generation
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.
dotnet new list --language C#
dotnet new webapi --help
dotnet new webapi --auth Individual --use-controllers --name MyApi --output ./MyApi
Your 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:
code
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.
How this relates to the official tooling. Microsoft ships template authoring validation already, and you should know about it:
What template_validate adds is not the validation itself โ it is the delivery: a single structured JSON payload, split into errors/warnings/suggestions with fix-oriented messages, returned in-band to an agent that is already editing the template. No install step, no output parsing, no second tool in the loop. If you are a human authoring templates in CI, prefer the official tools above; they are the reference implementation and cover cases this does not.
Tools
Tool
What it does
template_search
Search locally and on NuGet.org โ one call, ranked results
template_list
List what's installed, filter by language/type/classification
template_inspect
Parameters, constraints, post-actions โ all in one shot
template_instantiate
Create a project. Not installed? Auto-resolves from NuGet. Elicits missing params interactively
template_dry_run
Preview files without touching disk
template_install
Install a package (idempotent โ skips if already there)
template_uninstall
Remove a template package
templates_installed
Inventory of everything installed
template_from_intent
"web API with auth" โ webapi + auth=Individual โ no LLM needed
template_create_from_existing
Analyze a .csproj โ generate a reusable template matching repo conventions
template_compose
Execute a sequence of templates (project + items) in one workflow
template_suggest_parameters
Suggest parameter values with rationale based on cross-parameter relationships
template_validate
Validate a local template directory for authoring issues before publishing
template_compare
Compare 2+ templates side by side โ parameters, features, frameworks
solution_analyze
Analyze a solution/workspace โ project structure, frameworks, CPM status
packages_upgrade
Scan a project/solution/folder for outdated NuGet versions and report or apply upgrades (CPM-aware)
Standard I/O transport for local CLI and tool usage:
bash
template-engine-mcp # stdio is the default
template-engine-mcp --transport stdio # explicit
HTTP (remote / team-shared)
Streamable HTTP transport for remote or CI/CD deployment.
Authentication is mandatory. Every tool in this server writes files and installs NuGet packages, so an open endpoint is a remote code execution surface. The server refuses to start the HTTP transport unless you either set a token or explicitly opt in to anonymous access:
bash
# Recommended
MCP_TEMPLATE_HTTP_TOKEN=<shared-secret> template-engine-mcp --transport http
# Only for a trusted, isolated network
MCP_TEMPLATE_HTTP_ALLOW_ANONYMOUS=true template-engine-mcp --transport http
Clients authenticate with Authorization: Bearer <shared-secret>. Requests to /mcp are rate limited per client (default 120/minute, MCP_TEMPLATE_HTTP_RATE_LIMIT=0 disables). /health stays anonymous for probes.
Not multi-tenant.TemplateEngineService is a process-wide singleton with virtualizeSettings: false, so the installed-template set is shared by every caller, and the workspace root is process-wide. Run one instance per trusted team or per tenant โ do not expose a single instance to mutually untrusting users.
bash
template-engine-mcp --transport http
# or via environment variable:
MCP_TEMPLATE_TRANSPORT=http template-engine-mcp
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
string
Text input
bool / boolean
Checkbox
int / number
Number input
Choice parameter
Single-select dropdown
Disable with MCP_TEMPLATE_ELICITATION=false.
How it works
code
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 project
The 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:
DetectsDirectory.Packages.props by walking up the directory tree
StripsVersion attributes from generated .csproj PackageReferences
Adds missing <PackageVersion> entries to Directory.Packages.props
Resolves latest stable NuGet versions โ no more stale hardcoded versions from templates
code
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: