Labsco
tanker327 logo

Prompts MCP Server

โ˜… 15

from tanker327

An MCP server for managing and serving prompts from markdown files with YAML frontmatter support.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeAdvanced setup

Prompts MCP Server

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.

Prompts Server MCP server

Features

  • Add Prompts: Store new prompts as markdown files with YAML frontmatter
  • Retrieve Prompts: Get specific prompts by name
  • List Prompts: View all available prompts with metadata preview
  • Delete Prompts: Remove prompts from the collection
  • File-based Storage: Prompts are stored as markdown files in the prompts/ directory
  • Real-time Caching: In-memory cache with automatic file change monitoring
  • YAML Frontmatter: Support for structured metadata (title, description, tags, etc.)
  • TypeScript: Full TypeScript implementation with comprehensive type definitions
  • Modular Architecture: Clean separation of concerns with dependency injection
  • Comprehensive Testing: 95 tests with 84.53% code coverage

Testing

Run the comprehensive test suite:

npm test

Run tests with coverage:

npm run test:coverage

Watch mode for development:

npm run test:watch

MCP Tools

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.

  • name (string): Name of the prompt
  • content (string): Content of the prompt in markdown format with optional YAML frontmatter

create_structured_prompt

Create a new prompt with guided metadata structure and validation.

  • name (string): Name of the prompt
  • title (string): Human-readable title for the prompt
  • description (string): Brief description of what the prompt does
  • category (string, optional): Category (defaults to "general")
  • tags (array, optional): Array of tags for categorization (defaults to ["general"])
  • difficulty (string, optional): "beginner", "intermediate", or "advanced" (defaults to "beginner")
  • author (string, optional): Author of the prompt (defaults to "User")
  • content (string): The actual prompt content (markdown)

get_prompt

Retrieve a prompt by name.

  • name (string): Name of the prompt to retrieve

list_prompts

List all available prompts with metadata preview. No parameters required.

delete_prompt

Delete a prompt by name.

  • name (string): Name of the prompt to delete

Code to Review

[Insert code here]` })


### Method 3: Manual frontmatter (preserves existing metadata)
```javascript
// 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...`
})

Other operations

// Get a prompt
get_prompt({ name: "code_review" })

// List all prompts (shows metadata preview)
list_prompts({})

// Delete a prompt
delete_prompt({ name: "old_prompt" })

File Structure

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

Architecture

The server uses a modular architecture with the following components:

  • PromptCache: In-memory caching with real-time file change monitoring via chokidar
  • PromptFileOperations: File I/O operations with cache integration
  • PromptTools: MCP tool definitions and request handlers
  • Type System: Comprehensive TypeScript types for all data structures

YAML Frontmatter Support

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

Development

The project includes comprehensive tooling for development:

  • TypeScript: Strict type checking and modern ES modules
  • Vitest: Fast testing framework with 95 tests and 84.53% coverage
  • ESLint: Code linting (if configured)
  • File Watching: Real-time cache updates during development