confluence-mcp-server

confluence-mcp-server

Integrates Confluence with Claude Desktop, enabling natural language search, content retrieval, and space navigation for Confluence documentation.

Category
访问服务器

README

Confluence MCP Server

A Model Context Protocol (MCP) server that integrates Confluence with Claude Desktop and other AI assistants, enabling natural language interactions with your Confluence documentation.

🚀 Features

  • Search Pages: Find documentation using natural language or CQL queries
  • Content Retrieval: Get full page content with formatting preserved
  • Space Exploration: List and navigate through your Confluence space
  • Page Hierarchy: Explore parent-child relationships between pages
  • Title-based Search: Find pages by exact title matches
  • Real-time Integration: Direct integration with Claude Desktop for seamless AI assistance

📋 Prerequisites

  • Node.js (v18.0.0 or higher)
  • npm (v8.0.0 or higher)
  • Confluence Cloud account with API access
  • Claude Desktop (for AI integration)

🔧 Installation

Option 1: Global Installation (Recommended)

# Clone the repository
git clone https://github.com/alirezarezvani/confluence-mcp-server.git
cd confluence-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Install globally for easy access
npm run install-global

Option 2: Local Installation

# Clone the repository
git clone https://github.com/alirezarezvani/confluence-mcp-server.git
cd confluence-mcp-server

# Install dependencies and build
npm install
npm run build

⚙️ Configuration

1. Get Confluence API Credentials

  1. API Token:

  2. Space Key:

    • Navigate to your Confluence space
    • Check the URL: https://your-org.atlassian.net/wiki/spaces/SPACEKEY/
    • The SPACEKEY is what you need
  3. Base URL:

    • Usually https://your-org.atlassian.net (without /wiki)

2. Environment Setup

Create a .env file in the project root:

CONFLUENCE_BASE_URL=https://your-org.atlassian.net
CONFLUENCE_EMAIL=your-email@company.com
CONFLUENCE_API_TOKEN=your-api-token-here
CONFLUENCE_SPACE_KEY=YOUR_SPACE_KEY

3. Validate Configuration

# Test your environment variables
npm run validate-env

# Test the server connection
npm start

🤖 Claude Desktop Integration

Configuration File Location

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

Configuration Options

Option 1: Global Installation

{
  "mcpServers": {
    "confluence": {
      "command": "confluence-mcp",
      "env": {
        "CONFLUENCE_BASE_URL": "https://your-org.atlassian.net",
        "CONFLUENCE_EMAIL": "your-email@company.com",
        "CONFLUENCE_API_TOKEN": "your-api-token",
        "CONFLUENCE_SPACE_KEY": "YOUR_SPACE_KEY"
      }
    }
  }
}

Option 2: Local Installation

{
  "mcpServers": {
    "confluence": {
      "command": "node",
      "args": ["/full/path/to/confluence-mcp-server/dist/confluence-mcp-server.js"],
      "env": {
        "CONFLUENCE_BASE_URL": "https://your-org.atlassian.net",
        "CONFLUENCE_EMAIL": "your-email@company.com",
        "CONFLUENCE_API_TOKEN": "your-api-token",
        "CONFLUENCE_SPACE_KEY": "YOUR_SPACE_KEY"
      }
    }
  }
}

Activation

  1. Save the configuration file
  2. Restart Claude Desktop completely (Cmd+Q then reopen)
  3. Look for MCP tools in the Claude Desktop interface

🛠️ Available Tools

1. search_confluence_pages

Search for pages using text queries or CQL.

Usage Examples:

  • "Search for 'API documentation' in Confluence"
  • "Find pages about React development"
  • "Look for troubleshooting guides"

2. get_page_content

Retrieve full content of a specific page.

Usage Examples:

  • "Get the content of page ID 12345"
  • "Show me what's in the 'Setup Guide' page"

3. list_space_pages

List all pages in your Confluence space.

Usage Examples:

  • "List all pages in our Confluence space"
  • "Show me the 25 most recent pages"

4. get_page_hierarchy

Explore parent-child page relationships.

Usage Examples:

  • "Show me all child pages under 'Documentation'"
  • "What are the sub-pages of the architecture section?"

5. get_page_by_title

Find pages by exact title match.

Usage Examples:

  • "Find the page titled 'Development Workflow'"
  • "Get the 'Onboarding Checklist' page"

💬 Usage Examples

Team Collaboration

"Help me find our deployment process documentation"
"What's the latest information about our API endpoints?"
"Show me all pages related to the mobile app project"
"Get me the content from our coding standards page"

Project Management

"Find all documentation related to the new feature"
"What's our current architecture documentation saying about microservices?"
"Show me the troubleshooting guides for production issues"
"List all pages updated in the last month"

Development Workflow

"Search for Docker configuration examples"
"Find our Git workflow documentation"
"What's in our testing guidelines page?"
"Show me the API integration examples"

🔧 Development

Scripts

# Development with auto-reload
npm run dev

# Build TypeScript to JavaScript
npm run build

# Run the built server
npm start

# Watch for changes and auto-restart
npm run watch

# Clean build directory
npm run clean

# Validate environment variables
npm run validate-env

# Run tests
npm test

# Run specific test file
npm test -- tests/path/to/test.ts

Project Structure

confluence-mcp-server/
├── src/
│   ├── confluence-mcp-server.ts  # Main server implementation
│   ├── cache/                    # Caching implementation
│   │   ├── CacheManager.ts       # Generic cache management
│   │   └── ConfluenceCache.ts    # Confluence-specific caching
│   └── monitoring/               # Performance monitoring
│       └── PerformanceMonitor.ts # Performance tracking and metrics
├── tests/
│   ├── confluence-mcp-server.test.ts  # Main server tests
│   ├── integration/              # Integration tests
│   │   └── mcp-tools.test.ts     # MCP tools integration tests
│   ├── cache/                    # Cache tests
│   │   └── CacheManager.test.ts  # Cache manager tests
│   ├── monitoring/               # Monitoring tests
│   │   └── PerformanceMonitor.test.ts # Performance monitor tests
│   └── utils/                    # Test utilities
│       └── test-utils.ts         # Mock implementations and helpers
├── dist/                         # Compiled JavaScript (after build)
├── package.json                  # Project dependencies and scripts
├── tsconfig.json                 # TypeScript configuration
├── jest.config.js                # Jest test configuration
├── .env                          # Environment variables (create this)
├── .env.test                     # Test environment variables
├── .gitignore                    # Git ignore rules
└── README.md                     # This file

🧪 Testing

The project includes a comprehensive test suite using Jest. Tests cover both unit and integration testing of the MCP server functionality.

Running Tests

# Run all tests
npm test

# Run specific test file
npm test -- tests/cache/CacheManager.test.ts

# Run tests with coverage report
npm test -- --coverage

Test Structure

  • Unit Tests: Test individual components in isolation
  • Integration Tests: Test the MCP tools and their interaction with the Confluence API
  • Mock Tests: Use mock implementations to simulate Confluence API responses

Test Environment

Tests use a separate .env.test file for environment variables. The test environment is automatically set up when running tests.

Recent Improvements

  • Fixed path issues in test imports
  • Improved CacheManager implementation with better edge case handling
  • Enhanced PerformanceMonitor with more accurate metrics
  • Added proper test data preparation for consistent test results
  • Updated Jest configuration for ES modules support

🚨 Troubleshooting

Common Issues

"Permission denied" error

chmod +x dist/confluence-mcp-server.js

"Missing environment variables"

npm run validate-env

"Cannot connect to Confluence"

  1. Verify your API token has proper permissions
  2. Check your base URL format (no trailing slash)
  3. Ensure your email and space key are correct

"Claude Desktop not recognizing MCP server"

  1. Check the configuration file path
  2. Verify JSON syntax in the config file
  3. Restart Claude Desktop completely
  4. Check Claude Desktop logs for errors

Debug Mode

# Run with detailed logging
LOG_LEVEL=debug npm start

🔒 Security Considerations

  • API Token: Never commit your API token to version control
  • Environment Variables: Use .env files and keep them secure
  • Permissions: Ensure your API token has minimal required permissions
  • Network: Consider using VPN for sensitive corporate documentation

🤝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Support

🗺️ Roadmap Q2/Q3 2025

  • [ ] Support for multiple Confluence spaces
  • [ ] Page creation and editing capabilities
  • [ ] Comment and attachment handling
  • [ ] OAuth 2.0 authentication
  • [x] Caching for improved performance
  • [ ] Docker containerization
  • [ ] Confluence Server (on-premise) support
  • [x] Comprehensive test suite

Made with ❤️ by Alireza Rezvani

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选