DocAgent
DocAgent - AI-Powered Document Generation Suite
AI-powered document generation suite with LangGraph workflows and Cursor IDE integration via MCP (Model Context Protocol)
DocAgent is a comprehensive document generation system that creates professional software documentation using AI. It integrates seamlessly with Cursor IDE through MCP servers and supports 12 different document types with orchestrated workflows.
๐ Features
Document Types
๐ Business Requirements (BRD/PRD) - Product and business requirement documents
โ๏ธ Functional Requirements (FRD) - Detailed functional specifications
๐๏ธ System Requirements (SRD) - System architecture and requirements
๐งช Technical Requirements (TRD/TDD) - Technical design and test documents
๐๏ธ Database Design (ERD/API) - Entity relationship diagrams and API specs
๐จ UI/UX Design - Wireframes and design system documentation
๐ Project Planning - Project plans and milestone tracking
โ Test Strategy - Comprehensive testing documentation
๐ CI/CD Documentation - Deployment and environment setup
๐ฆ Release Runbooks - Release procedures and rollback plans
Core Capabilities
๐ LangGraph Workflows - Parallel document generation with conditional logic
๐ฏ Smart Orchestration - Profile-based generation (Full, Lean, Tech-only, PM-only)
๐ป Cursor IDE Integration - Native MCP server integration
๐ก๏ธ Safe File Operations - Collision detection and backup systems
๐ Jinja2 Templates - Customizable document templates
โก FastMCP v2 - Modern MCP protocol implementation
๐ง CLI Tools - Command-line interface for batch operations
๐ฆ Installation
Prerequisites
Python 3.9+
Cursor IDE
Git
Quick Setup
# Clone the repository
git clone https://github.com/vinnyfds/docagent.git
cd docagent
# Install dependencies
pip install -r requirements.txt
# Create environment file
cp .env.template .env
# Edit .env with your API keys
# Verify installation
python scripts/verify_mcp.pyCursor IDE Integration
# Install FastMCP
pip install fastmcp
# The MCP servers will be automatically configured in Cursor
# Restart Cursor to load the DocAgent tools๐ฏ Quick Start
Using Cursor IDE (Recommended)
Open any file in Cursor
Type
/to open command paletteLook for DocAgent tools:
ping()- Health checkgenerate_all()- Generate all documentsorchestrate_docgen()- Profile-based generation
Using CLI
# Generate all documents
python scripts/cli_generate.py --idea tests/fixtures/idea_sample.json --all
# Generate specific documents
python scripts/cli_generate.py --idea my_idea.json --docs brd_prd frd srd
# Use orchestration profiles
python -c "
from orchestrator.graph import orchestrate_docgen
from docs_agent.state import Idea
import json
with open('tests/fixtures/idea_sample.json') as f:
data = json.load(f)
idea = Idea(**data)
result = orchestrate_docgen(idea, profile='lean', overwrite=False)
print('Generated:', result)
"๐๏ธ Architecture
System Overview
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ Cursor IDE โโโโโบโ FastMCP Server โโโโโบโ LangGraph โ
โ โ โ โ โ Workflow โ
โ - Command Paletteโ โ - DocGenAgent โ โ โ
โ - Tools Integration โ โ - Orchestrator โ โ - Parallel Nodesโ
โ - MCP Protocol โ โ - Tool Registry โ โ - Conditional โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโ
โ Document Engine โ
โ โ
โ - Jinja2 Templatesโ
โ - Safe File Ops โ
โ - Output Manager โ
โโโโโโโโโโโโโโโโโโโโProject Structure
docagent/
โโโ docs_agent/ # Core document generation agent
โ โโโ __init__.py # Package initialization
โ โโโ state.py # Pydantic models (Idea, Context, DocRequest)
โ โโโ graph.py # LangGraph workflow definition
โ โโโ server.py # FastMCP server implementation
โ โโโ nodes/ # Document generation nodes
โ โ โโโ brd_prd.py # Business requirements
โ โ โโโ frd.py # Functional requirements
โ โ โโโ srd.py # System requirements
โ โ โโโ ... # Other document types
โ โโโ prompts/ # Jinja2 templates
โ โ โโโ brd_prd.md.jinja
โ โ โโโ openapi.yaml.jinja
โ โ โโโ ...
โ โโโ utils/ # Utilities
โ โโโ render.py # Template rendering
โ โโโ safety.py # Safe file operations
โโโ orchestrator/ # Orchestration layer
โ โโโ graph.py # Orchestration logic
โ โโโ server.py # Orchestrator MCP server
โโโ scripts/ # CLI and utilities
โ โโโ cli_generate.py # Command-line interface
โ โโโ verify_mcp.py # Installation verification
โ โโโ test_mcp_servers.py # Server testing
โโโ tests/ # Test suite
โ โโโ fixtures/ # Test data
โ โโโ idea_sample.json
โโโ outputs/ # Generated documents
โโโ .cursor_rules # Cursor IDE guardrails
โโโ requirements.txt # Python dependencies
โโโ .env.template # Environment template
โโโ README.md # This file๐ฎ Usage Examples
Idea Structure
{
"title": "E-commerce Platform",
"description": "Modern e-commerce platform with AI recommendations",
"context": {
"domain": "E-commerce",
"stakeholders": ["Product Manager", "Engineering Team", "UX Designer"],
"timeline": "6 months",
"budget": "$500K"
},
"personas": [
{"name": "Customer", "description": "Online shoppers"},
{"name": "Admin", "description": "Platform administrators"}
],
"modules": [
{"name": "User Management", "description": "User registration and profiles"},
{"name": "Product Catalog", "description": "Product browsing and search"},
{"name": "Shopping Cart", "description": "Cart and checkout functionality"}
],
"entities": [
{"name": "User", "fields": ["id", "email", "profile"]},
{"name": "Product", "fields": ["id", "name", "price", "inventory"]}
],
"apis": [
{"name": "User API", "methods": ["GET", "POST", "PUT", "DELETE"]},
{"name": "Product API", "methods": ["GET", "POST", "PUT"]}
]
}Orchestration Profiles
PROFILES = {
"full": [
"brd_prd", "frd", "srd", "trd_tdd", "erd_api",
"ui_wireframes", "project_plan", "test_strategy",
"cicd_env", "release_runbook"
],
"lean": ["brd_prd", "frd", "srd", "erd_api"],
"tech_only": ["srd", "trd_tdd", "erd_api", "cicd_env"],
"pm_only": ["brd_prd", "project_plan", "test_strategy", "release_runbook"]
}๐ ๏ธ Development
Running Tests
# Run verification tests
python scripts/verify_mcp.py
# Test MCP servers
python scripts/test_mcp_servers.py
# Generate sample documents
python scripts/cli_generate.py --idea tests/fixtures/idea_sample.json --allCode Quality
# Install development dependencies
pip install ruff pytest
# Run linting
ruff check .
# Run tests
pytest -vContributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
๐ง Configuration
Environment Variables
# Required
OPENAI_API_KEY=your_openai_api_key_here
# Optional
DOCGEN_BUCKET=your_s3_bucket_for_outputs
ALLOW_OVERWRITE=false
LOG_LEVEL=INFO
ENVIRONMENT=development
MCP_HOST=localhost
MCP_PORT=3000Cursor MCP Setup
The MCP servers are automatically configured for Cursor IDE. Manual configuration:
{
"mcpServers": {
"DocGenAgent": {
"command": "cmd",
"args": ["/c", "python", "docs_agent/server.py"],
"cwd": "/path/to/docagent"
},
"DocGenOrchestrator": {
"command": "cmd",
"args": ["/c", "python", "orchestrator/server.py"],
"cwd": "/path/to/docagent"
}
}
}๐ Documentation
๐ Deployment
AWS Lambda (Coming Soon)
# Package for serverless deployment
npm install -g serverless
serverless deployDocker
# Build container
docker build -t docagent .
# Run container
docker run -p 3000:3000 docagent๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Contributors
@vinnyfds - Creator & Maintainer
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
LangGraph - Workflow orchestration
FastMCP - MCP server framework
Cursor IDE - AI-powered development environment
Jinja2 - Template engine
๐ง Support
Issues: GitHub Issues
Discussions: GitHub Discussions
Email: vinnyfds@gmail.com
๐ฏ Transform your ideas into comprehensive documentation with AI-powered precision!