This is a tool that allows you to add commonly used prompts to an MCP server, enabling quick access to predefined prompt guidelines in editors that support MCP, such as Cursor.
In daily development work, we often need to repeatedly input the same prompt instructions:
- Testing Guidelines: Having to re-describe testing specifications and best practices every time you write tests
- Code Review: Repeatedly explaining code review standards and checklist items
- Query Generation: Repeatedly explaining database query generation rules and format requirements
- Documentation Writing: Repeatedly describing document structure and writing standards
After Using Prompts Hub:
- β One-Click Access: Quick access to predefined prompt guidelines
- π― Language Optimization: Avoid repeatedly organizing language, directly use best practices
- π€ Smart Invocation: AI assistants automatically select and invoke appropriate prompt tools
- π― Context Awareness: Keyword triggers (like "write test") automatically provide relevant guidelines
- π Seamless Integration: AI proactively provides tools without manual searching
Before starting the configuration, you need to clone this project locally:
# Clone the project locally
git clone <repository-url>
cd prompts-hub
# Install dependencies
npm installnpm run buildAfter building, compiled files will be generated in the dist/ directory.
You need to get the complete path of the project for use in MCP configuration:
# Execute in the project root directory to get the complete path
pwdNote the output path, for example: /Users/username/projects/prompts
Depending on the editor you use, the MCP configuration file location may vary:
- Cursor:
~/.cursor/mcp_servers.json - Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json(macOS) - Other Editors: Please refer to the MCP configuration documentation for that editor
Add the following configuration to your MCP configuration file:
{
"mcpServers": {
"prompts-hub": {
"command": "node",
"args": ["/complete/path/to/prompts/dist/index.js"]
}
}
}Important Reminder:
- Please replace
/complete/path/to/prompts/dist/index.jswith the actual path you obtained in Step 2 - The path must point to the
dist/index.jsfile - Use absolute paths to avoid path resolution issues
When you add new prompt tools, you need to rebuild:
npm run buildThen restart your editor to load the updated tools.
You can directly provide prompt content to AI and reference @Plan.md to automatically generate tools:
Usage Example:
Here is my prompt, please refer to @Plan.md to add a tool:
# Component Unit Project Rule
This is a guideline about component unit testing specifications...
AI will automatically follow the detailed process in Plan.md to:
- Analyze prompt requirements and parameters
- Generate complete tool files
- Handle all necessary configurations and registrations
π‘ Tip: Click Plan.md to view the complete tool creation process and specifications
We also provide automated scripts to simplify the tool creation process:
Use the built-in template generator to create new tool files:
npm run generate-templateOpen the generated template file and modify it according to your needs:
-
Modify Basic Information:
const TOOL_NAME = "yourToolName"; // Change to your tool name const TOOL_DESCRIPTION = "Description of what this tool does"; // Tool description
-
Configure Parameter Schema:
- Tools with parameters: Modify
serverInputSchemaandtoolSchema - Tools without parameters: Use empty object (refer to comments in template)
- Tools with parameters: Modify
-
Implement Tool Logic: Add your prompt content and logic in the
runToolfunction
Use the auto-registration command to add the new tool to index.ts:
npm run register-toolnpm run buildprompts/
βββ src/
β βββ tools/ # Prompt tool definitions
β β βββ index.ts # Tool registration (auto-generated)
β β βββ *.ts # Individual tool files
β βββ types/ # TypeScript type definitions
β βββ utils/ # Utility functions
β βββ toolRegistry.ts # Tool registration center
βββ scripts/ # Automation scripts
β βββ template/ # Tool templates
β β βββ toolTemplate.ts # Tool template file
β βββ generateTemplate.js # Template generation script
β βββ updateToolsIndex.js # Tool registration script
βββ package.json
βββ README.md
# Build related
npm run build # Complete build (type check + bundle)
npm run build:rollup # Bundle only
npm run type-check # TypeScript type check
# Development tools
npm run generate-template # Generate new tool template
npm run register-tool # Auto-register all tools to index.tsimport { ToolDefinition } from "../types/toolDefinition.js";
import { createResponse } from "../utils/createResponse.js";
const TOOL_NAME = "testingGuidelines";
const TOOL_DESCRIPTION = "Comprehensive testing guidelines for Jest";
const generateTestingGuidelines = () => `
# Testing Guidelines
## Test Structure
- Use describe blocks for grouping
- Use it/test for individual test cases
- Follow AAA pattern (Arrange, Act, Assert)
## Best Practices
- Write descriptive test names
- Test one thing at a time
- Use proper assertions
`;
async function runTestingGuidelines() {
return createResponse(generateTestingGuidelines());
}
export const tool: ToolDefinition = {
name: TOOL_NAME,
description: TOOL_DESCRIPTION,
schema: {
type: "object",
properties: {},
},
handler: async () => {
return await runTestingGuidelines();
},
};import { z } from "zod";
import { ToolDefinition } from "../types/toolDefinition.js";
import { createResponse } from "../utils/createResponse.js";
const TOOL_NAME = "generateQuery";
const TOOL_DESCRIPTION =
"Generate TypeScript Schema and Hook based on GraphQL Query";
const generateQuerySchema = z.object({
graphPath: z.string().describe("The user-specified graph path"),
query: z
.string()
.describe("The GraphQL Query to generate Schema and Hook from"),
});
const serverInputSchema = {
type: "object",
properties: {
graphPath: {
type: "string",
description:
"The user-specified graph path to generate the Schema and Hook from.",
},
query: {
type: "string",
description: "The GraphQL Query to generate the Schema and Hook from.",
},
},
required: ["graphPath", "query"],
} as const;
const generateQueryPrompt = (graphPath: string, query: string) => `
# Generate TypeScript Schema and Hook
Graph Path: ${graphPath}
GraphQL Query:
\`\`\`graphql
${query}
\`\`\`
Please generate the corresponding TypeScript Schema and Hook based on the provided GraphQL Query.
`;
async function runGenerateQuery(graphPath: string, query: string) {
return createResponse(generateQueryPrompt(graphPath, query));
}
export const tool: ToolDefinition = {
name: TOOL_NAME,
description: TOOL_DESCRIPTION,
schema: serverInputSchema,
handler: async (args: unknown) => {
const validated = generateQuerySchema.parse(args);
return await runGenerateQuery(validated.graphPath, validated.query);
},
};