Back to Browse

Patrakit MCP Server

DesignModerate5.8MCP RegistryLocal
Free

Server data from the Official MCP Registry

Generate Word, PDF, PowerPoint, Excel, and HTML reports from JSON or Markdown

About

Generate Word, PDF, PowerPoint, Excel, and HTML reports from JSON or Markdown

Security Report

5.8
Moderate5.8Moderate Risk

patrakit is a report-generation library exposed via an MCP server that renders Word, PDF, PowerPoint, Excel, and HTML files from JSON or Markdown input. The visible code shows no exfiltration, shell execution, or hardcoded secrets, and permissions broadly match its purpose. The main concerns are that the render tool accepts an arbitrary output_dir and filename without path restriction, and that the MCP tools perform no authentication, which is typical for local stdio servers but worth noting; the truncated sections (ai.py, markdown parser, renderers) were not fully reviewed. Supply chain analysis found 3 known vulnerabilities in dependencies (0 critical, 1 high severity). Package verification found 1 issue.

6 files analyzed · 8 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

File System Read

Reads files on your machine. Normal for tools that analyze or process local data.

File System Write

Writes or modifies files on your machine. Check that this is expected for the tool.

file_system

Check that this permission is expected for this type of plugin.

process_spawn

Check that this permission is expected for this type of plugin.

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "patrakit": {
      "command": "uvx",
      "args": [
        "patrakit==0.2.1"
      ]
    }
  }
}

Some servers take additional arguments. See the repository for details.

Documentation

View on GitHub

From the project's GitHub README.

patrakit

PyPI Version Python Version Install PyPI Downloads License GitHub Stars GitHub Issues GitHub Forks

Describe a report once in Python, JSON, or Markdown. Save it as Word, PDF, PowerPoint, Excel, or HTML.

Install

Python 3.11 or later.

pip install patrakit

For pandas DataFrames:

pip install "patrakit[pandas]"

PDF output uses Typst through its Python package. You do not need Microsoft Office, LibreOffice or a web browser to create files.

Quickstart

Save this as quickstart.py and run python quickstart.py.

from patrakit import Report, Heading, Text, KPIRow, Table, Chart

sales = [
    {"region": "North", "revenue": 1250000, "growth": 0.12},
    {"region": "South", "revenue": 980000, "growth": 0.07},
    {"region": "East", "revenue": 1120000, "growth": 0.09},
    {"region": "West", "revenue": 850000, "growth": -0.03},
]

report = Report(
    title="Quarterly Sales Review",
    subtitle="Synthetic demo data",
    theme="modern",
    blocks=[
        Heading("Summary"),
        Text("Revenue grew in three of four regions."),
        KPIRow({"Revenue": "$4.2M", "New accounts": 128}),
        Heading("Revenue by region", level=2),
        Chart.bar(
            sales,
            x="region",
            y="revenue",
            title="Revenue by region",
            alt_text="Bar chart comparing revenue in four regions",
        ),
        Table(sales, formats={"revenue": "currency:USD", "growth": "percent:1"}),
    ],
)

for extension in ("docx", "pdf", "pptx", "xlsx", "html"):
    result = report.save(f"review.{extension}")
    print(result.path)
    for warning in result.warnings:
        print(f"  {warning.code}: {warning.message}")

You get five files from one report definition. Each format follows its own layout rules, so the files share content and style but do not look identical.

Gallery

Each image must come from the code beside it. scripts/build_gallery.py runs the files in gallery/snippets/ and creates the images. All data is synthetic.

Word, PowerPoint and Excel pages are rendered for these images with LibreOffice. They can look slightly different in Microsoft Office.

PDF

from patrakit import Report, KPIRow, Chart

sales = [
    {"region": "North", "revenue": 1250000},
    {"region": "South", "revenue": 980000},
]
Report(
    title="Sales Review",
    blocks=[
        KPIRow({"Revenue": "$2.23M"}),
        Chart.bar(sales, x="region",
                  y="revenue"),
    ],
).save("sales.pdf")

Word

from patrakit import (
    Report, Heading, BulletList)

Report(
    title="Weekly Status",
    blocks=[
        Heading("Done this week"),
        BulletList([
            "Login flow shipped",
            "12 bugs closed",
        ]),
    ],
).save("status.docx")

PowerPoint

from patrakit import Report, Heading, Chart

mrr = [
    {"month": "Sep", "mrr": 41000},
    {"month": "Oct", "mrr": 44500},
    {"month": "Nov", "mrr": 47200},
]
Report(
    title="SaaS Monthly Review",
    blocks=[
        Heading("MRR trend"),
        Chart.line(mrr, x="month", y="mrr"),
    ],
).save("saas.pptx")

Excel

from patrakit import Report, Heading, Table

runs = [
    {"model": "model-a", "pass_rate": 0.91},
    {"model": "model-b", "pass_rate": 0.87},
]
Report(
    title="Evaluation Results",
    blocks=[
        Heading("Pass rate"),
        Table(runs, formats={
            "pass_rate": "percent:1"}),
    ],
).save("evals.xlsx")

Template gallery

Ready-to-use templates you can download and run. Each generates real output files from synthetic data.

patrakit templates list
patrakit templates download sales-report ./demo
python ./demo/annual_sales_report.py
TemplateCategoryFormatsDownload
Academic Performance ReportEducationPDF, Wordpatrakit templates download academic-performance
Weekly Project Status ReportBusinessPDF, Wordpatrakit templates download project-status-report
Six Years Financial ReportFinancePDF, Excelpatrakit templates download financial-report
Commercial InvoiceBusinessPDF, Excelpatrakit templates download commercial-invoice
Annual Sales ReportBusinessPDF, PowerPointpatrakit templates download sales-report

You can also search templates by keyword:

patrakit templates search invoice
patrakit templates list --category finance

All templates use made-up data and need no API key.

Five runnable examples

The examples are included in the package, so you do not need to clone the repository.

patrakit examples list
patrakit examples copy invoice ./demo
python ./demo/invoice.py
NameScriptCreatesNeedsGuide
saas-monthly-reviewsaas_monthly_review.pyPowerPoint, PDFpatrakitCreate a SaaS monthly review in PowerPoint and PDF with Python
invoiceinvoice.pyPDF, ExcelpatrakitGenerate an invoice PDF and Excel file in Python
project-statusproject_status.pyWord, PDFpatrakitAutomate a weekly project status report in Word with Python
analyticsanalytics_report.pyWord, PDFpatrakit[pandas]Pandas DataFrame to a Word and PDF report
ai-evaluationai_evaluation_report.pyPDF, ExcelpatrakitTurn LLM evaluation results into a PDF and Excel report in Python

All examples use made-up data and need no API key. The invoice is a layout example. It does not claim to meet the tax or legal invoice rules of any country.

What is free

Every feature in this section is in the free package. There are no watermarks, page limits, accounts or licence keys.

Content blocks

BlockExample
Heading, levels 1 to 3Heading("Summary", level=1)
Text; a blank line starts a new paragraphText("Revenue grew.")
Bullet listBulletList(["One", "Two"])
KPI rowKPIRow({"Revenue": "$4.2M"})
TableTable(rows, formats={"amount": "currency:INR"})
Bar, line and pie chartsChart.bar(rows, x="month", y="sales")
ImageImage("logo.png", alt_text="Company logo", width=0.4)
Page or slide breakBreak()

Tables and charts accept a list of dictionaries. With the pandas extra, they also accept a DataFrame. Image width is a share of the content width, from 0 to 1.

Value formats

FormatInputShown as
textNorthNorth
integer12500001,250,000
number:23.141593.14
percent:10.1212.0%
currency:USD1250000$1,250,000.00
currency:INR1250000₹12,50,000.00
datedatetime.date(2026, 11, 29)29 Nov 2026

patrakit formats values. It does not convert currencies or calculate totals.

Themes

Three themes are built in: classic, modern and minimal. You can also load your own theme file.

# acme.yaml
base: modern
fonts:
  heading: Montserrat
  body: Source Sans 3
  table: Source Sans 3
  code: JetBrains Mono
  fallback: [Noto Sans]
  font_dirs: [./fonts]
colors:
  primary: "#1F4E79"
  accent: "#C55A11"
  text: "#1F2328"
logo: assets/logo.png
header: "Acme Pvt Ltd"
footer: "Confidential"
from patrakit import Report, Text, Theme

report = Report(
    title="Board Update",
    theme=Theme.load("acme.yaml"),
    blocks=[Text("All milestones are on track.")],
)
report.save("update.pdf")

Paths in a theme file are relative to that file. The code font role is reserved because version 1 has no code block.

Custom fonts

Set one font family for everything, or set each role:

from patrakit import Report, Text, Theme, Fonts

theme = Theme(base="classic", fonts=Fonts(family="Noto Sans", font_dirs=["./fonts"]))
report = Report(title="Notes", theme=theme, blocks=[Text("Hello")])
report.save("notes.pdf", strict_fonts=True)
  • Fonts come from your computer or your font_dirs. patrakit does not download fonts.
  • A missing font produces a warning and uses a fallback. With strict_fonts=True, saving fails instead.
  • Word, PowerPoint and Excel files store font names, not the fonts. The reader's computer needs the same fonts. Use Fonts.office_safe() when you share these files. PDF creation may need those fonts on your own computer too.
  • Built-in themes use Office-safe names in Office files and bundled open fonts in PDF. A font that you choose applies to all four formats.
  • Support for a writing system is claimed only after it is tested. Check your output.
  • You are responsible for the licences of fonts you add.

