GenSpec MCP Server
Converts a USER-STORIES.md file into README, ROADMAP, and SYSTEM-ARCHITECTURE documents for the GenSpec workflow.
GenSpec MCP Server
A Model Context Protocol (MCP) server that converts user stories into structured documentation including README, ROADMAP, and SYSTEM-ARCHITECTURE documents through a guided approval workflow.
Overview
GenSpec MCP Server streamlines the documentation creation process by taking user stories as input and generating three key documentation artifacts:
- README.md - Project overview and setup instructions
- ROADMAP.md - Development roadmap and milestones
- SYSTEM-ARCHITECTURE.md - Technical architecture documentation
The server uses a continuation workflow where each phase can be approved or edited before proceeding to the next phase, ensuring high-quality documentation output.
Features
- MCP Integration - Works seamlessly with Claude Desktop, VS Code with MCP extension, and Cursor
- Template-Based Generation - Uses predefined templates for consistent documentation structure
- Approval Workflow - Generate → Present → Approve/Edit cycle for each document
- Phase Dependencies - ROADMAP requires README, SYSTEM-ARCHITECTURE requires both
- Multiple Entry Points - Start from any phase or run the complete workflow
- Resource Access - Exposes templates via MCP resource protocol
Installation
Prerequisites
- Node.js 18.0.0 or higher
- npm or yarn package manager
Install from npm
npm install -g genspec-mcp
Install from source
git clone <repository-url>
cd genspec-mcp
npm install
npm run build
MCP Client Integration
Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"genspec": {
"command": "npx",
"args": ["genspec-mcp"]
}
}
}
VS Code with MCP Extension
- Install the MCP extension for VS Code
- Add to your VS Code settings or MCP configuration:
{
"mcp.servers": {
"genspec": {
"command": "npx",
"args": ["genspec-mcp"]
}
}
}
Cursor
Add to your Cursor MCP configuration:
{
"mcpServers": {
"genspec": {
"command": "npx",
"args": ["genspec-mcp"]
}
}
}
Usage
The GenSpec MCP server provides several ways to start the documentation generation workflow:
Available Tools
- start_genspec - Run full workflow: README → ROADMAP → SYSTEM-ARCHITECTURE
- generate_readme - Generate README, then continue through ROADMAP → SYSTEM-ARCHITECTURE
- generate_roadmap - Generate ROADMAP, then continue through SYSTEM-ARCHITECTURE
- generate_architecture - Generate only SYSTEM-ARCHITECTURE
Available Prompts
/start-genspec- Invokes start_genspec tool/start-readme- Invokes generate_readme tool/start-roadmap- Invokes generate_roadmap tool/start-arch- Invokes generate_architecture tool
Input Methods
The server accepts user stories in three priority order:
- Inline text - Pass user stories directly as
userStoryparameter - URI reference - Provide
userStoryUrifor the client to fetch via MCP ReadResource - Local file - Falls back to
USER-STORIES.mdin the current directory
Workflow Example
-
Start the workflow:
Use the /start-genspec prompt or start_genspec tool -
Review and approve/edit:
- Generated document is presented for review
- Respond with approval terms: "approve", "approved", "ok", "okay", "yes", "y", "lgtm"
- Or provide edit feedback to regenerate
-
Continue through phases:
- After approval, the workflow continues to the next phase
- Each phase follows the same generate → present → approve/edit cycle
File Structure
genspec-mcp/
├── dist/ # Compiled JavaScript files
├── src/ # TypeScript source files
│ ├── index.ts # MCP server entry point
│ ├── server.ts # GenSpecServer implementation
│ ├── types.ts # Type definitions and constants
│ └── utils/ # Utility modules (Track B, C, D)
├── templates/ # Generation templates
│ ├── 1-generate-readme.md
│ ├── 2-generate-roadmap.md
│ └── 3-generate-system-architecture.md
├── _ai/docs/ # Generated documentation output
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Generated Output
All generated documents are saved to the _ai/docs/ directory:
_ai/docs/README.md- Generated project README_ai/docs/ROADMAP.md- Generated development roadmap_ai/docs/SYSTEM-ARCHITECTURE.md- Generated system architecture
Development
Building
npm run build
Development Mode
npm run dev
Running Tests
npm test
Troubleshooting
Common Issues
Issue: MCP server not detected by client
- Solution: Ensure the server is properly installed and the configuration file syntax is correct
- Check: Restart your MCP client after configuration changes
Issue: "ERR_MISSING_USER_STORIES" error
- Solution: Provide user stories via one of the three supported methods (inline, URI, or local file)
- Check: Ensure USER-STORIES.md exists if using the local file fallback
Issue: "ERR_MISSING_PREREQUISITES" error
- Solution: Generate prerequisite phases first (README before ROADMAP, README and ROADMAP before SYSTEM-ARCHITECTURE)
- Check: Use continuation workflow tools that include prerequisites
Issue: Templates not loading
- Solution: Verify that templates/ directory exists and contains the required template files
- Check: Ensure the package was installed correctly with all files
Issue: Permission errors writing to _ai/docs/
- Solution: Ensure the current directory is writable and _ai/docs/ directory can be created
- Check: Run from a directory where you have write permissions
Debugging
Enable debug logging by setting the DEBUG environment variable:
DEBUG=genspec:* npx genspec-mcp
Getting Help
- Check the MCP specification for protocol details
- Review template files in the templates/ directory for generation logic
- File issues or feature requests in the project repository
System Requirements
- Node.js: 18.0.0 or higher
- Memory: Minimum 512MB available RAM
- Disk Space: 50MB for installation and generated files
- Network: Internet connection for npm installation
Dependencies
Production Dependencies
@modelcontextprotocol/sdk- MCP protocol implementationtypescript- TypeScript compiler and runtimetsx- TypeScript execution engine
Development Dependencies
@types/node- Node.js type definitions
Architecture
The GenSpec MCP server follows a modular architecture with five main tracks:
Core Components
- GenSpecServer (
src/server.ts) - Main MCP server implementation - Type System (
src/types.ts) - Type definitions and constants - Template System (
src/utils/templates.ts) - Template loading and management - Document Generation (
src/utils/llm.ts) - Generation interface and context building - Validation System (
src/utils/validation.ts) - Input validation and prerequisite checking - Approval System (
src/utils/approval.ts) - Approval detection and edit feedback - Phase Management (
src/utils/phases.ts) - Workflow execution and coordination
MCP Protocol Support
- Prompts - Command-style prompts that invoke tools
- Resources - Template access via template:// URI scheme
- Tools - Document generation workflow tools
Workflow Management
- Phase Dependencies - Ensures proper generation order
- Continuation Logic - Seamless transitions between phases
- Single-Workflow Concurrency - Prevents conflicting workflows per workspace
- Approval Cycles - Up to 5 edit cycles per phase before abort
License
MIT License - see LICENSE file for details.
Related Servers
MCP Server AI extension
Provides AI extension capabilities via the Model Context Protocol.
Tabby-MCP-Server
A Tabby plugin implementing an MCP server for AI-powered terminal control and automation.
Scout Monitoring MCP
Scout's official MCP pipes error, trace and metric data from production to your AI agent
Replicate Minimax Image-01
Generate images using the minimax/image-01 model on Replicate.
AI Agent Playwright
An AI agent for the Playwright MCP server, enabling automated web testing and interaction.
Reloaderoo
A local MCP server for developers that mirrors your in-development MCP server, allowing seamless restarts and tool updates so you can build, test, and iterate on your MCP server within the same AI session without interruption.
MCP OAuth Sample
A sample MCP OAuth server implementation using Next.js, providing OAuth 2.1 authentication with Google and PostgreSQL.
DeepInfra API
Provides a full suite of AI tools via DeepInfra’s OpenAI-compatible API, including image generation, text processing, embeddings, and speech recognition.
Deep Code Reasoning MCP Server
Performs complementary code analysis by combining Claude Code and Google's Gemini AI.
Code Graph RAG MCP
Code Rag with Graph - local only installation