npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-confluence-file-based

v2.0.0

Published

MCP server for Confluence (read/update pages via PAT) with file-based body flow

Readme

mcp-confluence-file-based

CI CodeQL npm version

Translations: Russian, Spanish, Chinese.

This MCP server lets an AI assistant (in Cursor, Claude Desktop, or any MCP-enabled tool) safely read and edit Confluence pages — including the large, macro-heavy ones that usually break.

Teams keep requirements, specs, and project documentation in Confluence. When an AI assistant works with those pages directly, two things tend to go wrong: big pages with tables and macros get garbled or truncated, and a colleague's concurrent edit can be silently overwritten. This server avoids both. Instead of pushing the whole page through the chat, it saves the page body — Confluence's internal storage XHTML format — into a local file. The assistant edits that file and publishes it back only after a version check, so nobody's work is silently lost.

What this gives you in practice:

  • Pages of any size. The page body never floods the chat context, so huge tables and long documents stay workable.
  • Formatting survives. Tables and Confluence macros (ac:structured-macro) are edited as local files instead of being retyped by the model inline.
  • No silent overwrites. If someone changed the page while you were editing, the update is rejected (VersionMismatch) — re-read the page and re-apply your changes.
  • Corporate-ready. Built for Confluence Data Center / On-Premise: PAT authentication, self-signed TLS support.

If you need broad read-only search across Confluence Cloud, comments, or integration with Atlassian cloud capabilities, a broader MCP server may be a better fit.

Example Workflow

In short: the assistant fetches a page into a local XHTML file, edits and re-checks that file locally, and publishes it back through the server with a strict version check — the page body itself never travels through the chat.

How a page edit flows: user asks the AI assistant, the MCP server fetches the page from Confluence into a local file, the assistant edits the file, and the server publishes it back with a version check

  1. The user asks the AI assistant in plain language, for example: "Update the release notes page".
  2. The assistant calls the get_confluence_page tool with pageId or pageUrl.
  3. The MCP server requests the page from the Confluence REST API.
  4. Confluence returns the page data: metadata, the current version (say, 17), and the body in storage XHTML — Confluence's internal page format.
  5. The server saves the page body into a local cache file (CONFLUENCE_CACHE_DIR or system temp).
  6. The cache file is confirmed saved.
  7. The assistant receives structuredContent with metadata and the file path only — for example { "pageId": "123", "version": 17, "bodyFile": "/.../mcpcfb-get-123-v17-....xhtml", "bodySha256": "..." } — so the chat context stays small no matter how big the page is.
  8. The assistant edits only the needed fragment in the file — a table row, an ac:structured-macro, a paragraph — without retyping the whole page inline.
  9. The assistant re-reads the file and self-checks the result (valid XML, intact macros); steps 8–9 repeat until the edit is complete.
  10. The assistant calls update_confluence_page with the bodyFile path and expectedVersion (17); create_confluence_page works the same way for new pages.
  11. The server reads the body file from disk.
  12. The file content is loaded — page bodies are accepted only from local files, never from inline tool parameters.
  13. The server checks the page version and publishes the new body to Confluence.
  14. Confluence confirms the publication: new version 18.
  15. The server returns the confirmation to the assistant, for example { "pageId": "123", "currentVersion": 17, "version": 18, ... }.
  16. The assistant reports back to the user: done, the new version is published.

If someone changed the page between steps 7 and 13, the version check fails and the update is rejected with a VersionMismatch error — the assistant re-reads the page and re-applies the changes, so nobody's work is overwritten silently.

Tools

| Tool | Description | | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------- | | add_confluence_page_labels | Add labels to a page idempotently. | | create_confluence_page | Create a page from a local storage XHTML bodyFile. | | get_confluence_page | Fetch a page and store its body in a local bodyFile. | | list_confluence_child_pages | List direct child pages. | | list_confluence_page_attachments | List attachment metadata for a page (up to 100, no binary or download URLs). | | list_confluence_page_labels | List labels on a page. | | list_confluence_pages | List pages via structured allowlist filters (space, dates, title, label, parent/ancestor) with server-built CQL. | | move_confluence_page | Move a page under a new parent with strict version check. | | remove_confluence_page_labels | Remove labels from a page idempotently. | | update_confluence_page | Update a page from a local bodyFile with strict version check. | | upload_confluence_page_attachment | Upload a local file as a page attachment, creating it or a new version of an existing filename. |

Quick Start

  1. Get a Confluence token. Ask your Confluence administrator for a Personal Access Token (PAT), or create one yourself: in Confluence, open your profile → Personal Access Tokens → create a token.
  2. Connect the server to your AI assistant. Copy the JSON snippet below into your assistant's MCP configuration (Cursor, Claude Desktop, or another MCP-enabled client) and fill in your Confluence URL and the token. Node.js 20+ must be installed; if unsure, ask your IT team.
  3. Check it works. Ask the assistant: "Show me this Confluence page: <paste a page link>". It should fetch the page and describe it.

Runtime Configuration (ENV)

  • CONFLUENCE_BASE_URL (required) — root URL of your Confluence instance, for example https://confluence.example.com.
  • CONFLUENCE_PAT (required) — Confluence Personal Access Token the server authenticates with.
  • CONFLUENCE_INSECURE_TLS — set to true only for trusted self-signed TLS environments.
  • CONFLUENCE_CACHE_DIR — where page bodies are cached locally; treat as sensitive (defaults to system temp).
  • CONFLUENCE_TEXT_CONTENT_COMPAT — set to true only if your AI assistant sees empty results for successful calls (legacy MCP clients that do not read structuredContent).
  • All variables, defaults, and practical examples: see the runtime configuration reference.

npx (recommended)

{
  "mcpServers": {
    "confluence": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mcp-confluence-file-based"],
      "env": {
        "CONFLUENCE_BASE_URL": "https://confluence.example.com",
        "CONFLUENCE_PAT": "YOUR_PAT",
        "CONFLUENCE_INSECURE_TLS": "false",
        "CONFLUENCE_CACHE_DIR": "/tmp/mcp-confluence-cache",
        "CONFLUENCE_CACHE_CLEANUP_INTERVAL_MS": "60000"
      }
    }
  }
}

Local run from sources

npm ci
npm start

Requires Node.js >=20.

For explicit client config, run dist/server.js with node and pass the same ENV values.

Security Considerations

The PAT stays in environment variables and is never written to disk by the server. Cached page bodies may contain private Confluence content — treat the cache directory as sensitive. Writes happen only from local files and only after an expectedVersion check. Full operator guidance and the threat model: SECURITY.md.

Documentation