Prompt Registry MCP
A lightweight, file-based server for managing and serving personal prompt templates with variable substitution support via the Model Context Protocol. It allows users to store, update, and organize prompts in a local directory through integrated MCP tools and CLI assistants.
README
Prompt Registry: Your Personal Prompt Registry Server 🏰✍️
MCP Prompt Registry is a lightweight, file-based Model Context Protocol (MCP) prompt server designed for developers. It runs via stdio, making it perfect for local development and integration with CLIs or desktop AI assistants that support MCP. It allows you to manage your prompts in a single directory, keeping your workflow simple and portable.
✨ Features
- Single Prompt Storage Directory:
- All prompts are stored in a single directory. You can control the location with the
PROMPT_REGISTRY_PROJECT_DIRenvironment variable. If not set, prompts are stored in~/.promptregistry/in your home directory.
- All prompts are stored in a single directory. You can control the location with the
- File-Based: Prompts are simple JSON files – easy to read, edit, and version control.
- Standard MCP Compliance:
- Exposes prompts via standard
prompts/list(lists all prompts). - Allows prompts to be used via standard
prompts/get(applies template variables). - Notifies clients of changes via
notifications/prompts/list_changed.
- Exposes prompts via standard
- Management via MCP Tools:
add_prompt: Add new prompts.get_prompt_file_content: View the raw JSON of a prompt.update_prompt: Modify prompts.delete_prompt: Remove prompts.filter_prompts_by_tags: Discover prompts by tags.
- Stdio Interface: Communicates over standard input/output, ideal for local tools.
- Template Variables: Supports
{{variable_name}}syntax in prompt content. - Zod Schema Validation: Robust validation for tool arguments.
Prerequisites
- Node.js: Version 18 or higher.
- npm (or yarn).
- (Optional) Docker: If you want to run the server in a container.
📁 Directory Structure for Prompts
The server uses a single directory for all prompts:
- If the environment variable
PROMPT_REGISTRY_PROJECT_DIRis set, prompts are stored in that directory. - If not set, prompts are stored in
~/.promptregistry/in your home directory. On first startup, or if prompts are missing, the server will attempt to copy predefined prompts from a localdefault_prompts_data/directory (if present) into~/.promptregistry/.
Prompt JSON File Structure (your-prompt-id.json):
{
"id": "your-prompt-id",
"description": "A brief description for MCP listing",
"content": "Your prompt template, e.g., Explain {{concept}} like I'm {{age}}.",
"tags": ["tag1", "category_a"],
"variables": {
"concept": { "description": "The concept to explain", "required": true },
"age": { "description": "The target audience's age", "required": false }
},
"metadata": { "version": "1.1", "author": "You" }
}
🚀 Installation and Running
Installing via Smithery
To install Prompt Registry for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @stevengonsalvez/promptregistry-mcp --client claude
1. Using the Published NPM Package (Recommended for Clients)
If promptregistry-mcp is published to npm, clients can easily run it.
- Ensure Node.js and npx are installed.
- Configure your MCP client (like Claude Desktop or Amazon Q) to use it. See examples below.
2. Local/Manual Installation (For Development or Direct Use)
-
Clone the repository or download the files: (Assuming you have
server.ts,package.json,tsconfig.json, and an optionaldefault_prompts_data/directory) -
Install dependencies: Navigate to the server's root directory in your terminal:
npm install # or # yarn install -
Build the server (compile TypeScript):
npm run buildThis will create a
dist/directory with the compiled JavaScript. -
Run the server:
- For development (uses
tsxto run TypeScript directly, with auto-restart on changes):npm run dev - To run the compiled version:
npm run start:prod
The server will start listening on
stdinand outputting tostdout. Console messages from the server (like "Server is running...") will appear onstderr.It will create the prompt directory (either as specified by
PROMPT_REGISTRY_PROJECT_DIRor~/.promptregistry/) if it doesn't exist. - For development (uses
3. Running with Docker
-
Build the Docker image: Ensure you have Docker installed. From the server's root directory:
docker build -t mcp-promptregistry .(You can change
mcp-promptregistrytopromptregistry-mcpor your preferred image name) -
Run the Docker container:
docker run -i -t --rm mcp-promptregistry-i: Keep STDIN open (interactive).
The container will have its own internal prompt directory. To persist prompts outside the container or use existing local prompts:
# Example: Mount local directory into the container docker run -i -t --rm \ -v "$HOME/.promptregistry:/root/.promptregistry" \ mcp-promptregistry(Note: The home directory for the
rootuser inside the Alpine container is/root)
🔌 Connecting with MCP Clients
Here's how you might configure clients like Claude Desktop or Amazon Q to use your MCP Prompt Registry. The exact JSON structure might vary slightly based on the client's implementation, but the core idea is to define a stdio server.
Option A: Using the (Hypothetically) Published NPM Package promptregistry-mcp
If this server were published to npm as promptregistry-mcp, the configuration would be very clean:
// Example client configuration JSON
{
"mcpServers": {
"mcp-promptregistry": {
"command": "npx",
"args": [
"mcp-promptregistry"
],
"env": {
"PROMPT_REGISTRY_PROJECT_DIR": "/path/to/your/prompts"
}
}
}
}
This assumes promptregistry-mcp when run via npx correctly starts the stdio server.
Option B: Running from Local (Compiled) Source
If you've built the server locally and want to point your client to it:
// Example client configuration JSON
{
"mcpServers": {
"localPromptRegistry": {
"command": "node",
"args": [
"/full/path/to/your/mcp-promptregistry/dist/server.js"
],
"env": {}
}
}
}
Replace /full/path/to/your/mcp-promptregistry/ with the actual absolute path to where you cloned/built the server.
Important Considerations for Client Configuration:
- Absolute Paths: When specifying paths for local commands (Option B), always use absolute paths, as the client application might execute the command from a different working directory.
- Environment Variables (
env): UsePROMPT_REGISTRY_PROJECT_DIRto control where prompts are stored. - Client-Specific Structure: The top-level key (e.g.,
"mcpServers") and the exact structure can vary between different MCP client applications. Adapt thecommand,args, andenvto fit the client's requirements. The key is how it invokes your stdio server.
🧪 Testing the Server
1. Manual Stdio (JSON-RPC)
The most direct way to test. Run your server, then paste JSON-RPC messages into the same terminal and press Enter.
Example prompts/list request:
{"jsonrpc":"2.0","id":"list1","method":"prompts/list"}
The server's JSON-RPC response will appear on stdout. Server logs will appear on stderr.
Example add_prompt tool call:
{"jsonrpc":"2.0","id":"add1","method":"tools/call","params":{"name":"add_prompt","arguments":{"id":"my-test-prompt","content":"Test content: {{var1}}","tags":["test"],"variables":{"var1":{"description":"A test variable"}}}}}
2. MCP Inspector
The MCP Inspector is a GUI tool that can connect to MCP servers.
-
To connect to a locally running server (compiled):
mcp-inspector --stdio "node /path/to/your/mcp-promptregistry/dist/server.js" -
To connect to the Docker container:
mcp-inspector --stdio "docker run -i --rm mcp-promptregistry"(Replace
mcp-promptregistrywith your image name if different. Ensuremcp-inspectoris installed and in your PATH.)The Inspector allows you to see available prompts and tools, make requests, and view responses interactively.
🧰 Using with Claude Desktop (Example Workflow)
Once MCP Prompt Registry is added as an MCP server in Claude Desktop (using one of the configurations above):
- Discover Prompts: Your custom prompts should appear in Claude Desktop's prompt library or be accessible via its command interface (e.g., by typing
/or similar, depending on Claude's UI). Thedescriptionyou set in your prompt's JSON file will be visible. - Select a Prompt: Choose one of your prompts.
- Fill Arguments: If the prompt has variables (e.g.,
{{concept}},{{age}}), Claude Desktop should provide UI fields for you to enter these values. Thedescriptionfor each variable (from your prompt's JSON) can guide the user. - Execute: Claude Desktop will send a
prompts/getrequest to your server with the filled arguments. Your server will apply the template and return the final prompt content to Claude. - Management Tools: To use tools like
add_promptorfilter_prompts_by_tagsfrom Claude Desktop, Claude would need a way to send arbitrarytools/callrequests to connected MCP servers. If this isn't directly supported, you'd typically use MCP Inspector or manual stdio alongside Claude for management tasks.
🛠️ Available Management Tools
Your MCP Prompt Registry exposes the following tools (callable via MCP tools/call requests):
add_prompt: Adds a new prompt to the prompt directory.- Args:
id,content,description(optional),tags(optional),variables(optional),metadata(optional).
- Args:
get_prompt_file_content: Retrieves the raw JSON definition of the prompt.- Args:
id.
- Args:
update_prompt: Updates an existing prompt.- Args:
id, and any fields to update (content,description, etc.).
- Args:
delete_prompt: Deletes a prompt from the prompt directory.- Args:
id.
- Args:
filter_prompts_by_tags: Lists prompts that match all specified tags. Returns a summary (id, description, tags).- Args:
tags(array of strings).
- Args:
load_default_prompts: Copies all prompts from thedefault_prompts_data/directory (if present) into the active prompt directory, skipping any that already exist. Useful for populating or restoring default prompts.- Args: None.
example
⚠️ Troubleshooting & Gotchas
- Stdio Server Logging: Remember,
console.log()in yourserver.tswill break MCP communication over stdio because it writes tostdout. All server-side diagnostic/status logs should useconsole.error(), which writes tostderr. For logs you want the client to potentially see, use MCP's logging capability viacontext.sendNotificationin tool handlers (if the client supports it). - Server Startup Messages on Stderr: Some initial server startup messages, such as directory creation or automatic default prompt loading, will appear on
stderr(e.g.,Attempting to create prompt directory: /Users/stevengonsalvez/.promptregistryorAuto-loaded 2 default prompt(s) into ~/.promptregistry: code-review-assistant, prompt-writing-assistant). This is becausestdoutis reserved for MCP JSON-RPC messages, and these startup actions occur before a client context is available forsendNotification. - Permissions: Ensure the server process has write permissions for the prompt directory.
- JSON Validity: Ensure your prompt JSON files are valid.
- Absolute Paths for Clients: When configuring clients with local server paths, always use absolute paths.
🌱 Contributing & Future Ideas
This is a starting point! Future enhancements could include:
- More sophisticated templating.
- A watch mode to auto-reload prompts when files change.
- Support for other storage backends (e.g. postgres, github (or gists), sqllite).
Pull requests and ideas are welcome!
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
