io.github.YuliiaKovalova/dotnet-template-mcp

编码与调试

by yuliiakovalova

Search, inspect, preview, and create .NET projects from dotnet new templates via AI agents.

什么是 io.github.YuliiaKovalova/dotnet-template-mcp

Search, inspect, preview, and create .NET projects from dotnet new templates via AI agents.

README

Microsoft.TemplateEngine.MCP

<!-- mcp-name: io.github.YuliiaKovalova/dotnet-template-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.

<a href="https://glama.ai/mcp/servers/@YuliiaKovalova/dotnet-template-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@YuliiaKovalova/dotnet-template-mcp/badge" alt="DotnetTemplateMCP MCP server" /> </a>

Instead of this:

bash
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.

No existing tooling does this — most template authors discover issues only after dotnet new install fails or produces wrong output.

Tools

ToolWhat it does
template_searchSearch locally and on NuGet.org — one call, ranked results
template_listList what's installed, filter by language/type/classification
template_inspectParameters, constraints, post-actions — all in one shot
template_instantiateCreate a project. Not installed? Auto-resolves from NuGet. Elicits missing params interactively
template_dry_runPreview files without touching disk
template_installInstall a package (idempotent — skips if already there)
template_uninstallRemove a template package
templates_installedInventory of everything installed
template_from_intent"web API with auth" → webapi + auth=Individual — no LLM needed
template_create_from_existingAnalyze a .csproj → generate a reusable template matching repo conventions
template_composeExecute a sequence of templates (project + items) in one workflow
template_suggest_parametersSuggest parameter values with rationale based on cross-parameter relationships
template_validateValidate a local template directory for authoring issues before publishing
template_compareCompare 2+ templates side by side — parameters, features, frameworks
solution_analyzeAnalyze a solution/workspace — project structure, frameworks, CPM status
packages_upgradeScan a project/solution/folder for outdated NuGet versions and report or apply upgrades (CPM-aware)

📖 Full tool reference →

Hosted deployment

A hosted deployment is available on Fronteir AI.

Quick Start

Global tool (.NET 8+)

bash
dotnet tool install --global DotnetTemplateMCP --version 1.4.0

Zero-install with dnx (.NET 10+)

bash
dnx -y DotnetTemplateMCP --version 1.4.0

VS Code / GitHub Copilot

Add to mcp.json:

json
{
  "servers": {
    "dotnet-templates": {
      "type": "stdio",
      "command": "dnx",
      "args": ["-y", "DotnetTemplateMCP", "--version", "1.4.0"]
    }
  }
}

📖 Claude Desktop, Cursor, and more →

Transport Modes

Stdio (default)

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 / cloud / team-shared)

Streamable HTTP transport for remote, multi-tenant, or CI/CD deployment:

bash
template-engine-mcp --transport http
# or via environment variable:
MCP_TEMPLATE_TRANSPORT=http template-engine-mcp

The HTTP server exposes:

  • /mcp — MCP streamable HTTP endpoint
  • /health — Health check endpoint

Configure the listen URL:

bash
MCP_TEMPLATE_HTTP_URL=http://0.0.0.0:8080 template-engine-mcp --transport http

Connect your MCP client:

json
{
  "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 ParameterElicitation Field
stringText input
bool / booleanCheckbox
int / numberNumber input
Choice parameterSingle-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:

  1. Detects Directory.Packages.props by walking up the directory tree
  2. Strips Version attributes from generated .csproj PackageReferences
  3. Adds missing <PackageVersion> entries to Directory.Packages.props
  4. 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:

json
[
  {"templateName": "webapi", "name": "MyApi", "parametersJson": "{\"auth\": \"Individual\"}"},
  {"templateName": "gitignore", "target": "."}
]

📖 Architecture & smart behaviors →

Tool Profiles (Lite vs Full)

By default, all 15 tools are available. If your agent works better with fewer tools, set the MCP_TEMPLATE_TOOL_PROFILE environment variable:

ProfileToolsWhen to use
full (default)All 15 toolsFull control — advanced workflows, composition, custom templates
lite5 core toolsSimpler agents that just need to find and create projects

Lite profile tools: template_from_intent, template_instantiate, template_inspect, template_search, template_dry_run

json
{
  "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

DocWhat's in it
ConfigurationVS Code, Claude Desktop, Cursor setup + troubleshooting
Tool ReferenceEvery tool's parameters, types, and examples
ArchitectureTemplate cache, smart behaviors, telemetry, project structure
MCP vs SkillsWhy MCP over Copilot Skills — benefits and downsides
Plain LLM vs MCPSide-by-side: what a plain LLM does vs. the MCP tool (4 scenarios)
Skills EquivalentWhat it'd take to cover this with Skills instead

Building & Testing

bash
dotnet build
dotnet test    # 185+ tests — unit, integration, and E2E

CI 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.

bash
# 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.

License

MIT

常见问题

io.github.YuliiaKovalova/dotnet-template-mcp 是什么?

Search, inspect, preview, and create .NET projects from dotnet new templates via AI agents.

相关 Skills

前端设计

by anthropics

Universal
热门

面向组件、页面、海报和 Web 应用开发,按鲜明视觉方向生成可直接落地的前端代码与高质感 UI,适合做 landing page、Dashboard 或美化现有界面,避开千篇一律的 AI 审美。

想把页面做得既能上线又有设计感,就用前端设计:组件到整站都能产出,难得的是能避开千篇一律的 AI 味。

编码与调试
未扫描165.3k

网页应用测试

by anthropics

Universal
热门

用 Playwright 为本地 Web 应用编写自动化测试,支持启动开发服务器、校验前端交互、排查 UI 异常、抓取截图与浏览器日志,适合调试动态页面和回归验证。

借助 Playwright 一站式验证本地 Web 应用前端功能,调 UI 时还能同步查看日志和截图,定位问题更快。

编码与调试
未扫描165.3k

网页构建器

by anthropics

Universal
热门

面向复杂 claude.ai HTML artifact 开发,快速初始化 React + Tailwind CSS + shadcn/ui 项目并打包为单文件 HTML,适合需要状态管理、路由或多组件交互的页面。

在 claude.ai 里做复杂网页 Artifact 很省心,多组件、状态和路由都能顺手搭起来,React、Tailwind 与 shadcn/ui 组合效率高、成品也更精致。

编码与调试
未扫描165.3k

相关 MCP Server

GitHub

编辑精选

by GitHub

热门

GitHub 是 MCP 官方参考服务器,让 Claude 直接读写你的代码仓库和 Issues。

这个参考服务器解决了开发者想让 AI 安全访问 GitHub 数据的问题,适合需要自动化代码审查或 Issue 管理的团队。但注意它只是参考实现,生产环境得自己加固安全。

编码与调试
89.1k

by Context7

热门

Context7 是实时拉取最新文档和代码示例的智能助手,让你告别过时资料。

它能解决开发者查找文档时信息滞后的问题,特别适合快速上手新库或跟进更新。不过,依赖外部源可能导致偶尔的数据延迟,建议结合官方文档使用。

编码与调试
60.0k

by tldraw

热门

tldraw 是让 AI 助手直接在无限画布上绘图和协作的 MCP 服务器。

这解决了 AI 只能输出文本、无法视觉化协作的痛点——想象让 Claude 帮你画流程图或白板讨论。最适合需要快速原型设计或头脑风暴的开发者。不过,目前它只是个基础连接器,你得自己搭建画布应用才能发挥全部潜力。

编码与调试
49.5k

评论