Run patrakit fonts to list the font families that patrakit can find.

JSON input and command line

You can describe the same report in JSON. This is useful for other programming languages and AI agents.

{
  "schema_version": "1.0",
  "title": "Quarterly Sales Review",
  "theme": "modern",
  "blocks": [
    {"type": "heading", "level": 1, "text": "Summary"},
    {"type": "text", "text": "Revenue grew in three of four regions."},
    {"type": "kpi_row", "items": [{"label": "Revenue", "value": "$4.2M"}]},
    {"type": "bullet_list", "items": ["North grew 12%", "West fell 3%"]},
    {
      "type": "chart",
      "chart_type": "bar",
      "title": "Revenue by region",
      "alt_text": "Bar chart comparing revenue in four regions",
      "categories": ["North", "South", "East", "West"],
      "series": [{"name": "Revenue", "values": [1250000, 980000, 1120000, 850000]}]
    },
    {
      "type": "table",
      "columns": [
        {"key": "region", "label": "Region", "format": "text"},
        {"key": "revenue", "label": "Revenue", "format": "currency:USD"}
      ],
      "rows": [
        {"region": "North", "revenue": 1250000},
        {"region": "South", "revenue": 980000}
      ]
    }
  ]
}
patrakit validate report.json
patrakit render report.json -o report.pdf
patrakit render report.json -o report.pptx --theme acme.yaml --strict-fonts
patrakit schema -o report.schema.json

From Python, use Report.from_file("report.json") for a file, or Report.from_json(data) for a JSON string or dictionary.

Image paths must stay inside the report's asset folder. For a JSON file, that is the folder that contains it. patrakit does not load images from web addresses.

HTML output

patrakit also renders to self-contained HTML files — useful for email, web previews, chatbot responses, and Streamlit/Gradio apps.

report.save("review.html")

The HTML file is a single file with inline CSS, embedded chart SVGs, and base64 images. It is responsive, prints cleanly, and needs no external resources.

Markdown input

LLMs generate Markdown naturally. patrakit accepts it directly:

from patrakit import Report

md = """
# Monthly Report

Revenue grew 9% year over year.

| Region | Revenue | Growth |
|--------|---------|--------|
| North  | $1.25M  | 12%    |
| South  | $980K   | 7%     |

- Launched mobile app
- Closed 128 accounts
"""

report = Report.from_markdown(md)
report.save("report.pdf")
report.save("report.docx")

Headings, paragraphs, bullet lists, tables, images, and horizontal rules are all converted to patrakit blocks. Markdown files (.md) are also accepted by Report.from_file() and the CLI.

Natural-language report generation

Generate a report from a plain-English description using your own LLM account:

from patrakit import Report

report = Report.from_prompt(
    "Create a quarterly sales report with revenue $4.2M across 4 regions, "
    "include a bar chart and summary table",
    provider="openai",  # or "anthropic", "google"
)
report.save("sales.pdf")

Set your API key via environment variable (OPENAI_API_KEY, ANTHROPIC_API_KEY, or GOOGLE_API_KEY) or pass api_key= explicitly. The LLM generates valid patrakit JSON; patrakit validates and auto-retries once if the output is invalid.

pip install "patrakit[ai-openai]"    # for OpenAI
pip install "patrakit[ai-anthropic]" # for Anthropic
pip install "patrakit[ai-google]"    # for Google
pip install "patrakit[ai]"           # all three

patrakit sends your prompt to the LLM provider you choose. It never sends your report data to any service.

ReportBuilder — incremental construction

Build reports block by block, useful for streaming LLM output or step-by-step construction:

from patrakit import ReportBuilder, Heading, Text, KPIRow

builder = ReportBuilder(title="Q4 Review", theme="modern")
builder.add(Heading("Summary"))
builder.add(Text("Revenue grew 9% year over year."))
builder.add(KPIRow({"Revenue": "$4.2M"}))

# Validate at any point
errors = builder.validate()

# Save when done
builder.save("report.pdf")

MCP server (Model Context Protocol)

patrakit includes an MCP server so any MCP-compatible AI agent (Claude, Cursor, Windsurf, Cline, etc.) can generate documents as a tool call — no code generation needed.

