A powerful Model Context Protocol (MCP) server that brings Atlassian Confluence integration directly to any editor or application that supports MCP
Initial content
" # Update an existing page confluence_update_page pageId:"789012" title:"Updated Title" content:"Updated content
" versionNumber:2 # Get child pages for navigation confluence_get_child_pages pageId:"123456" limit:10 ``` ## 📁 Project Structure (v0.3.0 - Optimized Architecture) ``` src/ ├── core/ # Core functionality and configurations │ ├── errors/ # Error handling utilities │ ├── logging/ # Logging infrastructure │ ├── responses/ # Response formatting │ ├── server/ # MCP server setup │ ├── tools/ # Base tool patterns │ └── utils/ # General utilities ├── features/ # Feature implementations │ └── confluence/ # Confluence integration │ ├── client/ # HTTP client infrastructure │ │ ├── config/ # Client configuration │ │ ├── errors/ # Client-specific errors │ │ ├── http/ # HTTP client implementations │ │ │ ├── utils/ # HTTP utilities │ │ │ ├── v1/ # V1 API client (search) │ │ │ └── v2/ # V2 API client (CRUD) │ │ └── responses/ # Response models │ ├── domains/ # Domain-based architecture (NEW) │ │ ├── spaces/ # Space management domain │ │ │ ├── handlers/ # Space operation handlers │ │ │ ├── models/ # Space data models │ │ │ ├── use-cases/ # Space business logic │ │ │ ├── validators/ # Space validation │ │ │ └── formatters/ # Space response formatting │ │ ├── pages/ # Page management domain │ │ │ ├── handlers/ # Page operation handlers │ │ │ ├── models/ # Page data models │ │ │ ├── use-cases/ # Page business logic │ │ │ ├── validators/ # Page validation │ │ │ └── formatters/ # Page response formatting │ │ └── search/ # Search domain │ │ ├── handlers/ # Search operation handlers │ │ ├── models/ # Search data models │ │ ├── use-cases/ # Search business logic │ │ ├── validators/ # Search validation │ │ └── formatters/ # Search response formatting │ ├── shared/ # Shared utilities across domains │ │ ├── formatters/ # Common formatters │ │ └── validators/ # Common validators │ └── tools/ # MCP tool orchestration │ ├── handlers.ts # Unified tool handlers │ ├── mcp.ts # MCP tool definitions │ └── routing.ts # Tool routing logic └── test/ # Test suite (1871 tests) ├── integration/ # Integration tests ├── unit/ # Unit tests (domain-organized) │ ├── core/ # Core functionality tests │ └── features/ # Feature tests (by domain) │ └── confluence/ │ └── domains/ # Domain-specific tests │ ├── spaces/ # Space domain tests │ ├── pages/ # Page domain tests │ └── search/ # Search domain tests └── utils/ # Test utilities ``` ### Architecture Overview The Confluence MCP Server uses a **dual-client architecture** for optimal API version management: - **V1 Client** (`http-client-v1.impl.ts`): Handles search operations and CQL queries - **V2 Client** (`http-client-v2.impl.ts`): Manages CRUD operations for spaces and pages - **Operation Router** (`operation.router.ts`): Intelligently routes requests to the appropriate API version - **Factory Pattern** (`http-client.factory.ts`): Provides clean dependency injection for clients This architecture ensures: - **Optimal Performance**: Each operation uses the most suitable API version - **Future Compatibility**: Easy to add new API versions or deprecate old ones - **Clean Separation**: Clear boundaries between different API capabilities - **Type Safety**: Full TypeScript support across all client implementations ### NPM Scripts | Command | Description | | --------------- | -------------------------------------------------- | | `bun dev` | Run the server in development mode with hot reload | | `bun build` | Build the project for production | | `bun start` | Start the production server | | `bun format` | Format code using Biome | | `bun lint` | Lint code using Biome | | `bun check` | Run Biome checks on code | | `bun typecheck` | Run TypeScript type checking | | `bun test` | Run tests | | `bun inspect` | Start the MCP Inspector for debugging | ## 🔧 Troubleshooting ### NPM Installation Issues #### Package Not Found If you get a "package not found" error: ```bash # Make sure you're using the correct scoped package name bunx @dsazz/mcp-confluence@latest # Or try with explicit npm registry npm install -g @dsazz/mcp-confluence --registry https://registry.npmjs.org ``` #### Environment Variables Not Found If the server fails to start with environment variable errors: 1. **For bunx usage**: Create a `.env` file in your working directory: ```bash # Create .env file in your current directory echo "CONFLUENCE_HOST_URL=https://your-domain.atlassian.net" > .env echo "CONFLUENCE_USER_EMAIL=your-email@example.com" >> .env echo "CONFLUENCE_API_TOKEN=your-api-token" >> .env ``` 2. **For MCP configuration**: Set environment variables in your MCP config: ```json { "mcpServers": { "Confluence Tools": { "command": "bunx", "args": ["-y", "@dsazz/mcp-confluence@latest"], "env": { "CONFLUENCE_HOST_URL": "https://your-domain.atlassian.net", "CONFLUENCE_USER_EMAIL": "your-email@example.com", "CONFLUENCE_API_TOKEN": "your-api-token" } } } } ``` ### API Connection Issues #### Invalid Credentials - Verify your Confluence API token is correct - Ensure your email matches your Atlassian account - Check that your Confluence URL is correct (include https://) #### Network/Firewall Issues - Ensure your network allows connections to your Confluence instance - Check if your organization requires VPN access - Verify firewall settings allow outbound HTTPS connections ### Development Issues #### Build Failures ```bash # Clear dependencies and reinstall rm -rf node_modules bun.lockb bun install # Clean build rm -rf dist bun run build ``` #### TypeScript Errors ```bash # Run type checking bun run typecheck # Check for linting issues bun run check ``` ## 📝 Contributing We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details on: - Development workflow - Branching strategy - Commit message format - Pull request process - Code style guidelines ## 📘 Resources - [Model Context Protocol Documentation](https://modelcontextprotocol.io) - [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk) - [MCP Specification](https://spec.modelcontextprotocol.io/specification/) - [MCP Inspector](https://github.com/modelcontextprotocol/inspector) - [Confluence REST API](https://developer.atlassian.com/cloud/confluence/rest/v2/) ## 📄 License [MIT](LICENSE) © Stanislav Stepanenko ---