What is MCP?
The Model Context Protocol is an open standard for connecting AI applications to external data sources and tools. It uses JSON-RPC 2.0 over HTTP/HTTPS, allowing any MCP-compatible client to:- Discover available tools and resources
- Invoke tools with structured parameters
- Receive typed responses
PromptRepo MCP Endpoint
All MCP clients connect to the same endpoint:Authentication
PromptRepo supports two authentication headers:Anonymous Access
If no API key is provided, the endpoint returns public prompts only. This is useful for:- Sharing prompt libraries publicly
- Demo environments
- Read-only integrations
Available Tools
PromptRepo exposes four MCP tools:1. list_prompts
Returns all prompts accessible to the authenticated user.
Request:
2. get_prompt
Fetches a specific prompt by ID.
Request:
3. resolve_prompt
Fetches a prompt and substitutes {{variable}} placeholders with provided values.
Request:
4. search_prompts
Full-text search across prompt names, content, and tags.
Request:
Error Handling
All errors use JSON-RPC 2.0 error codes:| Code | Meaning | Common Cause |
|---|---|---|
-32700 | Parse error | Invalid JSON in request body |
-32600 | Invalid Request | Missing required fields |
-32601 | Method not found | Unsupported tool name |
-32602 | Invalid params | Wrong parameter types |
4001 | Invalid API key | Key is incorrect or revoked |
4004 | Not found | Prompt ID doesn’t exist |
5000 | Internal error | Server-side issue |
Compatible Clients
Cursor
Cursor (the AI-powered code editor) supports MCP servers. Configuration (~/.cursor/mcp_config.json):
Continue.dev
Continue (VS Code extension) supports MCP. Configuration (~/.continue/config.json):
Custom MCP Clients
You can build custom integrations using any HTTP client. Example (Node.js with fetch):CORS Support
The PromptRepo MCP endpoint includes CORS headers:Testing the Endpoint
Usecurl to test the MCP endpoint:
List Prompts
Search Prompts
Resolve Prompt
Self-Hosting Considerations
If you’re self-hosting PromptRepo:Environment Variables
EnsureSUPABASE_SERVICE_ROLE_KEY is set in your deployment environment:
Middleware Exclusion
The MCP endpoint (/api/mcp) is automatically excluded from session authentication middleware, allowing API key-based auth to work without browser cookies.
If you modify src/middleware.ts, ensure /api/mcp remains in the exclusion list:
Rate Limiting
For production deployments, consider adding rate limiting to the MCP endpoint:Security Best Practices
Next Steps
- Read the MCP protocol specification
- Learn about Claude Desktop setup
- Explore Claude Code integration
- Review API authentication