Get up and running with OAuth authentication in 5 minutes.
Before you begin, ensure you have:
- Nextcloud instance with administrator access
- Nextcloud version 28 or later
- Python 3.11+ installed
-
uvpackage manager installed (installation instructions)
Install both required apps in your Nextcloud instance:
- Open Nextcloud as administrator
- Navigate to Apps → Security
- Install:
- OIDC (OIDC Identity Provider app)
- OpenID Connect user backend (user_oidc app)
- Enable both apps
Important
The user_oidc app requires an upstream patch for Bearer token support. See Upstream Status for details. The functionality works, but the PR is pending.
Enable dynamic client registration and Bearer token validation:
- Go to Settings → OIDC (Administration settings)
- Enable "Allow dynamic client registration"
SSH into your Nextcloud server and run:
# Enable Bearer token validation
php occ config:system:set user_oidc oidc_provider_bearer_validation --value=true --type=booleanClone and install the MCP server:
# Clone repository
git clone https://github.com/cbcoutinho/nextcloud-mcp-server.git
cd nextcloud-mcp-server
# Install dependencies
uv syncCreate a .env file with minimal configuration:
# Copy sample
cp env.sample .env
# Edit .env and set:
NEXTCLOUD_HOST=https://your.nextcloud.instance.com
# IMPORTANT: Leave these EMPTY for OAuth mode
NEXTCLOUD_USERNAME=
NEXTCLOUD_PASSWORD=Load environment variables and start the server:
# Load environment
export $(grep -v '^#' .env | xargs)
# Start server with OAuth
uv run nextcloud-mcp-server --oauthLook for this success message:
✓ PKCE support validated: ['S256']
INFO OAuth initialization complete
INFO MCP server ready at http://127.0.0.1:8000
Open a new terminal and test the connection:
# Start MCP Inspector
uv run mcp devThis opens your browser. In the MCP Inspector UI:
- Enter server URL:
http://127.0.0.1:8000/mcp - Click Connect
- Complete the OAuth flow in the browser popup
- After authorization, you'll see available tools and resources
Test a tool by trying:
- Tool:
nc_notes_create_note - Title: "Test Note"
- Content: "Hello from MCP!"
- Category: "Notes"
If you see:
ERROR: OIDC CONFIGURATION ERROR - Missing PKCE Support Advertisement
Fix: The Nextcloud OIDC app needs to be updated to advertise PKCE support. See Upstream Status for the required PR.
If OAuth works but Notes API returns 401:
Fix: The user_oidc app needs the Bearer token patch. See Upstream Status for details.
Fix: Verify your Nextcloud URL is correct and accessible:
curl https://your.nextcloud.instance.com/.well-known/openid-configuration- OAuth Setup Guide - Detailed configuration options
- OAuth Architecture - How it works under the hood
- OAuth Troubleshooting - Common issues and solutions
- Configuration - All environment variables
This quick start uses automatic client registration which is perfect for:
- Development
- Testing
- Quick deployments
For production deployments, consider:
- Pre-registering OAuth client manually
- Using dedicated client credentials that don't expire
- See OAuth Setup Guide for production configuration
Need help? Check OAuth Troubleshooting or open an issue.