Title: Use Clerk's MCP server
URL Source: https://clerk.com/docs/guides/ai/mcp/clerk-mcp-server
Markdown Content:
- Guides
- AI
Clerk provides a remote Model Context Protocol (MCP) server that allows AI agents like Claude, Cursor, and Github Copilot to access Clerk SDK snippets and implementation patterns. This provides AI agents with up-to-date code examples when developing with Clerk.
The Clerk MCP server provides:
- SDK snippets: Ready-to-use code patterns for common Clerk features.
- Implementation guides: Best practices for authentication flows, Organizations, and more.
- Framework-specific examples: Patterns optimized for Next.js, React, and other supported frameworks.
If you prefer to configure a client manually, or use a client the CLI doesn't support, select the appropriate tab below to see the specific setup instructions.
Clerk's MCP server provides the following tools:
| Tool | Description |
|---|
clerk_sdk_snippet | Access SDK code snippets and patterns for specific features |
list_clerk_sdk_snippets | List all available snippets and bundles |
Once connected, you can ask your AI assistant questions such as:
- "How do I use the useUser hook in Clerk?"
- "Show me how to set up B2B SaaS with Clerk Organizations"
- "How do I implement a waitlist with Clerk?"
- "What's the best way to protect routes in Next.js with Clerk?"
The MCP server will provide accurate, up-to-date code snippets and implementation patterns.
For comprehensive implementations, you can request these bundles:
- b2b-saas: Complete B2B SaaS setup with Organizations, Billing, and role-based access
- waitlist: Waitlist and early access setup
- auth-basics: Core authentication hooks
- custom-flows: Build custom sign-in/sign-up flows
- organizations: Organization management for multi-tenant apps
- server-side: Server-side authentication patterns
We recommend that all developers building with Clerk use the MCP server to get the best experience out of their agents.
This usually indicates a network or transport issue. Try disconnecting and reconnecting the MCP server, and ensure your client supports Streamable HTTP transport.
No. Clerk's MCP server only supports Streamable HTTP transport, available at https://mcp.clerk.com/mcp.