惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
GbyAI
GbyAI
SecWiki News
SecWiki News
Project Zero
Project Zero
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Scott Helme
Scott Helme
A
Arctic Wolf
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
P
Privacy & Cybersecurity Law Blog
Apple Machine Learning Research
Apple Machine Learning Research
T
Tailwind CSS Blog
The Hacker News
The Hacker News
T
Tenable Blog
雷峰网
雷峰网
有赞技术团队
有赞技术团队
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threat Research - Cisco Blogs
T
Threatpost
AWS News Blog
AWS News Blog
L
LINUX DO - 热门话题
Application and Cybersecurity Blog
Application and Cybersecurity Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
SegmentFault 最新的问题
月光博客
月光博客
Spread Privacy
Spread Privacy
S
Secure Thoughts
宝玉的分享
宝玉的分享
博客园 - 三生石上(FineUI控件)
Forbes - Security
Forbes - Security
T
The Exploit Database - CXSecurity.com
G
GRAHAM CLULEY
The Last Watchdog
The Last Watchdog
Y
Y Combinator Blog
I
Intezer
博客园 - 【当耐特】
B
Blog RSS Feed
Attack and Defense Labs
Attack and Defense Labs
I
InfoQ
博客园 - 叶小钗
Cyberwarzone
Cyberwarzone
V2EX - 技术
V2EX - 技术
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Hugging Face - Blog
Hugging Face - Blog
H
Help Net Security
C
CERT Recently Published Vulnerability Notes

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
# Building a Confluence MCP Server for Claude Code: From Setup to Skills
Tariqul Islam Ronnie · 2026-06-16 · via DEV Community

Automate your Confluence workflow directly from Claude Code — publish pages, sync content, and upload images without leaving your terminal.

GitHub: https://github.com/tariqulislam/confluence-mcp-server


What is an MCP Server?

MCP stands for Model Context Protocol — an open standard that lets AI assistants like Claude Code connect to external tools and services. An MCP server acts as a bridge: it exposes a set of tools that Claude Code can call, allowing it to interact with third-party systems (like Confluence) on your behalf.

In this guide you will learn:

  • How the Confluence MCP server is structured
  • How environment variables wire credentials into the server
  • How the server is registered with Claude Code
  • How Claude Code Skills wrap the tools into friendly slash commands
  • How to use every skill end-to-end

Project Structure

confluence-mcp-mock/
├── .env                     ← your credentials (never committed)
├── .env.example             ← template
├── .mcp.json                ← registers MCP servers with Claude Code
├── confluence-mcp/
│   ├── src/
│   │   ├── index.ts         ← entry point
│   │   ├── server.ts        ← tool registration
│   │   ├── config.ts        ← env validation (Zod)
│   │   ├── confluence/
│   │   │   ├── client.ts    ← Axios HTTP client
│   │   │   ├── api.ts       ← REST API calls
│   │   │   ├── parser.ts    ← XHTML to structured data
│   │   │   └── markdown-converter.ts
│   │   └── tools/           ← one file per MCP tool
│   │       ├── connection-check.ts
│   │       ├── list-pages.ts
│   │       ├── publish-page.ts
│   │       ├── read-save-page.ts
│   │       ├── upload-images.ts
│   │       └── sync-pages.ts
│   └── build/               ← compiled output
└── .claude/skills/          ← slash command definitions
    ├── confluence-conn-check/
    ├── confluence-page-list/
    ├── publish-to-confluence/
    ├── confluence-upload-images/
    └── confluence-sync-pages/


Step 1 — Configure Your .env File

The server reads all credentials from a single .env file at the project root. Copy the example template:

cp .env.example .env

Then fill in the four Confluence variables:

# .env  (never commit this file)
CONFLUENCE_URL=https://your-confluence-instance.com/confluence/
CONFLUENCE_USER=your.email@company.com
CONFLUENCE_PERSONAL_ACCESS_TOKEN=your_token_here
CONFLUENCE_SPACE_KEY=MYSPACE

The four variables you need:

CONFLUENCE_URL — Base URL of your Confluence instance. Must end with a trailing slash.
Example: https://confluence.company.com/confluence/

CONFLUENCE_USER — The email address tied to your Confluence account.

CONFLUENCE_PERSONAL_ACCESS_TOKEN — A Bearer token generated in Confluence settings.

CONFLUENCE_SPACE_KEY — The space key where new pages will be created. Example: ENGINEERING

How to generate a Personal Access Token

  1. Log into Confluence and click your avatar → Profile
  2. Navigate to Personal Access Tokens in the left sidebar
  3. Click Create token, give it a name, set an expiry date
  4. Copy the token immediately — it is shown only once

Step 2 — How the Server Loads Credentials

When the server starts, config.ts reads the .env file and validates every variable using Zod — a TypeScript schema library. If any variable is missing or malformed, the server exits with a clear error instead of failing silently later.

// confluence-mcp/src/config.ts  (simplified)
import dotenv from 'dotenv';
import { z } from 'zod';

dotenv.config({ path: join(__dirname, '..', '..', '.env') });