pip install "patrakit[mcp]"
patrakit mcp-server

Add to your MCP client configuration:

{
  "mcpServers": {
    "patrakit": {
      "command": "patrakit",
      "args": ["mcp-server"]
    }
  }
}

The server exposes five tools:

ToolWhat it does
patrakit_renderRender a JSON report to PDF, Word, PowerPoint, Excel, or HTML
patrakit_validateValidate a report definition without rendering
patrakit_list_templatesList available templates
patrakit_schemaReturn the JSON Schema for report definitions
patrakit_from_markdownConvert Markdown to a rendered report

AI framework integrations

patrakit ships tool wrappers for the major AI/agent frameworks. Each integration is an optional extra — install only what you need.

LangChain

pip install "patrakit[langchain]"
from patrakit.integrations.langchain import PatrakitReportTool, PatrakitMarkdownTool

tools = [PatrakitReportTool(), PatrakitMarkdownTool()]
agent = initialize_agent(tools=tools, llm=llm)
agent.run("Create a PDF sales report for Q4")

LangGraph

pip install "patrakit[langchain]"
from patrakit.integrations.langgraph import get_tools
from langgraph.prebuilt import ToolNode

tool_node = ToolNode(get_tools())

LlamaIndex

pip install "patrakit[llamaindex]"
from patrakit.integrations.llamaindex import PatrakitReportTool
from llama_index.core.agent import ReActAgent

tool = PatrakitReportTool()
agent = ReActAgent.from_tools([tool], llm=llm)

CrewAI

pip install "patrakit[crewai]"
from patrakit.integrations.crewai import PatrakitTool

report_writer = Agent(
    role="Report Writer",
    tools=[PatrakitTool()],
)

Google ADK

pip install "patrakit[google-adk]"
from patrakit.integrations.google_adk import PatrakitReportTool
from google.adk.agents import Agent

agent = Agent(
    name="report_writer",
    tools=[PatrakitReportTool()],
)

Install all integrations

pip install "patrakit[all-integrations]"

For AI agents

A good agent workflow is: read the schema, create the JSON, run patrakit validate, then run patrakit render and read the warnings.

How each format behaves

FormatBehaviourVersion 1 limits
WordFlowing document with real heading, list and table stylesCharts are images, so you cannot edit their data in Word
PDFFixed pagesAccessibility and archival standards are not claimed
PowerPointEach level 1 heading starts a slide; long content continues on new slides; charts are editableCheck slides for fit before you present them
ExcelA summary sheet, plus sheets for tables and editable chartsValues only; no generated formulas
HTMLSelf-contained file with inline CSS, SVG charts, and base64 imagesResponsive; designed for web and email

patrakit creates new documents. It does not edit existing ones or offer a visual designer.

Privacy

The free package makes no network calls, calls no AI service and collects no usage data. Your report stays on the machine that runs the code. Installing packages with pip uses the network as usual.

Free and Pro

patrakit Pro is planned and not on sale yet.

FeatureFreePro (planned)
All content blocks and JSON Schema✓✓
Word, PDF, PowerPoint, Excel and HTML output✓✓
Three built-in themes and your own theme file✓✓
Choose fonts for each role✓✓
Markdown input (Report.from_markdown())✓✓
Natural-language generation (Report.from_prompt())✓✓
ReportBuilder (incremental construction)✓✓
MCP server for AI agents✓✓
LangChain / LangGraph / LlamaIndex / CrewAI / Google ADK tools✓✓
Premium report designs✓
Your own PDF and slide templates✓
Advanced PDF layouts: multi-column, dashboard, cover page✓
AI layout planner that uses your own LLM account✓
Your own Excel templates (after the first Pro release)✓
Bulk rendering (later)✓

Features in the free column will stay free.

In Pro, you choose your LLM provider in one configuration file, patrakit.llm.yaml: Gemini, OpenAI, or an endpoint compatible with the OpenAI Chat Completions API, including a local one. The AI suggests a layout. It does not draw the document or rewrite your values. In the free package, layout="ai" and template= raise FeatureNotAvailableError.

See the Pro page for sample files, proposed prices and draft terms.

Help and contributing

  • Report a bug or ask for a feature with a GitHub issue. Include a small example with made-up data. Never post API keys or private business data.
  • Support for the free package is on a best-effort basis.
  • Read CONTRIBUTING.md before you open a pull request. Report security problems as described in SECURITY.md.

Licence

The free package uses the Apache License 2.0. See LICENSE. Libraries and bundled fonts keep their own licences. See THIRD_PARTY_NOTICES.md. patrakit Pro will have a separate commercial licence.

Reviews

No reviews yet

Be the first to review this server!