@visualprd/mcp-server
v1.1.0
Published
Intelligent MCP Server for VisualPRD - Autonomous build orchestration between VisualPRD and AI coding agents
Maintainers
Readme
VisualPRD MCP Server
Intelligent Model Context Protocol server for autonomous build orchestration between VisualPRD and AI coding agents.
This MCP server acts as an intelligent middleman between your VisualPRD project and AI coding assistants like Cursor, Claude, and Windsurf. It doesn't just fetch data — it thinks, orchestrates, adapts, and guides the entire build process.
Features
Autonomous Decision Making
- Tracks build prompt dependencies automatically
- Fetches relevant context for each step
- Validates completion before moving forward
Intelligent Context Optimization
- Only fetches entities relevant to the current task
- Reduces token usage by 60-80% compared to dumping all project data
- Automatically includes design system for UI tasks
- Includes schema relationships for database tasks
Error Detection & Recovery
- Pattern-based error analysis for common issues
- Suggests multiple fix approaches with confidence scores
- Can inject new build steps when migrations are needed
- Provides code examples for fixes
Gap Filling Intelligence
- Detects missing authentication flows (password reset, email verification)
- Identifies incomplete CRUD operations
- Suggests schema field additions
- Warns about missing error handling pages
Contextual Guidance
- Technical considerations based on tech stack
- Potential issues to watch out for
- Testing criteria for each step
- Related patterns from completed steps
Installation
Option 1: NPM (Recommended)
npm install -g @visualprd/mcp-serverOption 2: From Source
cd mcp-server
npm install
npm run build
npm linkConfiguration
For Cursor
Add to your Cursor MCP settings (Settings → Extensions → MCP Servers):
{
"mcpServers": {
"visualprd": {
"command": "visualprd-mcp",
"args": ["--project", "YOUR_PROJECT_ID"],
"env": {
"FIREBASE_PROJECT_ID": "visualprd-app",
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/service-account.json"
}
}
}
}For Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"visualprd": {
"command": "visualprd-mcp",
"args": ["--project", "YOUR_PROJECT_ID"],
"env": {
"VISUALPRD_PROJECT_ID": "YOUR_PROJECT_ID",
"FIREBASE_PROJECT_ID": "visualprd-app"
}
}
}
}Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| VISUALPRD_PROJECT_ID | Your VisualPRD project ID | Yes |
| VISUALPRD_API_KEY | API key (if using hosted API) | No |
| VISUALPRD_API_URL | API base URL | No |
| FIREBASE_PROJECT_ID | Firebase project ID | For direct Firestore |
| GOOGLE_APPLICATION_CREDENTIALS | Path to service account JSON | For direct Firestore |
Available Tools
get_next_build_step
Get the next build step with full intelligent context.
Example Response:
{
"step": {
"promptId": "prompt-003",
"title": "Implement User Authentication Flow",
"category": "pages",
"instruction": "Create the LoginPage component...",
"estimatedMinutes": 45
},
"relatedEntities": {
"pages": [{ "pageName": "LoginPage", "route": "/login", ... }],
"schemas": [{ "collectionName": "users", "fields": [...] }],
"endpoints": [{ "name": "authenticateUser", "method": "POST", ... }],
"designSystem": { "colorPalette": {...}, "typography": {...} }
},
"contextualGuidance": {
"technicalConsiderations": [
"Use Firebase Auth SDK for authentication",
"Store auth state in context for app-wide access"
],
"potentialIssues": [
"Remember to handle auth state persistence",
"Password reset flow may not be defined"
],
"testingCriteria": [
"User can log in with valid credentials",
"Invalid credentials show error message"
]
},
"buildProgress": {
"totalSteps": 25,
"completedSteps": 2,
"currentStep": 3,
"percentComplete": 8
}
}mark_step_complete
Mark a step as complete and automatically fetch the next one.
Parameters:
promptId(required): ID of the step to mark completecompletionNotes: Description of what was donefilesCreated: Array of file paths createdtestResults: Object withpassedandfailedcounts
Example:
{
"promptId": "prompt-003",
"completionNotes": "LoginPage implemented with Zod validation",
"filesCreated": ["src/pages/LoginPage.tsx", "src/services/auth.ts"],
"testResults": { "passed": 8, "failed": 0 }
}report_error
Report an error and get intelligent diagnosis with fixes.
Parameters:
promptId(required): Where the error occurrederrorType(required):compile_error,runtime_error,test_failure,missing_dependency,othererrorMessage(required): The error messagestackTrace: Stack trace if availablecontext: What you were doing when it occurred
Example Response:
{
"diagnosis": {
"rootCause": "Field 'emailVerified' is defined in schema but not in database",
"explanation": "The schema definition is ahead of the actual database state",
"severity": "high"
},
"suggestedFixes": [
{
"approach": "Database Migration",
"steps": [
"Create migration script for users collection",
"Add default value for emailVerified",
"Run migration before continuing"
],
"code": {
"filename": "migrations/add-email-verified.ts",
"content": "// Migration script..."
},
"confidence": 0.9
}
],
"shouldInjectNewStep": true,
"newStep": {
"title": "Database Migration: Add emailVerified to users",
"category": "database"
}
}get_entity_details
Get detailed information about a specific entity.
Parameters:
entityType(required):page,schema,endpoint,techentityId(required): ID or name of the entityincludeRelationships: Include relationship info (for schemas)includeUsageExamples: Include code examples
get_debug_suggestions
Get AI-powered debugging suggestions when stuck.
Parameters:
currentTask(required): What you're trying to doissue(required): The problem you're facingcontext: Additional contextattemptedSolutions: What you've already tried
inject_dynamic_step
Add a new build step when you identify missing functionality.
Parameters:
insertAfter(required): Prompt ID to insert aftertitle(required): Title of the new stepcategory(required): Step categoryreason(required): Why this step is neededinstruction(required): Detailed instructions
get_build_progress
Get current build progress statistics.
get_design_system
Get the project's design system specifications.
Parameters:
section:all,colors,typography,spacing,components
How It Works
Architecture
┌─────────────────────────────────────────────────────────────┐
│ AI Agent (Cursor/Claude/Windsurf) │
│ "Help me build the next feature" │
└─────────────────────┬───────────────────────────────────────┘
│ MCP Protocol
↓
┌─────────────────────────────────────────────────────────────┐
│ VisualPRD MCP Server │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ Intelligence Layer │ │
│ │ • Context Optimizer - Fetches relevant data only │ │
│ │ • Error Analyzer - Diagnoses issues, suggests fixes │ │
│ │ • Gap Filler - Detects missing flows │ │
│ │ • Guidance Generator - Provides contextual help │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ VisualPRD Client │ │
│ │ • Firestore connection │ │
│ │ • Caching layer │ │
│ │ • Entity resolution │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────┬───────────────────────────────────────┘
│
↓
┌─────────────────────────────────────────────────────────────┐
│ Firestore Database │
│ • projects/{projectId}/ │
│ • pages/ │
│ • databaseSchemas/ │
│ • apiEndpoints/ │
│ • techStack/ │
│ • buildPrompts/ │
└─────────────────────────────────────────────────────────────┘Intelligence Decision Making
The server uses a tiered intelligence approach to minimize costs:
- Rule-Based (Free): Simple lookups, status changes, dependency checks
- Pattern Matching (Free): Known error patterns, common gaps
- Lightweight AI (Cheap): Complex debugging suggestions
- Full AI (Expensive): Only when truly needed
Context Optimization
The server intelligently decides what context to include:
| Prompt Type | Included Context | |-------------|------------------| | UI/Pages | Design system, related components, state specs | | Database | Full schema with relationships, indexes | | Integration | Endpoints with auth, tech stack configs | | Setup | Full tech stack, environment requirements |
Example Usage Flow
User: "Help me build my VisualPRD project"
MCP Server:
✓ Loads project abc123
✓ Finds next available step (Step 3: User Authentication)
✓ Fetches LoginPage spec, user schema, auth endpoint
✓ Generates contextual guidance
Response: "Ready to work on Step 3 of 25: Implement User Authentication Flow
I've fetched:
- LoginPage spec with component structure
- User schema with 14 fields
- authenticateUser endpoint (POST /api/auth/login)
- Design system for consistent styling
Technical considerations:
- Use Firebase Auth SDK
- Store session in context
Watch out for:
- Password reset flow isn't defined yet
- Remember auth state persistence"
User: [Implements LoginPage]
User: "Done, mark it complete"
MCP Server:
✓ Validates: files created ✓, tests passing ✓
✓ Updates Firestore
✓ Fetches next step automatically
Response: "✅ Step 3 complete!
Next up: Step 4 - Implement User Dashboard"Troubleshooting
"Project not found"
- Verify the project ID is correct
- Ensure Firebase credentials have access to the project
"Permission denied"
- Check Firebase security rules allow read access
- Verify service account has correct permissions
"Module not found" errors
- Run
npm installin the mcp-server directory - Ensure you're using Node.js 18+
Tools not appearing in Cursor
- Restart Cursor after adding MCP config
- Check the MCP server logs for errors
- Verify the server starts correctly:
visualprd-mcp --help
Development
Building
npm run buildRunning in Dev Mode
npm run devTesting
npm testLicense
MIT
