
Prompts
STDIOMCP server for managing and retrieving prompt templates with YAML frontmatter support
MCP server for managing and retrieving prompt templates with YAML frontmatter support
A Model Context Protocol (MCP) server for managing and providing prompts. This server allows users and LLMs to easily add, retrieve, and manage prompt templates stored as markdown files with YAML frontmatter support.
# 1. Install git clone https://github.com/tanker327/prompts-mcp-server.git cd prompts-mcp-server npm install && npm run build # 2. Test it works npm test # 3. Add to your MCP client config (e.g., Claude Desktop) # Add this to ~/Library/Application Support/Claude/claude_desktop_config.json: { "mcpServers": { "prompts-mcp-server": { "command": "node", "args": ["/path/to/prompts-mcp-server/dist/index.js"] } } } # 4. Restart your MCP client and start using the tools!
prompts/
directory# Clone the repository git clone https://github.com/tanker327/prompts-mcp-server.git cd prompts-mcp-server # Install dependencies npm install # Build the TypeScript code npm run build # Test the installation npm test
# Clone and set up for development git clone https://github.com/tanker327/prompts-mcp-server.git cd prompts-mcp-server npm install # Start development server with auto-reload npm run dev # Run tests in watch mode npm run test:watch
After installation, verify the server works:
# Start the server (should show no errors) npm start # Or test with MCP Inspector npx @modelcontextprotocol/inspector node dist/index.js
Run the comprehensive test suite:
npm test
Run tests with coverage:
npm run test:coverage
Watch mode for development:
npm run test:watch
The server provides the following tools:
add_prompt
Add a new prompt to the collection. If no YAML frontmatter is provided, default metadata will be automatically added.
create_structured_prompt
Create a new prompt with guided metadata structure and validation.
get_prompt
Retrieve a prompt by name.
list_prompts
List all available prompts with metadata preview. No parameters required.
delete_prompt
Delete a prompt by name.
Once connected to an MCP client, you can use the tools like this:
// Add a prompt without frontmatter - metadata will be added automatically add_prompt({ name: "debug_helper", content: `# Debug Helper Help me debug this issue by: 1. Analyzing the error message 2. Suggesting potential causes 3. Recommending debugging steps` }) // This automatically adds default frontmatter with title "Debug Helper", category "general", etc.
// Create a prompt with explicit metadata using the structured tool create_structured_prompt({ name: "code_review", title: "Code Review Assistant", description: "Helps review code for best practices and potential issues", category: "development", tags: ["code", "review", "quality"], difficulty: "intermediate", author: "Development Team", content: `# Code Review Prompt Please review the following code for: - Code quality and best practices - Potential bugs or issues - Performance considerations - Security vulnerabilities ## Code to Review [Insert code here]` })
// Add a prompt with existing frontmatter - no changes made add_prompt({ name: "custom_prompt", content: `--- title: "Custom Assistant" category: "specialized" tags: ["custom", "specific"] difficulty: "advanced" --- # Custom Prompt Content Your specific prompt here...` })
// Get a prompt get_prompt({ name: "code_review" }) // List all prompts (shows metadata preview) list_prompts({}) // Delete a prompt delete_prompt({ name: "old_prompt" })
prompts-mcp-server/
├── src/
│ ├── index.ts # Main server orchestration
│ ├── types.ts # TypeScript type definitions
│ ├── cache.ts # Caching system with file watching
│ ├── fileOperations.ts # File I/O operations
│ └── tools.ts # MCP tool definitions and handlers
├── tests/
│ ├── helpers/
│ │ ├── testUtils.ts # Test utilities
│ │ └── mocks.ts # Mock implementations
│ ├── cache.test.ts # Cache module tests
│ ├── fileOperations.test.ts # File operations tests
│ ├── tools.test.ts # Tools module tests
│ └── index.test.ts # Integration tests
├── prompts/ # Directory for storing prompt markdown files
│ ├── code_review.md
│ ├── debugging_assistant.md
│ └── api_design.md
├── dist/ # Compiled JavaScript output
├── CLAUDE.md # Development documentation
├── package.json
├── tsconfig.json
└── README.md
The server uses a modular architecture with the following components:
Prompts can include structured metadata using YAML frontmatter:
--- title: "Prompt Title" description: "Brief description of the prompt" category: "development" tags: ["tag1", "tag2", "tag3"] difficulty: "beginner" | "intermediate" | "advanced" author: "Author Name" version: "1.0" --- # Prompt Content Your prompt content goes here...
This server can be configured with various MCP-compatible applications. Here are setup instructions for popular clients:
Add this to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "prompts-mcp-server": { "command": "node", "args": ["/path/to/prompts-mcp-server/dist/index.js"], "env": { "PROMPTS_DIR": "/path/to/your/prompts/directory" } } } }
Add to your Cline MCP settings in VS Code:
{ "cline.mcp.servers": { "prompts-mcp-server": { "command": "node", "args": ["/path/to/prompts-mcp-server/dist/index.js"], "env": { "PROMPTS_DIR": "/path/to/your/prompts/directory" } } } }
In your ~/.continue/config.json
:
{ "mcpServers": [ { "name": "prompts-mcp-server", "command": "node", "args": ["/path/to/prompts-mcp-server/dist/index.js"], "env": { "PROMPTS_DIR": "/path/to/your/prompts/directory" } } ] }
In your Zed settings (~/.config/zed/settings.json
):
{ "assistant": { "mcp_servers": { "prompts-mcp-server": { "command": "node", "args": ["/path/to/prompts-mcp-server/dist/index.js"], "env": { "PROMPTS_DIR": "/path/to/your/prompts/directory" } } } } }
For any MCP-compatible application, use these connection details:
node /path/to/prompts-mcp-server/dist/index.js
PROMPTS_DIR
: Custom directory for storing prompts (optional, defaults to ./prompts
)For development or testing with the MCP Inspector:
# Install MCP Inspector npm install -g @modelcontextprotocol/inspector # Run the server with inspector npx @modelcontextprotocol/inspector node dist/index.js
Create a docker-compose.yml
for containerized deployment:
version: '3.8' services: prompts-mcp-server: build: . environment: - PROMPTS_DIR=/app/prompts volumes: - ./prompts:/app/prompts stdin_open: true tty: true
prompts/
directory if it doesn't existPROMPTS_DIR
environment variableVariable | Description | Default |
---|---|---|
PROMPTS_DIR | Directory to store prompt files | ./prompts |
NODE_ENV | Environment mode | production |
The project includes comprehensive tooling for development:
# Ensure TypeScript is built npm run build # Check that dist/ directory exists and contains .js files ls dist/
npm start
node --version
npx @modelcontextprotocol/inspector node dist/index.js
# Ensure the prompts directory is writable mkdir -p ./prompts chmod 755 ./prompts
inotify-tools
Enable debug logging by setting environment variables:
# Enable debug mode DEBUG=* node dist/index.js # Or with specific debug namespace DEBUG=prompts-mcp:* node dist/index.js
MIT