dokuwiki-mcp

Odoo-by-Endare/dokuwiki-mcp

3.2

If you are the rightful owner of dokuwiki-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

A Docker-based solution that provides AI assistants with authenticated access to DokuWiki documentation via the Model Context Protocol (MCP).

Tools
5
Resources
0
Prompts
0

DokuWiki MCP Server

A Docker-based solution that provides AI assistants with authenticated access to DokuWiki documentation via the Model Context Protocol (MCP).

Architecture: Claude Code → DokuWiki (with native MCP plugin) → DokuWiki XML-RPC API

Features

  • Native MCP Integration: Uses DokuWiki's official MCP plugin - no Python middleware needed
  • Bearer Token Authentication: Secure token-based authentication
  • HTTPS Ready: Supports both local development (self-signed) and production (Lightsail automatic HTTPS)
  • 30+ MCP Tools: Full access to DokuWiki's Remote API
  • Single Container: Simple, lightweight deployment

Quick Start

Local Development

  1. Start the stack:
docker-compose up -d
  1. Access DokuWiki: http://localhost:8080

    • Username: admin
    • Password: change_this_password (set in docker-compose.yml)
  2. Generate Bearer Token:

    • Login to DokuWiki
    • Go to your profile
    • Copy the auto-generated Bearer token
  3. Connect Claude Code:

claude mcp add --transport http dokuwiki http://localhost:8080/lib/plugins/mcp/mcp.php \
  --header "Authorization: Bearer YOUR_TOKEN_HERE"

Production Deployment (AWS Lightsail)

  1. Configure credentials:
cp .env.production.example .env.production
# Edit .env.production with your values
  1. Update Docker Hub username in deploy-lightsail.sh

  2. Deploy:

./deploy-lightsail.sh
  1. Generate Bearer Token from your production DokuWiki instance

  2. Connect Claude Code:

claude mcp add --transport http dokuwiki https://your-domain.amazonlightsail.com/lib/plugins/mcp/mcp.php \
  --header "Authorization: Bearer YOUR_TOKEN_HERE"

MCP Tools Available

The native plugin exposes 30+ tools including:

Page Operations:

  • core_getPage - Read wiki page content
  • core_savePage - Save/update pages
  • core_appendPage - Append to pages
  • core_getPageHTML - Get rendered HTML
  • core_getPageInfo - Get page metadata
  • core_getPageHistory - Get revision history

Search & Discovery:

  • core_listPages - List all pages
  • core_searchPages - Full-text search
  • core_getPageBackLinks - Find backlinks
  • core_getPageLinks - Get page links

Media Files:

  • core_getMedia - Download files
  • core_saveMedia - Upload files
  • core_listMedia - List media files
  • core_deleteMedia - Delete files

Other:

  • core_getRecentPageChanges - Recent changes
  • core_lockPages / core_unlockPages - Page locking

Architecture

Single Container Setup

┌─────────────────────────────────────┐
│         Docker Container            │
│                                     │
│  ┌──────────────────────────────┐  │
│  │        DokuWiki              │  │
│  │  ┌────────────────────────┐  │  │
│  │  │  Native MCP Plugin     │  │  │
│  │  │  (PHP)                 │  │  │
│  │  └────────────────────────┘  │  │
│  │         │                     │  │
│  │         │                     │  │
│  │  ┌──────▼──────────────────┐ │  │
│  │  │   XML-RPC API           │ │  │
│  │  └─────────────────────────┘ │  │
│  └──────────────────────────────┘  │
│                                     │
│          Apache (HTTP/HTTPS)        │
└─────────────────────────────────────┘
            │
            │ Bearer Token Auth
            ▼
    Claude Code MCP Client

Why This Approach?

The previous implementation used a Python MCP server as middleware between Claude and DokuWiki's XML-RPC API. This new approach:

  • Simpler: Single container vs 3 containers (DokuWiki + Python MCP + Nginx)
  • Native: Uses official DokuWiki MCP plugin
  • Lightweight: No Python dependencies
  • Maintainable: Follows DokuWiki's official patterns
  • Secure: Bearer token authentication built into DokuWiki

Configuration

Environment Variables

docker-compose.yml (local development):

environment:
  - DOKUWIKI_USERNAME=admin
  - DOKUWIKI_PASSWORD=change_this_password
  - DOKUWIKI_EMAIL=admin@localhost

.env.production (AWS Lightsail):

# DokuWiki Admin Credentials
DOKUWIKI_USERNAME=admin
DOKUWIKI_PASSWORD=your-secure-password
DOKUWIKI_EMAIL=admin@example.com

DokuWiki Configuration

The init.sh script automatically configures:

$conf['remote'] = 1;                // Enable Remote API
$conf['remoteuser'] = '@admin';     // Allow admin group
$conf['useacl'] = 1;                // Enable ACL
$conf['superuser'] = '@admin';      // Admin group permissions

Development

Local Testing

# Start services
docker-compose up -d

# View logs
docker-compose logs -f

# Restart after changes
docker-compose up -d --build

# Stop services
docker-compose down

Testing MCP Tools

# Test without authentication (should fail)
curl -X POST http://localhost:8080/lib/plugins/mcp/mcp.php \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"core_listPages","arguments":{}},"id":1}'

# Test with Bearer token
curl -X POST http://localhost:8080/lib/plugins/mcp/mcp.php \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"core_listPages","arguments":{}},"id":1}'

Deployment

AWS Lightsail Requirements

  • AWS CLI configured
  • Docker Hub account
  • Lightsail container service (created automatically by script)

Deployment Process

The deploy-lightsail.sh script:

  1. Builds Docker image
  2. Pushes to Docker Hub
  3. Creates/updates Lightsail deployment
  4. Waits for deployment to complete
  5. Tests the endpoint

Cost: ~$10/month (Lightsail small container)

Security

Bearer Tokens

  • Generated automatically in DokuWiki user profile
  • JWT format with HMAC-SHA256 signature
  • Stored in DokuWiki's data/meta/jwt/ directory
  • No expiration by default (can be configured)

HTTPS

  • Local: Self-signed certificates for development
  • Production: Lightsail provides automatic HTTPS with managed certificates

Best Practices

  1. Use strong admin password in .env.production
  2. Keep .env.production out of git (in .gitignore)
  3. Rotate Bearer tokens periodically
  4. Use HTTPS in production (automatic with Lightsail)
  5. Restrict remote API access via DokuWiki ACL

Troubleshooting

Local Development

MCP connection fails:

  • Check Docker containers are running: docker-compose ps
  • Verify token is valid: login to DokuWiki and regenerate
  • Check logs: docker-compose logs -f

Certificate errors:

  • For local HTTPS, add certificate to system trust store:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain /tmp/dokuwiki.crt
  • Or use HTTP endpoint for local testing

Production

401 Unauthorized:

  • Regenerate Bearer token from DokuWiki profile
  • Verify token is correctly configured in Claude Code

Deployment fails:

  • Check AWS CLI credentials: aws sts get-caller-identity
  • Verify Docker Hub login: docker login
  • Check Lightsail service status: aws lightsail get-container-services --service-name dokuwiki-mcp --region eu-central-1

View logs:

aws lightsail get-container-log --service-name dokuwiki-mcp --container-name dokuwiki --region eu-central-1

Documentation

License

This project uses:

  • DokuWiki: GPL v2
  • DokuWiki MCP Plugin: GPL v2

Contributing

Issues and pull requests welcome!