paper_format_agent

MCP.Pizza Chef: zxyasfas

This tool formats academic papers in DOCX files by adjusting fonts, spacing, indents, headings, and captions to meet style guidelines. It runs entirely on your computer, ensuring your text content never changes by verifying a content fingerprint before saving. While it requires some technical setup, it helps you prepare theses or papers for submission without uploading files online. It works best with standard paragraphs and tables but may not handle complex layouts like equations or footnotes.

Files/PDF
Other

Use This MCP server To

Format my thesis Word document to meet academic style guidelines Ensure formatting changes don’t alter my paper’s text content Automatically adjust font size, line spacing, and indents in my paper Check if my document’s body text remains unchanged after formatting Apply consistent heading and caption styles to my academic paper Batch format multiple DOCX papers according to a style guide Run a local formatting check without uploading files online

README

Paper Format Agent

中文说明 | English

CI Python License

A local DOCX formatter for theses and papers.

It changes fonts, spacing, indents, headings and captions to match a format guide. It does not rewrite the paper. Before saving, it compares a fingerprint of the body and table text from before and after the run. If the text changed, it aborts instead of writing the formatted file.

Everything runs on your machine. Nothing is uploaded.

the content check

Report fields from a real run (--engine python):

{
  "content_fingerprint_before": "793e6533fd670418141d11fdcf014be19750408129ecff8b1b78a2641a3786db",
  "content_fingerprint_after":  "793e6533fd670418141d11fdcf014be19750408129ecff8b1b78a2641a3786db",
  "content_changed": false,
  "content_guard_enforced": true
}

The two hashes should match. If they don't, the formatter exits with content guard failed and the formatted DOCX is not written.

What the check covers: body paragraphs and tables, with whitespace and stray bullet characters normalized before comparing. Headers and footers are out of scope because the formatter sets those on purpose. Use --engine python when the fingerprint must cover the final saved DOCX; the other engines run a local post-processor after the check, e.g. to refresh the table of contents.

To watch the guard trip, run python tools/demo_content_guard.py. It formats a synthetic paper, then repeats the run with the styling step patched to edit one sentence of the in-memory document. The second run aborts without writing the DOCX.

docs/BENCHMARK.md tracks which authored strings survive a run in small synthetic fixtures, and lists the known gaps.

install and run

pip install -r requirements.txt

python -m paper_format_agent.cli \
  --format-file "format_guide.docx" \
  --paper-file "paper.docx" \
  --out-dir "./output" \
  --engine python

There is also a GUI (python run_gui.py), a batch mode, and JSON template packs for Chinese thesis, journal and IEEE-style formats. See docs/USAGE.md.

limits

Early project. Ordinary paragraphs, headings and tables work better than equations, footnotes and complex layouts. With --strict-required-sections, checks may include char_below_min or blank_page_risk. Do not use it as the only check before a real submission. Keep your original file.

Reference-list formatting is out of scope here: that part is mechanical rules, so it lives in a separate tool, gbt7714_check, which lints reference entries against GB/T 7714.

why I made this

I did not want to upload an unfinished thesis to a formatting website, and I wanted a way to check that formatting did not touch the text. So the default engine runs locally and refuses to save if the text changed.

agents

The repo doubles as an installable agent skill (SKILL.md), and the same pipeline is available as an optional MCP server (Python 3.10+):

pip install "paper-format-agent[mcp]"
paper-format-agent-mcp

Tools: format_paper, extract_format_rules, score_paper. Client config in docs/MCP.md.

contributing

Small PRs are welcome. Adding a synthetic test for a school or journal formatting rule is a good place to start: docs/CONTRIBUTOR_TASKS.md, CONTRIBUTING.md. Notes on the pipeline are in docs/ARCHITECTURE.md.

Do not commit real papers, private school templates, reviewer comments, API keys or generated output. Synthetic fixtures only.

license

MIT. See LICENSE.

paper_format_agent FAQ

Can I use this to automatically format my academic paper in Word?
Yes — it adjusts fonts, spacing, indents, headings, and captions to match formatting rules without changing your text content.
Can I use this to check if my paper’s formatting altered the text?
Yes — it compares a fingerprint of your paper’s content before and after formatting to ensure no text changes.
Which apps or clients can I use this with?
It runs locally on your machine and can be integrated as a skill in some AI assistants supporting MCP, but it does not directly connect to common apps like Word or Google Docs.
Do I need an API key or account to use it?
No — it runs entirely on your computer without uploading files or requiring accounts.
How difficult is it to set up?
It requires developer-level setup, including installing Python packages and running commands on your machine.
Does it handle complex layouts like equations or footnotes?
It works best with ordinary paragraphs, headings, and tables; complex layouts may not format correctly.
Can it format reference lists?
No — reference formatting is handled by a separate tool.
Is my paper uploaded anywhere during formatting?
No — all processing happens locally on your computer to protect your privacy.