Transform how you access and interact with your team's knowledge by connecting Claude, Cursor AI, and other AI assistants directly to your Confluence spaces, pages, and documentation. Get instant answers from your knowledge base, search across all your spaces, and streamline your documentation workflow. - Ask AI about your documentation: "What's our API authentication process?" - Search across all
Add this skill
npx mdskills install aashari/mcp-server-atlassian-confluenceWell-documented MCP server providing comprehensive Confluence API access with token optimization features
1# Connect AI to Your Confluence Knowledge Base23Transform how you access and interact with your team's knowledge by connecting Claude, Cursor AI, and other AI assistants directly to your Confluence spaces, pages, and documentation. Get instant answers from your knowledge base, search across all your spaces, and streamline your documentation workflow.45[](https://www.npmjs.com/package/@aashari/mcp-server-atlassian-confluence)67## What You Can Do89- **Ask AI about your documentation**: "What's our API authentication process?"10- **Search across all spaces**: "Find all pages about security best practices"11- **Get instant answers**: "Show me the latest release notes from the Product space"12- **Access team knowledge**: "What are our HR policies for remote work?"13- **Review page comments**: "Show me the discussion on the architecture document"14- **Create and update content**: "Create a new page in the DEV space"1516## Perfect For1718- **Developers** who need quick access to technical documentation and API guides19- **Product Managers** searching for requirements, specs, and project updates20- **HR Teams** accessing policy documents and employee resources quickly21- **Support Teams** finding troubleshooting guides and knowledge base articles22- **Anyone** who wants to interact with Confluence using natural language2324## Quick Start2526Get up and running in 2 minutes:2728### 1. Get Your Confluence Credentials2930Generate a Confluence API Token:311. Go to [Atlassian API Tokens](https://id.atlassian.com/manage-profile/security/api-tokens)322. Click **Create API token**333. Give it a name like **"AI Assistant"**344. **Copy the generated token** immediately (you won't see it again!)3536### 2. Try It Instantly3738```bash39# Set your credentials40export ATLASSIAN_SITE_NAME="your-company" # for your-company.atlassian.net41export ATLASSIAN_USER_EMAIL="your.email@company.com"42export ATLASSIAN_API_TOKEN="your_api_token"4344# List your Confluence spaces (TOON format by default)45npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces"4647# Get details about a specific space with field filtering48npx -y @aashari/mcp-server-atlassian-confluence get \49 --path "/wiki/api/v2/spaces/123456" \50 --jq "{id: id, key: key, name: name, type: type}"5152# Get a page with JMESPath filtering53npx -y @aashari/mcp-server-atlassian-confluence get \54 --path "/wiki/api/v2/pages/789" \55 --jq "{id: id, title: title, status: status}"5657# Search for pages (using CQL)58npx -y @aashari/mcp-server-atlassian-confluence get \59 --path "/wiki/rest/api/search" \60 --query-params '{"cql": "type=page AND space=DEV"}'61```6263## Connect to AI Assistants6465### For Claude Desktop Users6667Add this to your Claude configuration file (`~/.claude/claude_desktop_config.json`):6869```json70{71 "mcpServers": {72 "confluence": {73 "command": "npx",74 "args": ["-y", "@aashari/mcp-server-atlassian-confluence"],75 "env": {76 "ATLASSIAN_SITE_NAME": "your-company",77 "ATLASSIAN_USER_EMAIL": "your.email@company.com",78 "ATLASSIAN_API_TOKEN": "your_api_token"79 }80 }81 }82}83```8485Restart Claude Desktop, and you'll see the confluence server in the status bar.8687### For Other AI Assistants8889Most AI assistants support MCP (Cursor AI, Continue.dev, and others). Install the server globally:9091```bash92npm install -g @aashari/mcp-server-atlassian-confluence93```9495Then configure your AI assistant to use the MCP server with STDIO transport. The binary is available as `mcp-atlassian-confluence` after global installation.9697### Alternative: Configuration File9899Create `~/.mcp/configs.json` for system-wide configuration:100101```json102{103 "confluence": {104 "environments": {105 "ATLASSIAN_SITE_NAME": "your-company",106 "ATLASSIAN_USER_EMAIL": "your.email@company.com",107 "ATLASSIAN_API_TOKEN": "your_api_token"108 }109 }110}111```112113**Alternative config keys:** The system also accepts `"atlassian-confluence"`, `"@aashari/mcp-server-atlassian-confluence"`, or `"mcp-server-atlassian-confluence"` instead of `"confluence"`.114115### Using Environment Variables116117You can also configure credentials using environment variables or a `.env` file:118119```bash120# Create a .env file in your project directory121cat > .env << EOF122ATLASSIAN_SITE_NAME=your-company123ATLASSIAN_USER_EMAIL=your.email@company.com124ATLASSIAN_API_TOKEN=your_api_token125DEBUG=false126EOF127```128129The server will automatically load these values from:1301. Environment variables1312. `.env` file in the current directory1323. `~/.mcp/configs.json` (as shown above)133134## Available Tools135136This MCP server provides 5 generic tools that can access any Confluence API endpoint:137138| Tool | Description |139|------|-------------|140| `conf_get` | GET any Confluence API endpoint (read data) |141| `conf_post` | POST to any endpoint (create resources) |142| `conf_put` | PUT to any endpoint (replace resources) |143| `conf_patch` | PATCH to any endpoint (partial updates) |144| `conf_delete` | DELETE from any endpoint (remove resources) |145146### Tool Parameters147148All tools share these common parameters:149150- **`path`** (required): The API endpoint path (e.g., `/wiki/api/v2/spaces`)151- **`queryParams`** (optional): Query parameters as key-value pairs (e.g., `{"limit": "25", "space-id": "123"}`)152- **`jq`** (optional): JMESPath expression to filter/transform the response (e.g., `results[*].{id: id, title: title}`)153- **`outputFormat`** (optional): Output format - `"toon"` (default, 30-60% fewer tokens) or `"json"`154155Tools that accept a request body (`conf_post`, `conf_put`, `conf_patch`):156157- **`body`** (required): Request body as a JSON object158159### Common API Paths160161**Spaces:**162- `/wiki/api/v2/spaces` - List all spaces163- `/wiki/api/v2/spaces/{id}` - Get space details164165**Pages:**166- `/wiki/api/v2/pages` - List pages (use `space-id` query param to filter)167- `/wiki/api/v2/pages/{id}` - Get page details168- `/wiki/api/v2/pages/{id}/body` - Get page body (use `body-format` param)169- `/wiki/api/v2/pages/{id}/children` - Get child pages170- `/wiki/api/v2/pages/{id}/labels` - Get page labels171172**Comments:**173- `/wiki/api/v2/pages/{id}/footer-comments` - List/add footer comments174- `/wiki/api/v2/pages/{id}/inline-comments` - List/add inline comments175- `/wiki/api/v2/footer-comments/{comment-id}` - Get/update/delete comment176177**Blog Posts:**178- `/wiki/api/v2/blogposts` - List blog posts179- `/wiki/api/v2/blogposts/{id}` - Get blog post180181**Search:**182- `/wiki/rest/api/search` - Search content (use `cql` query param)183184### TOON Output Format185186**What is TOON?** TOON (Token-Oriented Object Notation) is a format optimized for LLM token efficiency, reducing token costs by 30-60% compared to JSON. It's the default output format for all tools.187188**Benefits:**189- Tabular arrays use fewer tokens than JSON arrays190- Minimal syntax overhead (no quotes, brackets, commas where unnecessary)191- Still human-readable and parseable192193**When to use JSON instead:**194- When you need standard JSON for other tools195- When debugging or manual inspection is needed196197**Example comparison:**198```json199// JSON format (verbose)200{"results": [{"id": "123", "title": "My Page"}, {"id": "456", "title": "Other Page"}]}201202// TOON format (efficient)203results:204 - id: 123205 title: My Page206 - id: 456207 title: Other Page208```209210To use JSON instead of TOON, set `outputFormat: "json"` in your request.211212### JMESPath Filtering213214All tools support optional JMESPath (`jq`) filtering to extract specific data and reduce token costs:215216```bash217# Get just space names and keys218npx -y @aashari/mcp-server-atlassian-confluence get \219 --path "/wiki/api/v2/spaces" \220 --jq "results[].{id: id, key: key, name: name}"221222# Get page title and status223npx -y @aashari/mcp-server-atlassian-confluence get \224 --path "/wiki/api/v2/pages/123456" \225 --jq "{id: id, title: title, status: status}"226```227228**IMPORTANT:** Always use the `jq` parameter to filter responses to only the fields you need. Unfiltered responses can be very large and expensive in token costs.229230**JMESPath Syntax Reference:**231- Official docs: [jmespath.org](https://jmespath.org)232- Common patterns:233 - `results[*]` - All items in results array234 - `results[0]` - First item only235 - `results[*].id` - Just IDs from all items236 - `results[*].{id: id, title: title}` - Create objects with selected fields237 - `results[?status=='current']` - Filter by condition238239## Real-World Examples240241### Explore Your Knowledge Base242243Ask your AI assistant:244- *"List all the spaces in our Confluence"*245- *"Show me details about the Engineering space"*246- *"What pages are in our Product space?"*247- *"Find the latest pages in the Marketing space"*248249### Search and Find Information250251Ask your AI assistant:252- *"Search for pages about API authentication"*253- *"Find all documentation with 'security' in the title"*254- *"Show me pages labeled with 'getting-started'"*255- *"Search for content in the DEV space about deployment"*256257### Access Specific Content258259Ask your AI assistant:260- *"Get the content of the API Authentication Guide page"*261- *"Show me the onboarding checklist document"*262- *"What's in our security policies page?"*263- *"Display the latest release notes"*264265### Create and Update Content266267Ask your AI assistant:268- *"Create a new page in the DEV space titled 'API Guide'"*269- *"Add a comment to the architecture document"*270- *"Update the page content with the new release info"*271272## CLI Commands273274The CLI mirrors the MCP tools for direct terminal access. All commands support the same parameters as the tools.275276### Available Commands277278- `get` - GET any Confluence endpoint279- `post` - POST to any endpoint280- `put` - PUT to any endpoint281- `patch` - PATCH any endpoint282- `delete` - DELETE from any endpoint283284### CLI Parameters285286**All commands:**287- `-p, --path <path>` (required) - API endpoint path288- `-q, --query-params <json>` (optional) - Query parameters as JSON289- `--jq <expression>` (optional) - JMESPath filter expression290- `-o, --output-format <format>` (optional) - Output format: `toon` (default) or `json`291292**Commands with body (post, put, patch):**293- `-b, --body <json>` (required) - Request body as JSON294295### Examples296297```bash298# GET request299npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces"300301# GET with query parameters and JMESPath filter302npx -y @aashari/mcp-server-atlassian-confluence get \303 --path "/wiki/api/v2/pages" \304 --query-params '{"space-id": "123456", "limit": "10"}' \305 --jq "results[*].{id: id, title: title}"306307# GET with JSON output format308npx -y @aashari/mcp-server-atlassian-confluence get \309 --path "/wiki/api/v2/spaces" \310 --output-format json311312# POST request (create a page)313npx -y @aashari/mcp-server-atlassian-confluence post \314 --path "/wiki/api/v2/pages" \315 --body '{"spaceId": "123456", "status": "current", "title": "New Page", "body": {"representation": "storage", "value": "<p>Content here</p>"}}'316317# POST request (add a comment)318npx -y @aashari/mcp-server-atlassian-confluence post \319 --path "/wiki/api/v2/pages/789/footer-comments" \320 --body '{"body": {"representation": "storage", "value": "<p>My comment</p>"}}'321322# PUT request (update page - requires version increment)323npx -y @aashari/mcp-server-atlassian-confluence put \324 --path "/wiki/api/v2/pages/789" \325 --body '{"id": "789", "status": "current", "title": "Updated Title", "spaceId": "123456", "body": {"representation": "storage", "value": "<p>Updated content</p>"}, "version": {"number": 2}}'326327# PATCH request (partial update)328npx -y @aashari/mcp-server-atlassian-confluence patch \329 --path "/wiki/api/v2/spaces/123456" \330 --body '{"name": "New Space Name"}'331332# DELETE request333npx -y @aashari/mcp-server-atlassian-confluence delete \334 --path "/wiki/api/v2/pages/789"335```336337## Response Handling338339### Large Response Truncation340341When API responses exceed approximately 40,000 characters (~10,000 tokens), the server automatically truncates the response to stay within token limits. When this happens:3423431. **You'll see a truncation notice** at the end of the response showing:344 - How much of the original response is shown345 - The original response size346 - Guidance on accessing the full data3473482. **The full raw response is saved** to a temporary file in `/tmp/mcp/` (path provided in the truncation notice)3493503. **Best practices to avoid truncation:**351 - **Always use the `jq` parameter** to filter responses to only needed fields352 - Use `limit` query parameter to restrict result counts (e.g., `{"limit": "5"}`)353 - Request specific resources by ID rather than listing all354 - Use targeted CQL queries for searches355356**Example of efficient filtering:**357```bash358# Instead of getting all space data (can be huge):359npx -y @aashari/mcp-server-atlassian-confluence get \360 --path "/wiki/api/v2/spaces"361362# Get only the fields you need:363npx -y @aashari/mcp-server-atlassian-confluence get \364 --path "/wiki/api/v2/spaces" \365 --query-params '{"limit": "10"}' \366 --jq "results[*].{id: id, key: key, name: name}"367```368369### Debug Logging370371Enable debug logging to see detailed request/response information:372373```bash374# Set DEBUG environment variable375export DEBUG=true376377# For MCP mode378DEBUG=true npx -y @aashari/mcp-server-atlassian-confluence379380# For CLI mode381DEBUG=true npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces"382```383384Debug logs are written to: `~/.mcp/data/@aashari-mcp-server-atlassian-confluence.[session-id].log`385386## Testing & Development387388### Using MCP Inspector389390The MCP Inspector provides a visual interface for testing tools:391392```bash393# Install the server globally394npm install -g @aashari/mcp-server-atlassian-confluence395396# Run with MCP Inspector397npx @modelcontextprotocol/inspector node $(which mcp-atlassian-confluence)398```399400Or use the built-in development command if you've cloned the repository:401402```bash403npm run mcp:inspect404```405406This starts the server in HTTP mode and opens the inspector UI in your browser.407408### HTTP Mode for Testing409410You can run the server in HTTP mode to test with curl or other HTTP clients:411412```bash413# Start server in HTTP mode414TRANSPORT_MODE=http npx -y @aashari/mcp-server-atlassian-confluence415```416417The server will listen on `http://localhost:3000/mcp` by default. You can change the port:418419```bash420PORT=8080 TRANSPORT_MODE=http npx -y @aashari/mcp-server-atlassian-confluence421```422423**Testing with curl:**424425```bash426# Initialize session427curl -X POST http://localhost:3000/mcp \428 -H "Content-Type: application/json" \429 -H "Accept: application/json, text/event-stream" \430 -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "clientInfo": {"name": "curl-test", "version": "1.0.0"}, "capabilities": {}}}'431432# List available tools433curl -X POST http://localhost:3000/mcp \434 -H "Content-Type: application/json" \435 -H "Accept: application/json, text/event-stream" \436 -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}'437438# Call a tool439curl -X POST http://localhost:3000/mcp \440 -H "Content-Type: application/json" \441 -H "Accept: application/json, text/event-stream" \442 -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "conf_get", "arguments": {"path": "/wiki/api/v2/spaces", "queryParams": {"limit": "5"}}}}'443```444445The response comes as Server-Sent Events (SSE) with format:446```447event: message448data: {"jsonrpc": "2.0", "id": 1, "result": {...}}449```450451## Troubleshooting452453### "Authentication failed" or "403 Forbidden"4544551. **Check your API Token permissions**:456 - Go to [Atlassian API Tokens](https://id.atlassian.com/manage-profile/security/api-tokens)457 - Make sure your token is still active and hasn't expired4584592. **Verify your site name format**:460 - If your Confluence URL is `https://mycompany.atlassian.net`461 - Your site name should be just `mycompany`4624633. **Test your credentials**:464 ```bash465 npx -y @aashari/mcp-server-atlassian-confluence get --path "/wiki/api/v2/spaces?limit=1"466 ```467468### "Resource not found" or "404"4694701. **Check the API path**:471 - Paths are case-sensitive472 - Use numeric IDs for spaces and pages (not keys)473 - Verify the resource exists in your browser4744752. **Verify access permissions**:476 - Make sure you have access to the space/page in your browser477 - Some content may be restricted to certain users478479### "No results found" when searching4804811. **Try different search terms**:482 - Use CQL syntax for advanced searches483 - Try broader search criteria4844852. **Check CQL syntax**:486 - Validate your CQL in Confluence's advanced search first487488### Claude Desktop Integration Issues4894901. **Restart Claude Desktop** after updating the config file4912. **Verify config file location**:492 - macOS: `~/.claude/claude_desktop_config.json`493 - Windows: `%APPDATA%\Claude\claude_desktop_config.json`494495### Getting Help496497If you're still having issues:4981. Run a simple test command to verify everything works4992. Check the [GitHub Issues](https://github.com/aashari/mcp-server-atlassian-confluence/issues) for similar problems5003. Create a new issue with your error message and setup details501502## Frequently Asked Questions503504### What permissions do I need?505506Your Atlassian account needs:507- **Access to Confluence** with the appropriate permissions for the spaces you want to query508- **API token** with appropriate permissions (automatically granted when you create one)509510### Can I use this with Confluence Server (on-premise)?511512Currently, this tool only supports **Confluence Cloud**. Confluence Server/Data Center support may be added in future versions.513514### How do I find my site name?515516Your site name is the first part of your Confluence URL:517- URL: `https://mycompany.atlassian.net` -> Site name: `mycompany`518- URL: `https://acme-corp.atlassian.net` -> Site name: `acme-corp`519520### What AI assistants does this work with?521522Any AI assistant that supports the Model Context Protocol (MCP):523- Claude Desktop524- Cursor AI525- Continue.dev526- Many others527528### Is my data secure?529530Yes! This tool:531- Runs entirely on your local machine532- Uses your own Confluence credentials533- Never sends your data to third parties534- Only accesses what you give it permission to access535536### Can I search across all my spaces at once?537538Yes! Use CQL queries for cross-space searches. For example:539```bash540npx -y @aashari/mcp-server-atlassian-confluence get \541 --path "/wiki/rest/api/search" \542 --query-params '{"cql": "type=page AND text~\"API documentation\""}'543```544545## Migration from v2.x546547Version 3.0 replaces 8+ specific tools with 5 generic HTTP method tools. If you're upgrading from v2.x:548549**Before (v2.x):**550```551conf_ls_spaces, conf_get_space, conf_ls_pages, conf_get_page,552conf_search, conf_ls_comments, conf_add_comment, ...553```554555**After (v3.0):**556```557conf_get, conf_post, conf_put, conf_patch, conf_delete558```559560**Migration examples:**561- `conf_ls_spaces` -> `conf_get` with path `/wiki/api/v2/spaces`562- `conf_get_space` -> `conf_get` with path `/wiki/api/v2/spaces/{id}`563- `conf_ls_pages` -> `conf_get` with path `/wiki/api/v2/pages?space-id={id}`564- `conf_get_page` -> `conf_get` with path `/wiki/api/v2/pages/{id}`565- `conf_search` -> `conf_get` with path `/wiki/rest/api/search?cql=...`566- `conf_add_comment` -> `conf_post` with path `/wiki/api/v2/pages/{id}/footer-comments`567568## Technical Details569570### Requirements571572- **Node.js**: 18.0.0 or higher573- **MCP SDK**: 1.23.0 (uses modern `registerTool` API)574- **Confluence**: Cloud only (Server/Data Center not supported)575576### Architecture577578This server follows a 5-layer architecture:5795801. **Tools Layer** (`src/tools/`) - MCP tool definitions with Zod validation5812. **CLI Layer** (`src/cli/`) - Commander-based CLI for direct testing5823. **Controllers Layer** (`src/controllers/`) - Business logic, JMESPath filtering, output formatting5834. **Services Layer** (`src/services/`) - Confluence API communication5845. **Utils Layer** (`src/utils/`) - Shared utilities (logger, config, formatters, TOON encoder)585586### Features587588- **Generic HTTP method tools** - Access any Confluence API endpoint589- **TOON output format** - 30-60% token reduction vs JSON590- **JMESPath filtering** - Extract only needed data591- **Response truncation** - Automatic handling of large responses592- **Raw response logging** - Full responses saved to `/tmp/mcp/`593- **Dual transport** - STDIO (for Claude Desktop) and HTTP (for web integrations)594- **Debug logging** - Comprehensive logging for troubleshooting595596### Version History597598**v3.2.1** (Current)599- Add raw response logging with truncation for large API responses600- Improve dependency compatibility601602**v3.2.0**603- Modernize MCP SDK to v1.23.0 with registerTool API604605**v3.1.0**606- Add TOON output format for token-efficient LLM responses607608**v3.0.0** (Breaking change)609- Replace 8+ domain-specific tools with 5 generic HTTP method tools610- Add JMESPath filtering support611- Full Confluence API access via generic methods612613See [CHANGELOG.md](CHANGELOG.md) for complete version history.614615## Support616617Need help? Here's how to get assistance:6186191. **Check the troubleshooting section above** - most common issues are covered there6202. **Visit our GitHub repository** for documentation and examples: [github.com/aashari/mcp-server-atlassian-confluence](https://github.com/aashari/mcp-server-atlassian-confluence)6213. **Report issues** at [GitHub Issues](https://github.com/aashari/mcp-server-atlassian-confluence/issues)6224. **Start a discussion** for feature requests or general questions623624---625626*Made with care for teams who want to bring AI into their knowledge management workflow.*627
Full transparency — inspect the skill content before installing.