Claude Prompts MCP server

Provides a flexible, template-based prompt system for Claude models that enables standardized interactions, complex reasoning workflows, and multi-step prompt chains through a TypeScript/Node.js server with comprehensive API support.
Back to servers
Provider
minipuft
Release date
Mar 18, 2025
Language
TypeScript
Stats
7 stars

The Claude Custom Prompts Server implements the Model Context Protocol (MCP) for Claude AI models, allowing you to create and use custom prompt templates with a modular, category-based organization system. It supports features like prompt arguments, conversation history access, and multi-step prompt chains.

Installation

Prerequisites

  • Node.js v16 or higher
  • npm or yarn

Setting Up the Server

# Clone the repository
git clone https://github.com/yourusername/claude-prompts.git
cd claude-prompts

# Install dependencies and build the server
cd server
npm install
npm run build

# Start the server
npm start

Configuring Claude Desktop

To connect the MCP server to Claude Desktop:

  1. Locate your Claude Desktop configuration file:

    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  2. Add the MCP server configuration:

"mcp_servers": {
  "claude-prompts": {
    "command": "node",
    "args": [
      "C:\\path\\to\\claude-prompts\\server\\dist\\index.js",
      "--transport=stdio"
    ],
    "cwd": "C:\\path\\to\\claude-prompts\\server",
    "env": {
      "PORT": "9090"
    }
  }
}

Important: Replace the paths with absolute paths to your server directory. For Windows, use double backslashes (\\).

  1. Save the file and restart Claude Desktop.

Using Custom Prompts

Once configured, you can use your custom prompts in Claude by typing:

>>command_name argument1=value1 argument2=value2

For example:

>>friendly_greeting name=John

For chain prompts:

>>content_analysis_chain text="Your content here" focus="clarity"

To see all available commands:

>>listprompts

Server Configuration

The server uses two main configuration files:

config.json

{
  "server": {
    "name": "Claude Custom Prompts",
    "version": "1.0.0",
    "port": 9090
  },
  "prompts": {
    "file": "promptsConfig.json",
    "registrationMode": "name"
  },
  "transports": {
    "default": "stdio",
    "sse": { "enabled": false },
    "stdio": { "enabled": true }
  }
}

promptsConfig.json

This file defines prompt categories and imports category-specific prompt files:

{
  "categories": [
    {
      "id": "general",
      "name": "General",
      "description": "General-purpose prompts for everyday tasks"
    },
    {
      "id": "code",
      "name": "Code",
      "description": "Prompts related to programming and software development"
    }
  ],
  "imports": [
    "prompts/general/prompts.json",
    "prompts/code/prompts.json"
  ]
}

Creating Custom Prompts

Adding a New Prompt

  1. Create a markdown file in the appropriate category folder (e.g., prompts/general/my_prompt.md)
  2. Add the prompt template using markdown format
  3. Register the prompt in the category's prompts.json file

Example category-specific prompt file (prompts/general/prompts.json):

{
  "prompts": [
    {
      "id": "friendly_greeting",
      "name": "Friendly Greeting",
      "category": "general",
      "description": "A warm, personalized greeting.",
      "file": "friendly_greeting.md",
      "arguments": [
        {
          "name": "name",
          "description": "The name of the person to greet",
          "required": false
        }
      ]
    }
  ]
}

Creating a New Category

  1. Create a new folder in the prompts directory (e.g., prompts/mycategory/)
  2. Create a prompts.json file in the new folder with an empty "prompts" array
  3. Add your category to the categories array in promptsConfig.json
  4. Add the path to your category's prompts.json file to the imports array

Special Placeholders

You can use {{previous_message}} in your prompt templates to reference the previous message in the conversation context.

Creating Prompt Chains

Prompt chains execute a sequence of prompts, with each prompt using results from previous prompts. To create a chain prompt:

# My Chain Prompt

## Description
Description of what this chain does.

## User Message Template
Initial message template with {{variables}}.

## Chain Steps

1. promptId: first_prompt_id
   stepName: Step 1: Description of first step
   inputMapping:
     prompt_input: chain_input
   outputMapping:
     prompt_output: chain_variable

2. promptId: second_prompt_id
   stepName: Step 2: Description of second step
   inputMapping:
     input1: chain_input
     input2: chain_variable
   outputMapping:
     output: final_result

## Output Format
Description of the expected final output format.

Troubleshooting

Connection Issues

  • Verify the server is running on the expected port
  • Check the paths in your Claude Desktop config.json are correct
  • Make sure the cwd parameter points to the correct server directory

File Path Issues

  • Check your cwd parameter if files are not being found
  • All file paths are resolved relative to the working directory
  • Use absolute paths in the cwd parameter to avoid confusion

Checking Server Status

  • Check the server logs in server.log in the server directory
  • Look for messages like "Server initialized successfully"
  • Try running the server manually to see if it starts correctly:
    cd path/to/claude-prompts/server
    node dist/index.js
    

API Endpoints

The server provides several API endpoints for prompt management:

List all prompts:

GET /api/v1/tools/listprompts

Reload prompts:

curl -X POST http://localhost:9090/api/v1/tools/reload_prompts

Create/update a prompt:

curl -X POST http://localhost:9090/api/v1/tools/update_prompt \
  -H "Content-Type: application/json" \
  -d '{
    "id": "example_prompt",
    "name": "Example Prompt",
    "category": "general",
    "description": "An example prompt template",
    "userMessageTemplate": "This is an example with {{variable}}",
    "arguments": [
      {
        "name": "variable",
        "description": "Example variable",
        "required": true
      }
    ]
  }'

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later