MCP Prompt Template Selector
Provides AI-powered selection and generation of specialized system prompts from a database of over 66 templates for Claude Code. It uses semantic search to find the best matching template and can adapt it to fit specific user tasks and contexts.
README
MCP Prompt Template Selector
<p align="center"> <strong>AI-powered prompt template selection and generation for Claude Code</strong> </p>
<p align="center"> <a href="#installation">Installation</a> • <a href="#quick-start">Quick Start</a> • <a href="#usage">Usage</a> • <a href="#api">API</a> • <a href="#examples">Examples</a> </p>
MCP server that automatically selects and generates specialized prompts from a knowledge base of 66+ Claude Code system prompts. Uses LLM-powered semantic search to find the best matching template and adapts it to your specific task.
Features
- Smart Template Selection — Semantic search across 66+ prompt templates using Claude Haiku
- Adaptive Generation — Returns original template when it fits, customizes when adaptation is needed
- Custom Templates — Add your own templates with priority over built-in ones
- Dual Transport — Works via stdio (local) or HTTP (server deployment)
- Zero Config — Templates auto-sync from claude-code-system-prompts
Requirements
- Bun v1.0+
- Anthropic API key
Installation
# Clone the repository
git clone https://github.com/YOUR_USERNAME/mcp-prompt-tool.git
cd mcp-prompt-tool
# Install dependencies
bun install
# Configure API key
echo "ANTHROPIC_API_KEY=your-api-key-here" > .env
Quick Start
Connect to Claude Code (recommended)
Add MCP server to Claude Code via command line:
claude mcp add --transport stdio prompt-template-selector -- bun run /path/to/mcp-prompt-tool/src/index.ts
Verify connection:
claude mcp list
Then in Claude Code use /mcp to see available tools.
Alternative: Run as HTTP server
bun run start:http
# Server runs at http://localhost:3000
Usage
Once connected, you have 4 tools available in Claude Code:
list_templates
Browse available templates:
list_templates category:agent
list_templates search:"code review"
select_template
Find best matching template for your task:
select_template task_description:"I need to review GitHub PRs"
generate_prompt
Generate a ready-to-use prompt:
generate_prompt task_description:"Agent for Python code refactoring" context:"Django, async migration"
sync_templates
Update templates from GitHub:
sync_templates force_reindex:true
Examples
Example 1: Code Review Agent
Request:
{
"task_description": "Агент для code review Pull Request на GitHub",
"prompt_type": "agent"
}
Result: Returns the original agent-prompt-review-pr-slash-command template as-is, since it's a perfect match.
You are an expert code reviewer. Follow these steps:
1. If no PR number is provided in the args, use ${BASH_TOOL_OBJECT.name}("gh pr list") to show open PRs
2. If a PR number is provided, use ${BASH_TOOL_OBJECT.name}("gh pr view <number>") to get PR details
3. Use ${BASH_TOOL_OBJECT.name}("gh pr diff <number>") to get the diff
4. Analyze the changes and provide a thorough code review...
Example 2: Custom Task with Adaptation
Request:
{
"task_description": "Agent for legacy Python code analysis and migration to Python 3.12 async/await",
"prompt_type": "agent",
"context": "Django project with synchronous callbacks"
}
Result: Adapts the agent-prompt-plan-mode-enhanced template with Django/async specifics:
You are a Python code modernization specialist for legacy Django projects.
Your role is to analyze and plan refactoring of synchronous callback-based
code with migration to Python 3.12 and async/await patterns.
=== CRITICAL: READ-ONLY MODE ===
...
## Your Process
1. **Understand Requirements**: Focus on the legacy code patterns...
2. **Explore Thoroughly**: Find callback-based patterns and synchronous code...
3. **Design Solution**: Plan async context manager and async generator migrations...
Example 3: Listing Agent Templates
Request:
{
"category": "agent",
"search": "security"
}
Result:
{
"total_count": 2,
"templates": [
{
"name": "agent-prompt-security-review-slash",
"purpose": "Conduct focused security reviews of code changes",
"complexity": "complex"
},
{
"name": "agent-prompt-bash-command-prefix-detection",
"purpose": "Detecting command injection attacks",
"complexity": "complex"
}
]
}
Template Categories
| Category | Count | Examples |
|---|---|---|
agent |
28 | PR review, code exploration, security audit |
system |
10 | Base behavior, plan mode, configuration |
tool |
19 | Bash, Read, Edit, Grep tool descriptions |
reminder |
3 | Plan mode reminders |
skill |
5 | GitHub integration, specialized skills |
Custom Templates
Add your own templates to custom-templates/ directory:
custom-templates/
├── my-agent.md # Your custom prompt
└── metadata.json # Optional: category, tags, priority
metadata.json:
{
"templates": {
"my-agent": {
"category": "agent",
"tags": ["custom", "specialized"],
"priority": 10
}
}
}
Custom templates are prioritized over built-in ones during selection.
API Reference
Tools
| Tool | Description | Required Params |
|---|---|---|
list_templates |
List/search templates | — |
select_template |
Find matching templates | task_description |
generate_prompt |
Generate customized prompt | task_description |
sync_templates |
Sync from GitHub | — |
Parameters
list_templates:
category:agent|system|tool|reminder|skill|anysearch: Text search queryinclude_custom: Include custom templates (default: true)
select_template / generate_prompt:
task_description: What you need the prompt forprompt_type: Filter by categorycontext: Additional context for adaptationtarget_llm: Target model (default: Claude)max_results: Max templates to consider (default: 3)
sync_templates:
force_reindex: Re-index all templates (default: false)
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
ANTHROPIC_API_KEY |
Anthropic API key | — |
PORT |
HTTP server port | 3000 |
Claude Code Integration
Global config (~/.claude.json):
{
"mcpServers": {
"prompt-template-selector": {
"command": "bun",
"args": ["run", "/path/to/mcp-prompt-tool/src/index.ts"]
}
}
}
Project config (.mcp.json in project root):
{
"mcpServers": {
"prompt-template-selector": {
"type": "stdio",
"command": "bun",
"args": ["run", "/path/to/mcp-prompt-tool/src/index.ts"]
}
}
}
Development
# Run in stdio mode (default)
bun run start
# Run as HTTP server
bun run start:http
# Development with watch
bun run dev
# Run tests
bun test
# Type check
bun run typecheck
Project Structure
mcp-prompt-tool/
├── src/
│ ├── index.ts # Entry point (stdio/http)
│ ├── tools/ # MCP tool implementations
│ │ ├── list-templates.ts
│ │ ├── select-template.ts
│ │ ├── generate-prompt.ts
│ │ └── sync-templates.ts
│ ├── services/ # Business logic
│ │ ├── template-loader.ts # GitHub repo sync
│ │ ├── template-indexer.ts # LLM-powered indexing
│ │ ├── prompt-generator.ts # Selection & generation
│ │ └── custom-templates.ts # User templates
│ └── types/
│ └── index.ts
├── templates/ # Cached template index
├── custom-templates/ # User custom templates
├── tests/
├── .env # API key (git-ignored)
└── package.json
How It Works
- Sync: Clones/pulls claude-code-system-prompts
- Index: Uses Claude Haiku to extract metadata from each template
- Select: Semantic search finds best matching templates for your task
- Generate: Returns original or adapts template based on match quality
License
MIT
Credits
- Templates from Piebald-AI/claude-code-system-prompts
- Built with Model Context Protocol SDK
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器