This guide covers different ways to start and run the Nextcloud MCP server.
Before running the server:
- Install the server - See Installation Guide
- Configure environment - See Configuration Guide
- Set up authentication - See OAuth Setup or Authentication
Start the server using Docker:
# OAuth mode (recommended)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# BasicAuth mode
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latestThe server will start on http://127.0.0.1:8000 by default.
# OAuth with auto-registration
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# OAuth with custom port
docker run -p 127.0.0.1:8080:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# OAuth with pre-configured client
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
-e NEXTCLOUD_OIDC_CLIENT_ID=abc123 \
-e NEXTCLOUD_OIDC_CLIENT_SECRET=xyz789 \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# OAuth with specific apps only
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--enable-app notes --enable-app calendar# BasicAuth (requires NEXTCLOUD_USERNAME/PASSWORD in .env)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest
# BasicAuth with specific apps
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest \
--enable-app notes --enable-app webdav# Mount volume for persistent OAuth token storage
docker run -p 127.0.0.1:8000:8000 --env-file .env \
-v $(pwd)/data:/app/data \
--rm ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauthCreate docker-compose.yml:
version: '3.8'
services:
mcp:
image: ghcr.io/cbcoutinho/nextcloud-mcp-server:latest
command: --oauth --enable-app notes --enable-app calendar
ports:
- "127.0.0.1:8000:8000"
env_file:
- .env
volumes:
- ./data:/app/data # Persistent token storage
restart: unless-stoppedStart the service:
# Start in foreground
docker-compose up
# Start in background
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the service
docker-compose down# Bind to all interfaces (accessible from network)
docker run -p 0.0.0.0:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# Bind to localhost only (default, more secure)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# Use a different port (map host port 8080 to container port 8000)
docker run -p 127.0.0.1:8080:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauthSecurity Note: Binding to 0.0.0.0 exposes the server to your network. Only use this if you understand the security implications.
The server supports multiple MCP transport protocols:
# Streamable HTTP (default, recommended)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--transport streamable-http
# SSE - Server-Sent Events (deprecated)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--transport sse
# HTTP
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--transport httpWarning
SSE transport is deprecated and will be removed in a future version of the MCP spec. Please migrate to streamable-http.
# Set log level (critical, error, warning, info, debug, trace)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--log-level debug
# Production: use warning or error
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--log-level warningBy default, all supported Nextcloud apps are enabled. You can enable specific apps only:
# Available apps: notes, tables, webdav, calendar, contacts, cookbook, deck
# Enable all apps (default)
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth
# Enable only Notes
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--enable-app notes
# Enable multiple apps
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--enable-app notes --enable-app calendar --enable-app contacts
# Enable only WebDAV for file operations
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--enable-app webdavUse cases:
- Reduce memory usage and startup time
- Limit functionality for security/organizational reasons
- Test specific app integrations
- Run lightweight instances with only needed features
For active development with auto-reload, mount your source code as a volume:
# Development mode with source code mounted
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
-v $(pwd):/app \
-v $(pwd)/data:/app/data \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--log-level debugFor local development without Docker:
# Load environment variables
export $(grep -v '^#' .env | xargs)
# Run the server with auto-reload
uv run nextcloud-mcp-server run --oauth --log-level debugThe nextcloud-mcp-server CLI has two main subcommands:
-
run- Start the MCP server (default command in Docker)uv run nextcloud-mcp-server run --oauth --host 0.0.0.0 --port 8000
-
db- Database migration management (Alembic)# Show current migration revision uv run nextcloud-mcp-server db current # Upgrade to latest migration uv run nextcloud-mcp-server db upgrade # Show migration history uv run nextcloud-mcp-server db history # Create new migration (developers only) uv run nextcloud-mcp-server db migrate "description of changes"
Token storage uses Alembic for schema management:
- Automatic migrations: Database is upgraded automatically on server startup
- Backward compatibility: Pre-Alembic databases are automatically stamped with the initial revision
- Migration files: Located in
alembic/versions/ - For developers: When changing the schema:
- Create a migration:
uv run nextcloud-mcp-server db migrate "add new column" - Edit the generated file in
alembic/versions/to add SQL statements - Test upgrade:
uv run nextcloud-mcp-server db upgrade - Test downgrade:
uv run nextcloud-mcp-server db downgrade
- Create a migration:
See Database Migrations Guide for detailed information.
MCP Inspector is a browser-based tool for testing MCP servers:
- Start your MCP server using Docker (see above)
- Start MCP Inspector:
npx @modelcontextprotocol/inspector
- In the browser:
- Enter server URL:
http://localhost:8000 - Complete OAuth flow (if using OAuth)
- Explore tools and resources
- Enter server URL:
MCP clients (like Claude Desktop, LLM IDEs) can connect to your server:
- Configure the client with your server URL
- Complete OAuth authentication (if enabled)
- Start interacting with Nextcloud through the LLM
# Test if server is responding
curl http://localhost:8000/health
# Expected response: HTTP 200 OKLook for these log messages on startup:
OAuth mode:
INFO OAuth mode detected (NEXTCLOUD_USERNAME/PASSWORD not set)
INFO Configuring MCP server for OAuth mode
INFO OIDC discovery successful
INFO OAuth client ready: <client-id>...
INFO OAuth initialization complete
BasicAuth mode:
INFO BasicAuth mode detected (NEXTCLOUD_USERNAME/PASSWORD set)
INFO Initializing Nextcloud client with BasicAuth
Use Docker Compose with restart: unless-stopped (see Docker Compose section above).
# Docker (find container name first)
docker ps
docker logs -f <container-name>
# Docker Compose
docker-compose logs -f mcpFor production deployments, use Docker Compose with the recommended settings:
version: '3.8'
services:
mcp:
image: ghcr.io/cbcoutinho/nextcloud-mcp-server:latest
command: --oauth --log-level warning --transport streamable-http
ports:
- "127.0.0.1:8000:8000"
env_file:
- .env
volumes:
- ./data:/app/data
restart: unless-stopped
deploy:
resources:
limits:
cpus: '2'
memory: 1G
reservations:
cpus: '0.5'
memory: 512MFor higher load, use Docker Swarm or Kubernetes. See the Helm Chart for Kubernetes deployments.
Check logs for errors:
# View container logs
docker logs <container-name>
# Or run with debug logging
docker run -p 127.0.0.1:8000:8000 --env-file .env --rm \
ghcr.io/cbcoutinho/nextcloud-mcp-server:latest --oauth \
--log-level debugCommon issues:
- Environment variables not loaded - Check your
.envfile - Port already in use - Use a different host port (e.g.,
-p 127.0.0.1:8080:8000) - OAuth configuration errors - See Troubleshooting
- Verify server is running:
curl http://localhost:8000/health - Check firewall settings
- Verify host binding (use
0.0.0.0to allow network access) - Check OAuth authentication if enabled
See Troubleshooting OAuth for detailed OAuth troubleshooting.
- Configuration Guide - Environment variables
- OAuth Setup - OAuth authentication setup
- Troubleshooting - Common issues and solutions
- Installation - Installing the server