Programmatic Word document generation with LaTeX equations, style presets, citations, charts, and MCP server
Project description
🔨 PaperSmith
Programmatic Word document generation with LaTeX equations, academic formatting, citations, charts, and MCP server.
PaperSmith wraps python-docx into a fluent, high-level API that handles all the boilerplate for professional document generation. It bundles its own LaTeX-to-OMML equation pipeline, citation management with multiple styles, chart generation, metadata scrubbing, and exposes an MCP server so any LLM can generate documents directly.
✨ Features
- 📠Fluent Document API — Create professional Word documents with a clean, chainable API
- 📠LaTeX Equations — Inline
$...$and display$$...$$equations rendered as native OMML (editable in Word) - 🎨 Style Presets — Academic, modern, report, formal, minimal — or define your own
- 📚 Citations & Bibliography — APA, IEEE, Harvard, MLA, Chicago styles with BibTeX import
- 📊 Charts & Infographics — Bar, line, pie, scatter charts via matplotlib, embedded as high-res images
- 🔠Live Editing — Open, navigate, find/replace, and modify existing documents
- 💬 Review Support — Comments, footnotes, endnotes, and tracked changes
- 📋 Metadata Management — Set or scrub author, dates, revision info — leave no generation fingerprints
- 🤖 MCP Server — 25+ tools for LLM-powered document generation (works with Claude Desktop, Cursor, etc.)
- âŒ¨ï¸ CLI Interface — Generate documents from the command line
- 🔌 LLM Provider Abstraction — Swap between OpenAI, Anthropic, Google with a config change
🚀 Quick Start
Installation
# Full install (all features included)
pip install papersmith
Create Your First Document
from PaperSmith import SmithDocument
doc = SmithDocument(preset="academic")
doc.add_cover_page(
title="Advanced Algorithms: Lab Solutions",
author="Jane Smith",
institution="MIT"
)
doc.add_heading("Question 1: Merge Sort Analysis", level=2)
doc.add_text("The time complexity of merge sort is $O(n \\log n)$.")
doc.add_equation(r"T(n) = 2T\left(\frac{n}{2}\right) + \Theta(n)")
doc.add_table(
headers=["Algorithm", "Best", "Average", "Worst"],
rows=[
["Merge Sort", "$O(n \\log n)$", "$O(n \\log n)$", "$O(n \\log n)$"],
["Quick Sort", "$O(n \\log n)$", "$O(n \\log n)$", "$O(n^2)$"],
]
)
doc.set_metadata(author="Jane Smith", scrub=True)
doc.save("solutions.docx")
Citations
from PaperSmith import SmithDocument
doc = SmithDocument(preset="academic")
doc.citations.style = "ieee"
doc.citations.add_source("knuth1997",
author="Donald E. Knuth",
title="The Art of Computer Programming",
year=1997,
publisher="Addison-Wesley",
)
doc.add_heading("Literature Review")
doc.add_text("Sorting algorithms are well studied {cite:knuth1997}.")
doc.add_bibliography()
doc.save("paper.docx")
MCP Server (for LLM Integration)
# Start MCP server for Claude Desktop / Cursor
papersmith mcp-server --transport stdio
Claude Desktop config (claude_desktop_config.json):
{
"mcpServers": {
"PaperSmith": {
"command": "PaperSmith",
"args": ["mcp", "--transport", "stdio"]
}
}
}
VS Code workspace MCP config: put the same server definition in .vscode/mcp.json.
This repository includes a working example at examples/mcp_quickstart.py.
📦 Installation
pip install papersmith installs the full runtime feature set: documents, equations, citations, charts, PDF export, MCP, CLI, and LLM provider support.
For development tools only, install pip install -e ".[dev]".
ðŸ› ï¸ CLI Usage
# Generate a document from markdown
papersmith convert notes.md -o notes.docx --preset academic
# Generate with LLM assistance
papersmith generate questions.md -o solutions.docx --provider openai
# Scrub metadata from a document
papersmith scrub report.docx --author "John Doe"
# List available presets
papersmith presets
# Start MCP server
papersmith mcp-server --transport stdio
📖 Documentation
Full documentation is available at imnb57.github.io/PaperSmith.
🤠Contributing
We welcome contributions! See CONTRIBUTING.md for guidelines.
# Clone and install for development
git clone https://github.com/imnb57/PaperSmith.git
cd PaperSmith
pip install -e ".[dev]"
# Run tests
pytest
# Lint and format
ruff check src/ tests/
ruff format src/ tests/
# Type check
mypy src/PaperSmith/
🚀 Releasing
This repository already includes a GitHub Actions release workflow at .github/workflows/release.yml.
To publish without Twine, tag a release and push it:
git tag v0.1.1
git push origin v0.1.1
The workflow uses PyPI trusted publishing, so no local Twine account or API token is needed once the PyPI project is configured for this GitHub repository.
Claiming papersmith on PyPI
- Sign in to your PyPI account.
- Open the
papersmithproject page on PyPI, or create the project by publishing the first release. - In the project settings, add a trusted publisher for this repository:
imnb57/PaperSmith. - Keep the GitHub Actions workflow environment name as
pypito match the PyPI trusted publisher entry. - Tag
v0.1.1and push it once the trusted publisher is saved.
📄 License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file papersmith-0.1.1.tar.gz.
File metadata
- Download URL: papersmith-0.1.1.tar.gz
- Upload date:
- Size: 90.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b121ca30881e2c79d24c268776099f83b50f5ee9913d45252bf24806233b39bb
|
|
| MD5 |
55b084502e7d274ddb9944fb02f71d29
|
|
| BLAKE2b-256 |
46fb610f3b06c94ccf640b4f1fab287bb0a0d7fe40f38ff17eda7d5e901b3c07
|
Provenance
The following attestation bundles were made for papersmith-0.1.1.tar.gz:
Publisher:
release.yml on imnb57/papersmith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
papersmith-0.1.1.tar.gz -
Subject digest:
b121ca30881e2c79d24c268776099f83b50f5ee9913d45252bf24806233b39bb - Sigstore transparency entry: 1786957362
- Sigstore integration time:
-
Permalink:
imnb57/papersmith@b19a6db1dab966f6cd379067d6dd21c44b400aa8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/imnb57
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b19a6db1dab966f6cd379067d6dd21c44b400aa8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file papersmith-0.1.1-py3-none-any.whl.
File metadata
- Download URL: papersmith-0.1.1-py3-none-any.whl
- Upload date:
- Size: 59.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f140464cbac1cac3bdb93e60bb3961d28b29feabba4da9a9dc1270ebad888d0f
|
|
| MD5 |
7630ecafc735f3b8262eac6cd5e1b71a
|
|
| BLAKE2b-256 |
e76e544b786aecf58e561bdcb0e579635808c3f56281ac99901815fe4a7de098
|
Provenance
The following attestation bundles were made for papersmith-0.1.1-py3-none-any.whl:
Publisher:
release.yml on imnb57/papersmith
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
papersmith-0.1.1-py3-none-any.whl -
Subject digest:
f140464cbac1cac3bdb93e60bb3961d28b29feabba4da9a9dc1270ebad888d0f - Sigstore transparency entry: 1786957474
- Sigstore integration time:
-
Permalink:
imnb57/papersmith@b19a6db1dab966f6cd379067d6dd21c44b400aa8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/imnb57
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b19a6db1dab966f6cd379067d6dd21c44b400aa8 -
Trigger Event:
push
-
Statement type: