JSPM

  • Created
  • Published
  • Downloads 87
  • Score
    100M100P100Q93534F
  • License MIT

CLI tool for generating HTML reports with embedded charts and images

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@vint.tri/report_gen_mcp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Report Generator MCP

    A powerful CLI tool and MCP server for generating HTML reports with embedded charts and images.

    Features

    • Generate professional HTML reports from Markdown documents
    • Embed interactive charts (bar, line, pie, doughnut, radar, polarArea)
    • Embed AI-generated images using Pollinations.ai
    • Embed images from URLs
    • Edit existing reports by adding, removing, or replacing content
    • MCP server integration for use with Claude Desktop

    Installation

    npm install -g @vint.tri/report_gen_mcp@latest

    For Python dependencies (required for image generation/editing):

    npm run install-python-deps

    Or set up a Python virtual environment:

    npm run setup-python

    Environment Variables

    • REPORTS_DIR: Directory where reports will be generated (required for CLI and HTTP API modes)
    • CHUTES_API_TOKEN: API token for Chutes AI services (required for image generation/editing)
    • IMG_SAVE_BASE_DIR: Base directory for saving generated/edited images

    Usage

    CLI Mode

    # Set the reports directory
    export REPORTS_DIR=/path/to/reports
    
    # Generate a report
    report_gen_mcp generate --document report.md --elements '{"chart1":{"type":"bar","config":{"labels":["A","B","C"],"datasets":[{"label":"Dataset 1","data":[1,2,3]}]}}}'

    Programmatic Usage (Node.js)

    import { generateReport, generateImage } from '@vint.tri/report_gen_mcp';
    
    // Generate a report
    const reportResult = await generateReport(
      '# My Report\nThis is a sample report with a chart.\n[[chart:chart1]]',
      {
        chart1: {
          type: 'bar',
          config: {
            labels: ['A', 'B', 'C'],
            datasets: [{
              label: 'Dataset 1',
              data: [1, 2, 3]
            }]
          }
        }
      },
      '/path/to/output/report.html'
    );
    
    // Generate an image
    const imageDataUri = await generateImage('A beautiful landscape', {
      width: 512,
      height: 512,
      guidance_scale: 7.5
    });

    HTTP API Mode

    # Start the server
    report_gen_mcp start-server
    
    # Generate a report via HTTP POST to http://localhost:3000/generate-report
    curl -X POST http://localhost:3000/generate-report \
      -H "Content-Type: application/json" \
      -d '{
        "document": "# My Report\nThis is a sample report with a chart.\n[[chart:chart1]]",
        "elements": {
          "chart1": {
            "type": "bar",
            "config": {
              "labels": ["A", "B", "C"],
              "datasets": [{
                "label": "Dataset 1",
                "data": [1, 2, 3]
              }]
            }
          }
        }
      }'

    MCP Server Mode (for Claude Desktop)

    Run without arguments to start the MCP server:

    report_gen_mcp

    Available tools:

    1. generate-report: Generate an HTML report with embedded charts and images
    2. edit-report: Edit an existing HTML report by adding or removing content
    3. generate-image: Generate an image from a text prompt using AI

    Image Generation and Editing

    This tool includes advanced image generation and editing capabilities powered by Chutes AI:

    Generate Image

    Create new images from text prompts with customizable parameters:

    • Prompt (in English)
    • Width and height (128-2048 pixels)
    • Model selection
    • Guidance scale
    • Negative prompts
    • Number of inference steps
    • Seed for reproducibility

    Edit Image

    Modify existing images based on text descriptions:

    • Input image path
    • Output image path
    • Edit prompt (in English)
    • Width and height (512-2048 pixels)
    • CFG scale
    • Negative prompts
    • Number of inference steps
    • Seed for reproducibility

    Report Elements

    Reports can include various elements referenced in the Markdown document using placeholders like [[chart:id]] or [[image:id]].

    Charts

    • Bar charts
    • Line charts
    • Pie charts
    • Doughnut charts
    • Radar charts
    • Polar area charts

    Images

    • AI-generated images (Pollinations.ai)
    • Images from URLs

    Examples

    See the test files in the repository for examples of how to use all features.

    License

    MIT