Prerequisites
- Access to Claude Code
- A PromptRepo deployment (local or production)
- An API key from your PromptRepo
/profilepage
Step 1: Generate an API Key
- Open your PromptRepo instance
- Navigate to Profile (
/profile) - Click Create API Key
- Copy the generated key securely
Step 2: Locate the Configuration File
Claude Code uses the same configuration file as Claude Desktop:Even though this file is named
claude_desktop_config.json, it is used by both Claude Desktop and Claude Code.Step 3: Add PromptRepo MCP Server
Edit the configuration file and add your PromptRepo MCP server:promptrepo: A unique identifier for this MCP server (you can choose any name)url: Your PromptRepo MCP endpoint (/api/mcp)x-api-key: Your API key from Step 1
Local Development Setup
If you’re running PromptRepo locally:Multiple Environment Configuration
You can connect to both local and production instances:Step 4: Restart Claude Code
- Close all Claude Code browser tabs
- Clear browser cache (optional but recommended)
- Navigate to claude.ai/code
- Start a new session
Step 5: Verify Integration
Test the connection by asking Claude Code to interact with your prompts:list_prompts tool and display your prompt library.
Available Tools
Claude Code can use these MCP tools:| Tool | Description | Example Usage |
|---|---|---|
list_prompts | Fetches all your prompts | ”Show my prompts” |
get_prompt | Retrieves a specific prompt by ID | ”Get prompt with ID abc123” |
resolve_prompt | Substitutes variables in a prompt | ”Resolve ‘api-doc’ with language=Python” |
search_prompts | Full-text search | ”Search prompts for ‘refactoring‘“ |
Common Workflows
1. Code Review Template
2. Documentation Generation
3. Refactoring with Templates
4. Test Generation
Troubleshooting
Tools not appearing in Claude Code
Cause: Configuration file not loaded or syntax error. Fix:- Validate JSON syntax at JSONLint
- Ensure file is saved in the correct location
- Hard-refresh Claude Code (Cmd+Shift+R / Ctrl+Shift+F5)
- Check browser console for MCP errors
”Invalid API key” error
Cause: Key is incorrect, revoked, or from wrong environment. Fix:- Verify you’re using the correct key for the environment (local vs. prod)
- Generate a new key from
/profile - Update the configuration file
- Restart Claude Code
CORS errors in browser console
Cause: MCP endpoint doesn’t allow cross-origin requests. Fix: The PromptRepo MCP endpoint (/api/mcp) includes CORS headers by default. If you see this error:
- Verify you’re using the correct URL (must include
/api/mcp) - Check if you’re behind a proxy that strips CORS headers
- For self-hosted instances, ensure the route handler includes CORS headers
Connection timeout
Cause: MCP endpoint is unreachable. Fix:- Verify the URL is correct and the server is running
- For local development, ensure
npm run devis active - Check network connectivity and firewall rules
- Test the endpoint directly:
Empty results from list_prompts
Cause: No prompts exist, or you’re authenticated as a different user.
Fix:
- Verify the API key belongs to the correct user
- Create test prompts in PromptRepo
- Check that prompts aren’t archived
- Ensure RLS policies are correctly configured (self-hosted only)
Development Tips
Using PromptRepo in Claude Code Projects
-
Project Context Loading:
-
Consistent Code Style:
-
PR Description Templates:
Prompt Management Workflow
- Store reusable development prompts in PromptRepo
- Use variables (
{{language}},{{framework}}, etc.) for flexibility - Tag prompts by project or domain (“backend”, “frontend”, “testing”)
- Search and resolve prompts directly in Claude Code sessions
Security Considerations
Next Steps
- Learn about Claude Desktop integration
- Explore other MCP-compatible clients
- Read the MCP protocol specification
- Check out API key authentication