Skip to main content
Glama

DocAgent - AI-Powered Document Generation Suite

Python FastMCP LangGraph License: MIT

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

Related MCP server: MCP Documentation Server

๐Ÿ“ฆ 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.py

Cursor 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

  1. Open any file in Cursor

  2. Type / to open command palette

  3. Look for DocAgent tools:

    • ping() - Health check

    • generate_all() - Generate all documents

    • orchestrate_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 --all

Code Quality

# Install development dependencies
pip install ruff pytest

# Run linting
ruff check .

# Run tests
pytest -v

Contributing

  1. Fork the repository

  2. Create a feature branch (git checkout -b feature/amazing-feature)

  3. Commit your changes (git commit -m 'Add amazing feature')

  4. Push to the branch (git push origin feature/amazing-feature)

  5. 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=3000

Cursor 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 deploy

Docker

# 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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ง Support


๐ŸŽฏ Transform your ideas into comprehensive documentation with AI-powered precision!

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vinnyfds/docagent'

If you have feedback or need assistance with the MCP directory API, please join our Discord server