This directory contains helper scripts for managing the Keycloak MCP Server.
get-mcp-token.shHelper script for obtaining JWT tokens from Keycloak and generating Cursor MCP configuration.
Features:
Prerequisites:
curl command installedjq command installed (JSON processor)Usage:
# Basic usage
./get-mcp-token.sh \
--keycloak-url https://keycloak.example.com \
--username your-username \
--password your-password
# With custom realm and MCP URL
./get-mcp-token.sh \
--keycloak-url https://keycloak.example.com \
--realm master \
--username your-username \
--password your-password \
--mcp-url https://mcp-server.example.com/mcp/sse
# Show help
./get-mcp-token.sh --help
Options:
| Option | Description | Required | Default |
|---|---|---|---|
--keycloak-url |
Keycloak server URL | Yes | - |
--username |
Your Keycloak username | Yes | - |
--password |
Your Keycloak password | Yes | - |
--realm |
Keycloak realm | No | master |
--mcp-url |
MCP server URL | No | http://localhost:8080/mcp/sse |
--help |
Display help message | No | - |
Output:
The script will:
Example Output:
Token obtained successfully!
Token expires in: 300 seconds (5 minutes)
Cursor MCP Configuration:
{
"mcpServers": {
"keycloak": {
"transport": "sse",
"url": "https://mcp-server.example.com/mcp/sse",
"headers": {
"Authorization": "Bearer eyJhbGciOiJS..."
}
}
}
}
To use:
1. Copy the configuration above
2. Update ~/.cursor/mcp.json
3. Reload MCP servers in Cursor (Cmd+Shift+P → "Reload MCP Servers")
brew install curl jq
sudo apt-get install curl jq
sudo dnf install curl jq
sudo apt-get install curl jq
jq: command not foundInstall jq using your package manager (see above).
curl: command not foundInstall curl using your package manager (see above).
The script will update the existing client configuration. This is safe and ensures the client has the correct settings.
Important Security Notes:
If you find issues or have suggestions for improving these scripts, please:
These scripts are part of the Keycloak MCP Server project and are licensed under the same license (MIT).