Skip to content

feat(mcp): add clean_office tool (part of #61) - #93

Merged
kingrishabdugar merged 3 commits into
kingrishabdugar:mainfrom
avanithumballi:feat/mcp-clean-office
Oct 9, 2026
Merged

kingrishabdugar merged 3 commits into
kingrishabdugar:mainfrom
avanithumballi:feat/mcp-clean-office

Conversation

@avanithumballi

Copy link
Copy Markdown
Contributor

What does this change?

Adds the first "no canvas" engine from #61: a clean_office MCP tool that strips author, editor, company, title and embedded thumbnail from .docx / .xlsx / .pptx files, running entirely on disk with no network.

Part of #61 (does not close it — the issue asks for several engines, one PR each).

Type of change

  • 🧰 New tool or feature

How did you test it?

  • New unit test in tests/mcp.test.ts cleans the report.docx fixture, re-opens the written file with unzipSync, and checks the author is gone from docProps/core.xml while word/document.xml is still present. Runs with npx vitest run tests/mcp.test.ts (11/11 pass).
  • Tried the tool end to end via the MCP client: npx vitest run tests/mcp.test.ts exercises clean_office over the real InMemoryTransport, not just the engine.
  • Full suite: npx tsc --noEmit clean; npx vitest run 214 passed / 1 failed (transcribe.test.ts, Windows CRLF line endings, fails on main too); npm run build:mcp passes; npm run build passes with no Node code in the browser bundle; npx playwright test 1139 passed / 1 failed (app.e2e.ts:378, pre-existing Windows touch-emulation issue, not in scope).

Also in this PR: a Windows fixture-path fix. new URL(..., import.meta.url).pathname returns /C:/Users/... on Windows, which Node resolves to C:\C:\Users\.... Two helpers switched to fileURLToPath. Without this, tests/mcp.test.ts couldn't run on Windows at all, and 26 e2e tests failed. This is a separate commit.

Checklist

  • Nothing leaves the visitor's device (no new network requests, CDNs or third-party scripts)
  • npm run check passes — see notes below
  • npm run test:e2e passes — 1139/1140, one pre-existing Windows touch-emulation failure
  • New user-facing text is added to src/i18n.ts (English) — N/A, this tool only runs on the MCP server, not in the browser UI
  • New dependencies (if any) are permissively licensed and listed in THIRD_PARTY_NOTICES.md — no new dependencies: uses node:buffer and fflate, both already in the project

Notes on npm run check: I don't have that exact script name in my local checkout; I ran the equivalent commands the issue asked for — npx tsc --noEmit, npx vitest run, npm run build:mcp, npm run build, npx playwright test. Happy to run npm run check if it exists and I've missed it.

@avanithumballi

Copy link
Copy Markdown
Contributor Author

Hi @kingrishabdugar — opened #93 for clean_office, the first "no canvas" engine you suggested. Node adapter, MCP tool, and a test that opens the output and checks its contents. Also included a small Windows fixture-path fix (fileURLToPath) that was blocking the test suite on Windows.

Next on my list is one of the Excel/CSV converters in src/engine/convert.ts — happy to start once this one lands, or in parallel if you prefer.

@kingrishabdugar

Copy link
Copy Markdown
Owner

Thanks a lot, @avanithumballi, and no worries at all about the timing, I hope the exams went well!

This is a really nice first engine: it reuses cleanOffice from the website as-is, the test opens the saved file and checks the author is gone while the content is still there, and the fileURLToPath change is a good catch for Windows. I ran it locally: typecheck, the full test suite and the MCP build all pass. I've approved the CI run, so the checks are running now.

Two small things before I merge:

  1. mcp/README.md still says Office files are "coming". Could you add clean_office to its list of tools and update that line?
  2. mcp/src/server.ts, mcp/src/tools.ts and tests/mcp.test.ts are missing the newline at the end of the file. Most editors have a setting for this.

Once those are in and CI is green, I'll merge it. And yes, an Excel/CSV converter from src/engine/convert.ts is a great next step. Same pattern, one tool per PR.

@avanithumballi

Copy link
Copy Markdown
Contributor Author

Done — both changes are in:

  • mcp/README.md: added clean_office to the tools table, updated the intro to mention Office files, and removed "Office files" from the "coming" line at the bottom.
  • Trailing newlines added to mcp/src/server.ts, mcp/src/tools.ts and tests/mcp.test.ts.

Pushed as b73a832. CI should re-run automatically.

@avanithumballi

Copy link
Copy Markdown
Contributor Author

@kingrishabdugar check this once

@kingrishabdugar
kingrishabdugar merged commit dbca940 into kingrishabdugar:main Oct 9, 2026
2 checks passed
@kingrishabdugar

Copy link
Copy Markdown
Owner

Merged, thank you @avanithumballi! 🎉 clean_office is now part of the MCP server, and the Windows test fix will help everyone who works on Fizzdoc from Windows.

Whenever you're ready, the Excel/CSV converter from src/engine/convert.ts would be a great next one. Same pattern as this PR. No rush at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants