Skip to main content

No project description provided

Project description

Confluence MCP Tool

A Python-based tool for retrieving and processing Confluence page content via the Atlassian API. Provides both REST API and Model Context Protocol (MCP) interfaces for seamless integration with Claude and other AI systems.

Features

  • Page Content Retrieval: Fetch complete Confluence page content using URLs
  • Advanced Search: Search Confluence using CQL (Confluence Query Language) with support for:
    • Simple text queries with automatic fallback
    • Complex CQL expressions for precise filtering
    • Space-based filtering
    • Personal space search support
  • PlantUML Extraction: Extract and decode PlantUML diagrams from Confluence macros, including:
    • Automatic filename detection
    • Support for compressed PlantUML data
    • URL-encoded content handling
  • Related Page Discovery: Parse and extract related page references with support for:
    • Full Confluence URLs
    • Shortened Confluence URLs (x/ format)
  • Dual Interface Support:
    • REST API endpoints for HTTP-based integration
    • MCP server for Claude desktop integration
  • Type Safety: Pydantic models for robust data handling and validation

Prerequisites

  • Python 3.11 or higher
  • Poetry for dependency management
  • Confluence API access credentials
  • pipx for package installation

Deployment Options

This project provides two distinct service interfaces:

  1. MCP Server - For Claude desktop integration
  2. FastAPI Server - For REST API access

1. MCP Server

The MCP server provides tools for Claude desktop to interact with Confluence content.

Quick Start with Docker (Recommended)

docker build -t confluence-mcp .

Claude Desktop Configuration

Add the following to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
    "mcpServers": {
        "confluence_mcp": {
            "command": "docker",
            "args": [
                "run",
                "--name", "confluence-mcp",
                "--interactive",
                "-e", "ATLASSIAN_USERNAME",
                "-e", "ATLASSIAN_API_KEY",
                "-e", "CONFLUENCE_URL",
                "confluence-mcp:latest"
            ],
            "env": {
                "ATLASSIAN_USERNAME": "<your-username>",
                "ATLASSIAN_API_KEY": "<your-api-key>",
                "CONFLUENCE_URL": "<your-confluence-base-url>"
            }
        }
    }
}

Local Development Setup

If you want to run the service directly on your machine:

  1. Install Python 3.11 or higher

  2. Install Poetry for dependency management

  3. Install pipx

    brew install pipx && pipx ensurepath
    
  4. Install dependencies:

    poetry install
    
  5. Build for distribution:

    poetry build
    pipx install dist/*.whl --force
    

Configuration for Local Installation

Update your Claude Desktop configuration to use the locally installed binary:

{
    "mcpServers": {
        "confluence_mcp": {
            "command": "<path-to-confluence-mcp>",
            "env": {
                "ATLASSIAN_USERNAME": "<your-username>",
                "ATLASSIAN_API_KEY": "<your-api-key>",
                "CONFLUENCE_URL": "<your-confluence-base-url>"
            }
        }
    }
}

Configuration Parameters

Replace the following placeholders with your actual values:

  • command: Execute which confluence-mcp and use the returned path
  • ATLASSIAN_USERNAME: Your Atlassian username (usually your email)
  • ATLASSIAN_API_KEY: Your Atlassian API token
  • CONFLUENCE_URL: Your Confluence base URL (e.g., https://your-company.atlassian.net/wiki)

2. FastAPI Server

The FastAPI server provides REST API endpoints for HTTP-based integration.

Environment Configuration

Create a .env file in the root directory with your credentials:

ATLASSIAN_USERNAME=your-email@company.com
ATLASSIAN_API_KEY=your-api-token
CONFLUENCE_URL=https://your-company.atlassian.net/wiki

Quick Start with Docker Compose (Recommended)

docker compose -f docker-compose.api.yml up --build

The service will be available at http://localhost:8000

Local Development Setup

For local development:

  1. Install Dependencies:

    poetry install
    
  2. Build and Install:

    poetry build
    pipx install dist/*.whl --force
    
  3. Start the Service:

    poetry run confluence-tool
    # or after installation:
    confluence-tool
    

The service will be available at http://localhost:8000 with interactive API documentation at /docs.

API Reference

Available Endpoints

1. Retrieve Page Content

POST /tool/confluence_reader/run

Fetch complete content from a Confluence page.

Request:

{
    "input": "https://your-company.atlassian.net/wiki/spaces/DEV/pages/123456789/Page+Title",
    "args": {}
}

Response:

{
    "output": {
        "title": "Page Title",
        "content": "HTML content of the page",
        "plant_uml": {
            "filename": "diagram.puml",
            "plant_uml": "@startuml\n...\n@enduml"
        },
        "related_pages_page_ids": ["123456", "789012"]
    }
}

2. Search Content

POST /tool/confluence_reader/search

Search Confluence using CQL (Confluence Query Language).

Request:

{
    "cql": "type=page AND space=DEV AND title~'documentation'",
    "base_url": "https://your-company.atlassian.net/wiki",
    "space_key": "DEV",
    "args": {
        "limit": 10
    }
}

Response:

{
    "output": [
        {
            "id": "123456789",
            "title": "API Documentation",
            "space_key": "DEV",
            "url": "https://your-company.atlassian.net/wiki/spaces/DEV/pages/123456789",
            "excerpt": "Search result excerpt..."
        }
    ]
}

MCP Tools Reference

When using with Claude Desktop, the following tools are available:

get_confluence_content

Retrieve complete page content including PlantUML diagrams and related page references.

confluence_search

Search Confluence content with support for:

  • Simple queries: "project documentation" (automatically converted to CQL)
  • Advanced CQL: "type=page AND space=DEV AND lastModified > startOfMonth()"
  • Personal spaces: "space=\"~username\""
  • Complex filters: "text~'urgent' AND label='review-required'"

Development

Code Quality Commands

# Format code
poetry run black .

# Sort imports
poetry run isort .

# Lint code
poetry run flake8

Architecture

  • Core Logic: src/confluence/main.py - Page retrieval and processing
  • Search Engine: src/confluence/search.py - CQL-based search functionality
  • API Services: src/service/ - FastAPI and MCP server implementations
  • Data Models: src/confluence/models/ - Pydantic models for type safety
  • Utilities: src/confluence/utility/ - URL parsing, PlantUML extraction

Contributing

See CONTRIBUTING.md for contribution guidelines.

Authors

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

confluence_mcp_tool-0.3.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

confluence_mcp_tool-0.3.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file confluence_mcp_tool-0.3.0.tar.gz.

File metadata

  • Download URL: confluence_mcp_tool-0.3.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.4 Darwin/24.6.0

File hashes

Hashes for confluence_mcp_tool-0.3.0.tar.gz
Algorithm Hash digest
SHA256 8b14c693b4e8dd7291e547924442d9950e18d054167b2001fad1b70f8d9a23bf
MD5 cafaa1e5914095e122985356b5fd1312
BLAKE2b-256 db19353eb1af5f027e0fa7948670b0c08bffe1b4360b874f8fda3103e390eee1

See more details on using hashes here.

File details

Details for the file confluence_mcp_tool-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for confluence_mcp_tool-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f507abf826d3a9a72514f0a832a8e710b239934989d046722c4d6d8e4c5cd628
MD5 be3b0d1826967eb1c444dde39fbebb4b
BLAKE2b-256 8dab89134614b447ba5860aae6e936dc43dd2de0505aacd4c72887cd687f5c56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page