const envSchema = z.object({
  CONFLUENCE_URL: z.string().url(),
  CONFLUENCE_USER: z.string().email(),
  CONFLUENCE_PERSONAL_ACCESS_TOKEN: z.string().min(1),
  CONFLUENCE_SPACE_KEY: z.string().min(1),
});

export const config = envSchema.parse(process.env);

The validated config is imported by client.ts, which creates a single Axios instance used by every tool:

// confluence-mcp/src/confluence/client.ts  (simplified)
const client = axios.create({
  baseURL: config.CONFLUENCE_URL,
  headers: {
    Authorization: `Bearer ${config.CONFLUENCE_PERSONAL_ACCESS_TOKEN}`,
    Accept: 'application/json',
    'Content-Type': 'application/json',
  },
  timeout: 30000,
});

Credentials are set once here and never repeated anywhere else in the codebase.


Step 3 — Register the Server with Claude Code

Claude Code discovers MCP servers through the .mcp.json file in the project root:

{
  "mcpServers": {
    "confluence": {
      "command": "node",
      "args": ["./confluence-mcp/build/index.js"]
    }
  }
}

This tells Claude Code: "When this project is open, launch the node process at that path and communicate with it over stdio."


Step 4 — Build and Start

# Install dependencies
cd confluence-mcp && npm install

# Compile TypeScript to JavaScript
npm run build

# Restart Claude Code to load the new server

During development, use watch mode so the server recompiles on every save:

npm run watch


Step 5 — Understanding the Server Architecture

The server follows a clean three-layer pattern:

Claude Code
    │  (MCP protocol over stdio)
    ▼
server.ts         ← registers tools, routes calls
    │
    ▼
tools/*.ts        ← one file per tool, handles input/output
    │
    ▼
confluence/api.ts ← REST API calls (Confluence v1 endpoints)

How a tool is registered

server.ts declares every tool's name, description, and input schema in the ListToolsRequestSchema handler. Claude Code reads this to understand what tools exist. Calls are then routed in the CallToolRequestSchema handler:

// server.ts  (simplified)
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: 'confluence_connection_check',
      description: 'Verify connection to Confluence and check authentication.',
      inputSchema: { type: 'object', properties: {}, required: [] },
    },
    {
      name: 'confluence_list_pages',
      description: 'List all child pages under a parent page.',
      inputSchema: {
        type: 'object',
        properties: {
          parent_page_id: { type: 'string', description: 'ID of the parent page' },
        },
        required: ['parent_page_id'],
      },
    },
  ],
}));

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  switch (request.params.name) {
    case 'confluence_connection_check':
      return { content: [{ type: 'text', text: await handleConnectionCheck() }] };
    case 'confluence_list_pages':
      return { content: [{ type: 'text', text: await handleListPages(args) }] };
  }
});

Available MCP Tools

confluence_connection_check — Verifies auth and returns server/user info

confluence_list_pages — Lists all child pages under a parent

confluence_read_save_page — Downloads a page (sections, tables, images, comments) to local JSON

confluence_publish_page — Converts markdown to Confluence XHTML and creates/updates a page

confluence_upload_images — Bulk-uploads images from a local directory as page attachments

confluence_sync_pages — Syncs all child pages to local markdown with change tracking


Step 6 — Creating Skills (Slash Commands)

Skills are the user-friendly layer on top of raw MCP tools. A skill is a directory under .claude/skills/ containing a SKILL.md file.

.claude/skills/confluence-conn-check/
└── SKILL.md

SKILL.md format

---
name: confluence-conn-check
description: Verify Confluence server connection and authentication.
argument-hint: (no arguments required)
---

# Confluence Connection Check

Test the connection to Confluence and verify your credentials.

## Usage

/confluence-conn-check

## MCP Tool

confluence_connection_check

The three frontmatter fields that matter:

name — becomes the slash command (e.g. /confluence-conn-check)

description — shown in the / autocomplete menu and used for auto-discovery by Claude

argument-hint — hint shown in autocomplete, e.g. <parent_page_id> or (no arguments required)

When you type /confluence-conn-check in Claude Code, it reads SKILL.md, knows which MCP tool to call, and formats the response back to you.


Step 7 — Using Every Skill

/confluence-conn-check

Verify your credentials before doing anything else.

/confluence-conn-check

Expected response:

{
  "status": "success",
  "user": {
    "displayName": "Jane Doe",
    "email": "jane.doe@company.com"
  },
  "server": {
    "version": "8.5.0",
    "baseUrl": "https://confluence.company.com/confluence"
  }
}


/confluence-page-list <parent_page_id>

List all child pages under a parent so you can find page IDs.

/confluence-page-list 123456789

Response:

{
  "status": "success",
  "message": "Found 3 child page(s)",
  "pages": [
    { "id": "987654321", "title": "Getting Started" },
    { "id": "987654322", "title": "API Reference" }
  ]
}


/confluence-page-read-save-content <page_id>

Download a full page — sections, tables, images, and comments — and save it locally as structured JSON.

/confluence-page-read-save-content 987654321

Saves to:

confluence-docs/con_<parentId>_<pageId>/
├── sections_and_sub_sections_contents.json
├── comments_contents.json
└── images/
    ├── screenshot.png
    └── diagram.jpg


/publish-to-confluence <parent_id> <file.md> [page_id]

Convert a markdown file to Confluence storage format and publish it. Images referenced in the markdown are automatically uploaded as attachments.

Create a new page:

/publish-to-confluence 123456789 docs/architecture.md

Update an existing page:

/publish-to-confluence 123456789 docs/architecture.md 987654321

The markdown converter handles headings, bold/italic, fenced code blocks with syntax highlighting, ordered and unordered lists (nested), pipe tables, local and external images, blockquotes, and horizontal rules.


/confluence-upload-images <page_id> <dir> [batch_size] [delay_ms]

Bulk-upload images from a local directory with configurable rate-limit control.

# Default (3 parallel, 2 s delay between batches)
/confluence-upload-images 987654321 ./screenshots

# Conservative — slow instance or large files
/confluence-upload-images 987654321 ./screenshots 1 3000

Rate-limit tuning guide:

  • batch_size=1, delay_ms=3000 — safest, use on aggressive instances
  • batch_size=3, delay_ms=2000 — default, works for most instances
  • batch_size=5, delay_ms=1000 — faster, for lightly loaded on-premise servers

/confluence-sync-pages <parent_page_id>

Download all child pages under a parent as local markdown files. On repeat runs, only pages that actually changed (version bump or new attachment) are re-downloaded.

/confluence-sync-pages 6656101928

Output structure:

confluence_doc_md/
└── parent_6656101928/
    ├── manifest.json      ← change-tracking index
    ├── page_987654321/
    │   ├── page.md
    │   ├── comments.json
    │   └── images/
    └── page_987654322/
        └── page.md

Each page.md starts with a metadata header:

# Page Title

> Page ID: 987654321
> Version: 5
> Last modified: 2026-05-20T10:30:00.000Z

[page body]

---

## Comments

### Comment by jane.doe (2026-05-19T09:00:00.000Z)

Comment text here.

Change detection logic:

  • First sync (no manifest) → download everything
  • Page version number increased → re-download body, comments, attachments
  • Attachment has newer timestamp → re-download attachments
  • Nothing changed → skip the page entirely

End-to-End Workflow Example

# 1. Verify credentials
/confluence-conn-check

# 2. Find the parent page ID
/confluence-page-list 100000001

# 3. Write docs locally in your editor
# (create docs/my-feature.md)

# 4. Publish
/publish-to-confluence 100000002 docs/my-feature.md

# 5. Update after edits
/publish-to-confluence 100000002 docs/my-feature.md 987654321

# 6. Back up all pages under a parent
/confluence-sync-pages 100000001


Adding a New Tool

To extend the server with a custom tool, follow four steps.

1. Create the tool file at confluence-mcp/src/tools/your-tool.ts:

import { z } from 'zod';

export const yourToolSchema = z.object({
  page_id: z.string().describe('The Confluence page ID'),
});

export async function handleYourTool(input: z.infer<typeof yourToolSchema>) {
  return JSON.stringify({ status: 'success', data: {} }, null, 2);
}

2. Register in server.ts — add to the tool list and the switch statement:

import { handleYourTool } from './tools/your-tool.js';

// in ListToolsRequestSchema handler:
{ name: 'confluence_your_tool', description: '...', inputSchema: { ... } }

// in CallToolRequestSchema handler:
case 'confluence_your_tool':
  return { content: [{ type: 'text', text: await handleYourTool(args) }] };

3. Create the skill at .claude/skills/your-tool/SKILL.md following the format in Step 6.

4. Rebuild and restart:

cd confluence-mcp && npm run build
# Restart Claude Code


Troubleshooting

MCP server not loading
Run npm run build inside confluence-mcp/ and check for TypeScript errors. Verify .mcp.json points to ./confluence-mcp/build/index.js. Fully restart Claude Code — the server process is launched at startup.

401 Authentication Error
Regenerate your Personal Access Token in Confluence settings. Confirm CONFLUENCE_USER is the email associated with the token.

URL errors
CONFLUENCE_URL must end with a trailing slash. If behind a VPN, connect before running.

Publishing formatting issues
Tables need a header separator row (|---|---|). Avoid emoji and raw angle bracket characters (<, >) directly inside table cells — Confluence's XHTML parser rejects them.

Rate limit exceeded during image upload
Slow down: /confluence-upload-images <page_id> <dir> 1 4000


Summary

The full stack in one view:

  • .env — credentials, never committed
  • config.ts — Zod validates env at startup
  • client.ts — single Axios instance with Bearer auth
  • api.ts — Confluence REST v1 endpoint calls
  • tools/*.ts — one handler per MCP tool
  • server.ts — declares tools to Claude Code via MCP protocol
  • .mcp.json — tells Claude Code where to find the server
  • .claude/skills/*/SKILL.md — slash commands that wrap MCP tools

With this architecture you can publish markdown documentation, sync entire Confluence spaces, and upload images — all from a single Claude Code session.


Source code: github.com/tariqulislam/confluence-mcp-server