Skip to content
This repository was archived by the owner on Mar 19, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Version control
.git
.gitignore

# Dependencies
node_modules

# Development files
.vscode
.idea
*.log
logs
*.md
!README.md

# Test files
__tests__
__fixtures__
__helpers__
*.test.*
jest.config.*
jest.setup.*

# Configuration
config/*

# Documentation
docs
cline_docs

# Build artifacts
build
49 changes: 49 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2022,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"import"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"rules": {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
"import/order": [
"warn",
{
"groups": ["builtin", "external", "internal", ["parent", "sibling"], "index"],
"newlines-between": "always",
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
],
"import/no-unresolved": "off",
"no-console": ["warn", { "allow": ["error", "warn", "info"] }],
"no-case-declarations": "warn"
},
"env": {
"node": true,
"es6": true
},
"ignorePatterns": ["build", "node_modules", "*.js"],
"settings": {
"import/resolver": {
"node": {
"extensions": [".ts", ".js"]
}
}
}
}
102 changes: 102 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, ci-improvements ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Update npm
run: npm install -g npm@11.1.0

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Run tests
run: npm test
env:
CONFLUENCE_API_TOKEN: ${{ secrets.TEST_CONFLUENCE_API_TOKEN }}
CONFLUENCE_EMAIL: ${{ secrets.TEST_CONFLUENCE_EMAIL }}
CONFLUENCE_HOST: ${{ secrets.TEST_CONFLUENCE_HOST }}

- name: Build
run: npm run build

build-container:
name: Build and Push Container
needs: build-and-test
runs-on: ubuntu-latest
# Only run on main branch or tags
if: github.event_name != 'pull_request'

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,format=long
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
build-args: |
DOCKER_HASH=${{ github.sha }}

- name: Cleanup old packages
uses: actions/delete-package-versions@v4
with:
package-name: 'confluence-cloud-mcp'
package-type: container
min-versions-to-keep: 10
delete-only-untagged-versions: true
token: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Build stage
FROM node:20-slim AS builder
WORKDIR /app

# Add metadata
LABEL org.opencontainers.image.source="https://github.com/aaronsb/confluence-cloud-mcp"
LABEL org.opencontainers.image.description="Confluence Cloud MCP Server"
LABEL org.opencontainers.image.licenses="MIT"

# Copy source files
COPY . .

# Install dependencies and build
RUN npm ci && \
npm cache clean --force && \
npm run build

# Production stage
FROM node:20-slim
WORKDIR /app

# Set docker hash as environment variable
ARG DOCKER_HASH=unknown
ENV DOCKER_HASH=$DOCKER_HASH

# Create necessary directories with proper permissions
RUN mkdir -p /app/logs /app/config && \
chown -R 1000:1000 /app && \
chmod 750 /app/logs /app/config

# Copy only necessary files from builder
COPY --from=builder /app/build ./build
COPY --from=builder /app/package*.json ./
COPY --from=builder /app/docker-entrypoint.sh ./

# Install production dependencies only
RUN npm ci --only=production --ignore-scripts && \
npm cache clean --force && \
chmod +x build/index.js && \
chmod +x docker-entrypoint.sh

# Switch to host user's UID
USER 1000

ENTRYPOINT ["./docker-entrypoint.sh"]
94 changes: 77 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Confluence MCP Server
# Confluence Cloud MCP Server

A Model Context Protocol (MCP) server that provides tools for interacting with Confluence Cloud. This server enables AI assistants to manage Confluence spaces, pages, and content through a standardized interface.

[![CI/CD Pipeline](https://github.com/aaronsb/confluence-cloud-mcp/actions/workflows/ci-cd.yml/badge.svg)](https://github.com/aaronsb/confluence-cloud-mcp/actions/workflows/ci-cd.yml)

## Features

- Space Management
Expand All @@ -17,6 +19,37 @@ A Model Context Protocol (MCP) server that provides tools for interacting with C

## Setup

### Option 1: Using Docker (Recommended)

The easiest way to use this server is with the pre-built Docker image:

```bash
docker run --rm -i \
-e CONFLUENCE_API_TOKEN=your-api-token \
-e CONFLUENCE_EMAIL=your-email@domain.com \
-e CONFLUENCE_HOST=your-domain.atlassian.net \
ghcr.io/aaronsb/confluence-cloud-mcp:latest
```

### Option 2: Building Locally

1. Clone the repository:
```bash
git clone https://github.com/aaronsb/confluence-cloud-mcp.git
cd confluence-cloud-mcp
```

2. Build and run using the local build script:
```bash
# Build the Docker image
./scripts/build-local.sh

# Run the server
CONFLUENCE_API_TOKEN=your-token CONFLUENCE_EMAIL=your-email ./scripts/run-local.sh
```

### Option 3: From Source

1. Install dependencies:
```bash
npm install
Expand All @@ -26,7 +59,7 @@ npm install
Create a `.env` file with your Confluence credentials:
```
CONFLUENCE_HOST=your-domain.atlassian.net
CONFLUENCE_USERNAME=your-email@domain.com
CONFLUENCE_EMAIL=your-email@domain.com
CONFLUENCE_API_TOKEN=your-api-token
```

Expand All @@ -35,6 +68,11 @@ CONFLUENCE_API_TOKEN=your-api-token
npm run build
```

4. Run the server:
```bash
node build/index.js
```

## Usage

The server can be integrated with MCP-compatible AI assistants by adding it to their MCP configuration:
Expand All @@ -43,31 +81,35 @@ The server can be integrated with MCP-compatible AI assistants by adding it to t
{
"mcpServers": {
"confluence": {
"command": "node",
"args": ["path/to/build/index.js"],
"command": "docker",
"args": ["run", "--rm", "-i", "ghcr.io/aaronsb/confluence-cloud-mcp:latest"],
"env": {
"CONFLUENCE_HOST": "your-domain.atlassian.net",
"CONFLUENCE_USERNAME": "your-email@domain.com",
"CONFLUENCE_EMAIL": "your-email@domain.com",
"CONFLUENCE_API_TOKEN": "your-api-token"
}
},
"disabled": false,
"autoApprove": []
}
}
}
```

> **Note for AI Assistants**: If you're an AI assistant like Cline trying to install this MCP server, please refer to the [llms-install.md](llms-install.md) file for detailed installation instructions.

## Available Tools

### Space Tools
- `list_spaces`: List all spaces in Confluence
- `get_space`: Get details about a specific space
- `list_confluence_spaces`: List all spaces in Confluence
- `get_confluence_space`: Get details about a specific space

### Page Tools
- `list_pages`: List pages in a space
- `get_page`: Get a specific page with its content (now includes Markdown conversion)
- `create_page`: Create a new page in a space
- `update_page`: Update an existing page
- `list_confluence_pages`: List pages in a space
- `get_confluence_page`: Get a specific page with its content (now includes Markdown conversion)
- `create_confluence_page`: Create a new page in a space
- `update_confluence_page`: Update an existing page

The `get_page` tool now automatically converts Confluence storage format content to Markdown, making it easier to work with page content. The conversion handles:
The `get_confluence_page` tool now automatically converts Confluence storage format content to Markdown, making it easier to work with page content. The conversion handles:
- Headers (h1-h6)
- Lists (ordered and unordered)
- Links
Expand All @@ -77,10 +119,12 @@ The `get_page` tool now automatically converts Confluence storage format content
- Paragraphs and line breaks

### Search & Label Tools
- `search_content`: Search Confluence content using CQL
- `get_labels`: Get labels for a page
- `add_label`: Add a label to a page
- `remove_label`: Remove a label from a page
- `search_confluence_pages`: Search Confluence content using CQL
- `get_confluence_labels`: Get labels for a page
- `add_confluence_label`: Add a label to a page
- `remove_confluence_label`: Remove a label from a page

> **Note**: All tool names follow the [verb]_confluence_[noun] naming convention for consistency and clarity.

## Development

Expand All @@ -92,6 +136,22 @@ This project is written in TypeScript and follows the MCP SDK conventions for im
- `src/types/` - TypeScript type definitions
- `src/utils/` - Utility functions including content format conversion

### CI/CD Pipeline

This project uses GitHub Actions for continuous integration and deployment:

- Automated testing and linting on pull requests
- Automatic Docker image builds on main branch commits
- Multi-architecture image builds (amd64, arm64)
- Container publishing to GitHub Container Registry

### Local Development

For local development, use the provided scripts:

- `./scripts/build-local.sh`: Builds the project and creates a local Docker image
- `./scripts/run-local.sh`: Runs the local Docker image with your credentials

## License

MIT
Loading