Setup
1. Install Keycloak
Choose your deployment method: Docker:2. Create Realm
- Open Keycloak Admin Console (http://localhost:8080)
- Click Add Realm or select existing realm
- Set Realm Name (e.g., “my-realm”)
3. Create Client
- Go to Clients → Create
- Set Client ID:
my-mcp-server - Set Client Protocol:
openid-connect - Click Save
- Access Type:
confidential(for server-side) orpublic(for SPA) - Valid Redirect URIs:
http://localhost:3000/callback,https://yourdomain.com/callback - Web Origins:
http://localhost:3000,https://yourdomain.com - Save and note the Client Secret from Credentials tab
4. Create Users and Roles
Create Realm Roles:- Go to Roles → Add Role
- Create roles:
admin,editor,viewer
- Go to Users → Add User
- Set username, email, enable user
- In Credentials tab, set password
- In Role Mappings tab, assign roles
Configuration
Basic Configuration
Environment Variables
Full Configuration Options
Resources
Next Steps
- User Context - Access user information