AI Assistance
Warp provides comprehensive AI assistant integration to help you build faster with accurate, documentation-based guidance.
Available Integrations
MCP Server (Recommended)
The Warp MCP (Model Context Protocol) server provides direct access to all documentation for AI assistants like Claude and Cursor.
Features:
- Complete documentation access
- Code examples and patterns
- Interactive prompts for common tasks
- Search across all guides
Installation:
For Claude Desktop, add to your config file:
macOS:
Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"warp": {
"command": "npx",
"args": ["-y", "@warp/mcp-server"]
}
}
}Windows:
Edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"warp": {
"command": "npx",
"args": ["-y", "@warp/mcp-server"]
}
}
}For Cursor, install globally:
npm install -g @warp/mcp-serverUsage:
Once configured, you can ask questions like:
- "How do I implement authentication in Warp?"
- "Show me how to create an embedded checkout"
- "What's the database schema pattern for multi-tenancy?"
- "Help me set up webhooks with signature verification"
The MCP server will automatically provide relevant documentation and code examples.
GitHub Copilot
Warp includes Copilot instructions that are automatically loaded when you open a Warp project.
Location: .github/copilot-instructions.md
What it does:
- Identifies your project as a Warp application
- Knows to check
lib/whop/for existing utilities - References the correct documentation guides
- Follows established code patterns
Example interaction:
// Type: "protect this route from unauthenticated users"
// Copilot will suggest:
import { getCurrentUser } from '@/lib/whop/auth';
import { redirect } from 'next/navigation';
export default async function DashboardPage() {
const user = await getCurrentUser();
if (!user) {
redirect('/login');
}
return <div>Dashboard</div>;
}Cursor Rules
Cursor automatically loads .cursorrules from your project root.
Location: .cursorrules
Features:
- Comprehensive code generation rules
- Required patterns for authentication, webhooks, checkout
- Common mistakes to avoid
- File location references
- Documentation workflow
Usage:
Cursor will automatically:
- Read the
.cursorrulesfile - Understand it's a Warp project
- Reference documentation before answering
- Use existing utilities from
lib/whop/ - Follow documented patterns
Universal Context (.llm)
For AI assistants that support .llm files.
Location: .llm (project root)
Contents:
- Project overview and structure
- Key utilities reference
- Common tasks with examples
- Best practices
- Quick guide references
Supported by:
- Cursor (auto-loaded)
- Some Claude Desktop configurations
- Custom AI integrations
MCP Server Tools
The Warp MCP server provides several tools for AI assistants:
search_docs
Search across all Warp documentation.
// AI assistant can use:
search_docs({ query: "authentication" })
// Returns: All relevant docs about authget_guide
Retrieve a specific development guide.
// AI assistant can use:
get_guide({ guide: "webhooks" })
// Returns: Complete webhooks guide with examplesget_api_reference
Get API utility documentation.
// AI assistant can use:
get_api_reference({ module: "auth" })
// Returns: All auth-related utilitiesget_example
Get code examples for common patterns.
// AI assistant can use:
get_example({ pattern: "protected-route" })
// Returns: Code example for route protectionMCP Server Prompts
Pre-built prompts for common tasks:
setup_warp_app
Guide for initializing a new Warp application.
Covers:
- Installation and project structure
- Environment variables setup
- Database configuration
- Authentication setup
- First steps and best practices
add_feature
Add a specific feature to your app.
Usage: add_feature({ feature: "webhooks" })
Covers:
- Relevant guide reference
- Step-by-step implementation
- Code examples
- Best practices
debug_issue
Debug common Warp/Whop issues.
Usage: debug_issue({ issue: "webhook signature verification failing" })
Provides:
- Likely causes
- Troubleshooting steps
- Solutions with code examples
deploy_checklist
Pre-deployment checklist.
Covers:
- Security review
- Database setup
- Webhook configuration
- Performance optimization
- Monitoring setup
Documentation Resources
When working with AI assistants, reference these locations:
Guides Directory
Location: /nebaura/content/docs/guides/
All 12 comprehensive guides:
authentication.mdx- OAuth flow and route protectionrbac.mdx- Role-based access controlwebhooks.mdx- Event handlingwebsockets.mdx- Real-time featuresembedded-checkout.mdx- Payment integrationsubscriptions.mdx- Membership lifecycleschema.mdx- Database design patternsmigrations.mdx- Drizzle ORM workflowdeployment.mdx- Production deploymentproduction-checklist.mdx- Pre-launch checklistmulti-tenancy.mdx- Multi-tenant architecturenotifications.mdx- Notification system
API Utilities
Location: /nebaura/content/docs/api-utilities.mdx
Complete reference for all 60+ utility functions in lib/whop/.
Configuration
Location: /nebaura/content/docs/environment-variables.mdx
All environment variables and setup instructions.
Best Practices
1. Reference Documentation First
AI assistants should check the relevant guide before suggesting code:
User: "How do I handle webhooks?"
AI: *Checks /nebaura/content/docs/guides/webhooks.mdx*
AI: "According to the webhooks guide, here's the pattern..."2. Use Existing Utilities
Always check lib/whop/ for existing functions:
// ❌ Don't create custom auth logic
const user = await fetch('/api/user').then(r => r.json());
// ✅ Use existing utility
import { getCurrentUser } from '@/lib/whop/auth';
const user = await getCurrentUser();3. Follow Documented Patterns
Match the patterns from the guides:
// From webhooks.mdx
export async function POST(req: Request) {
const body = await req.text();
const signature = req.headers.get('x-whop-signature');
const isValid = await whop.webhooks.verify(body, signature);
if (!isValid) {
return Response.json({ error: 'Invalid' }, { status: 401 });
}
// Handle event...
}4. Include Error Handling
All suggestions should include proper error handling:
try {
const user = await getCurrentUser();
if (!user) {
redirect('/login');
}
// ... protected content
} catch (error) {
console.error('Auth error:', error);
redirect('/error');
}5. Use TypeScript Types
Leverage Drizzle ORM types and SDK types:
import type { User } from '@whop/sdk';
import type { users } from '@/db/schema';
type UserWithRole = typeof users.$inferSelect & {
role: 'admin' | 'member';
};Example AI Interactions
Implementing Authentication
User: "Add authentication to my dashboard page"
AI (with MCP):
I'll use the pattern from the authentication guide.
Here's how to protect your dashboard:
[Provides code using getCurrentUser() from lib/whop/auth]
This follows the documented pattern and includes:
- User check with getCurrentUser()
- Redirect for unauthenticated users
- Proper TypeScript typesCreating Checkout
User: "How do I create a checkout for my premium plan?"
AI (with MCP):
According to the embedded checkout guide, use createSimpleCheckout():
[Provides code example with proper imports and error handling]
For more advanced options (metadata, promo codes), see:
/nebaura/content/docs/guides/embedded-checkout.mdxDebugging Webhooks
User: "My webhooks aren't working"
AI (with MCP):
Let me check the webhooks guide for common issues.
Common problems:
1. Missing signature verification
2. Wrong webhook URL
3. Not returning 200 status
Here's the correct implementation:
[Provides verified webhook handler code]Troubleshooting AI Assistance
MCP Server Not Working
Check Claude Desktop config:
# macOS
cat ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Windows
type %APPDATA%\Claude\claude_desktop_config.jsonTest MCP server:
npx @warp/mcp-server
# Should start without errorsRestart Claude Desktop after config changes.
Copilot Not Using Instructions
- Ensure
.github/copilot-instructions.mdexists - Reload VS Code window
- Check Copilot status bar
Cursor Not Loading Rules
- Verify
.cursorrulesis in project root - Restart Cursor
- Check Cursor settings for custom rules
Manual Context Sharing
If AI assistants don't automatically load context, share relevant guides:
This is a Warp project. Before answering:
1. Check documentation in /nebaura/content/docs/
2. Review utilities in lib/whop/
3. Follow patterns from relevant guide
For authentication, see: /nebaura/content/docs/guides/authentication.mdxUpdating Documentation Context
When documentation changes, update the MCP server:
# Rebuild MCP server
cd packages/warp-mcp
npm run build
# Or reinstall
npm install -g @warp/mcp-serverContributing to AI Context
To improve AI assistance:
- Keep guides updated - Reflect current best practices
- Add examples - More code examples = better AI suggestions
- Document patterns - Common patterns should be in guides
- Update MCP server - Keep
src/docs.tsin sync with guides
Related
- Getting Started - Project setup
- API Utilities - Available functions
- Guides - All development guides
Tip: The more specific your questions to AI assistants, the better answers you'll get. Reference specific guides or utilities when asking for help.
