{"templateId":"markdown","sharedDataIds":{},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Setting up Celonis Agent Tools (MCP Server) in Claude Code","description":"API documentation for Celonis APIs.","siteUrl":"https://developer.celonis.com","keywords":"celonis developer portal, celonis apis, celonis api reference docs","lang":"en-US","llmstxt":{"hide":false,"description":"Celonis API documentation","sections":[{"title":"API Docs","description":"Available Celonis API Docs","includeFiles":["**/*.md"]},{"title":"API Specs","description":"All Celonis API specifications","includeFiles":["**/openapi.yaml"]}]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"setting-up-celonis-agent-tools-mcp-server-in-claude-code","__idx":0},"children":["Setting up Celonis Agent Tools (MCP Server) in Claude Code"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide walks through connecting Claude Code to a Celonis MCP Server using ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://docs.celonis.com/en/using-oauth-2-0.html"},"children":["OAuth 2.0"]}," (the required method for all new set ups as of June 30, 2026)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["There are two paths:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path A — Authorization Code + PKCE (Advanced / tenant-dependent, currently blocked)."]}," This method would eliminate the refresh script and restart entirely via Claude Code's native browser login, but requires your Celonis tenant's OAuth app registration to accept a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost"]}," redirect URI, which is ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["confirmed rejected"]}," on at least one tenant (where Celonis enforces HTTPS-only redirect URIs). Only attempt this path if you've confirmed that your own tenant accepts loopback redirect URIs."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path B — Client Credentials (Default)."]}," Works on every tenant tested so far. Requires a manual refresh script and a full Claude Code restart every time the token expires (~15 minutes)."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Start with Path B unless you've already confirmed Path A works for your tenant."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"prerequisites","__idx":1},"children":["Prerequisites"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A Celonis MCP Server Asset already created in Celonis Studio, and its ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["asset ID"]}," (a UUID)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Access to Celonis ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Admin & Settings"]}," to create/view an OAuth application"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Claude Code installed, with terminal access"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["For Path B: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["curl"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["python3"]}," available (both ship standard on macOS/Linux)"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"step-1-construct-your-mcp-server-url","__idx":2},"children":["Step 1: Construct your MCP Server URL"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once the MCP Server asset has been successfully ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/mcp-server-asset/getting-started"},"children":["published in Celonis Studio"]}," (i.e. “Create Version” → “Deploy”), it will automatically generate an MCP Server URL. Prompt the user to provide this URL — from this URL, extract the following information:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Team"]}," — the first part of your Celonis URL (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["acme-corp"]}," in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["acme-corp.eu-1.celonis.cloud"]},")"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Realm"]}," — one of ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["us-1"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eu-1"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["eu-2"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ap-1"]},", or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["try"]}," (for trial environments)"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Asset ID"]}," — the UUID of your MCP Server Asset in Celonis Studio"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["MCP Server URL format:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://{team}.{realm}.celonis.cloud/studio-copilot/api/v1/mcp-servers/mcp/{asset-id}\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Example:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"https://acme-corp.eu-1.celonis.cloud/studio-copilot/api/v1/mcp-servers/mcp/12345678-abcd-1234-efgh-123456789abc\n"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"_","__idx":3},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"path-a-authorization-code--pkce","__idx":4},"children":["Path A: Authorization Code + PKCE"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this path only if you've confirmed your Celonis tenant's OAuth app registration accepts a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost"]}," redirect URI (see A1 below). If you haven't confirmed that, use Path B instead — it's the default for a reason."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If this option works for your tenant, this path eliminates the refresh script and restart entirely. Claude Code handles login and token refresh natively — there's no ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]},", no refresh script, and no restart required, ever."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"a1-register-an-oauth-app-for-interactive-login","__idx":5},"children":["A1. Register an OAuth app for interactive login"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In Celonis, go to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Admin & Settings → Applications"]}," and create (or select) an application with the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Authorization Code"]}," grant type enabled."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["redirect URI"]}," field, enter:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"http://localhost:<port>/callback\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["where youb substitute a port of your choice (e.g. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["8080"]},") for ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<port>"]},". This exact format — scheme ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http"]},", host literally ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["localhost"]}," (not ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["127.0.0.1"]},"), path ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/callback"]}," — comes from the Claude Code documentation for the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--callback-port"]}," flag and is what you'll need to match in Step A2."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Confirmed blocked on at least one tenant."]}," Live testing against a Celonis tenant showed the OAuth app registration UI rejects this redirect URI at registration time with an HTTPS-required error. This is a structural incompatibility, not a fixable misconfiguration: Claude Code's native OAuth flow requires a loopback redirect (per RFC 8252, the standard for native/CLI apps), and this tenant's auth server (Microsoft Entra-backed) requires HTTPS. No port or path variation will work around it. ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Try registering the URI above first"]}," — if Celonis's registration UI accepts it, the rest of Path A should work. If it's rejected, stop here and use Path B."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Note whether your app is a ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["public"]}," or ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["confidential"]}," client as confidential clients also have a Client Secret. Note down the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Client ID"]}," (and Client Secret, if confidential)."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You'll also need the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Team"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Realm"]},", and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Asset ID"]}," described in Step 1 above."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"a2-connect-with-the-claude-code-cli","__idx":6},"children":["A2. Connect with the Claude Code CLI"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["No ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," file and no manual JSON editing — the config entry is created for you. Try auto-discovery first:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"claude mcp add --transport http celonis <your-constructed-url-from-step-2>\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If Celonis's tenant doesn't expose standards-based OAuth discovery metadata, auto-discovery will fail. Your fallback is to use explicit flags:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"claude mcp add --transport http --client-id <client-id> [--client-secret] \\\n  --callback-port <port> celonis <your-constructed-url-from-step-2>\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use the same ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<port>"]}," you registered in Step A1. Omit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--client-secret"]}," if your app is a public client."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Do not"]}," add a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["headers"]}," block with a static ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Authorization"]}," value to this config entry. A static header combined with OAuth causes Claude Code to hard-fail rather than fall back. That pattern is Path B only."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"a3-log-in","__idx":7},"children":["A3. Log in"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"claude mcp login celonis\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This opens a system browser for login and consent. For headless/SSH sessions with no local browser:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"claude mcp login celonis --no-browser\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This prints a URL to open elsewhere and accepts a pasted redirect URL back."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"a4-test","__idx":8},"children":["A4. Test"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/mcp"]}," and confirm ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["celonis"]}," shows as connected. Then ask Claude: ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["\"What tools does the celonis MCP server expose?\""]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["That's it — no refresh script, no restart. Claude Code refreshes the token silently in the background."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"a5-troubleshooting-path-a","__idx":9},"children":["A5. Troubleshooting (Path A)"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Symptom"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Symptom"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Cause"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cause"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Fix"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Fix"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Browser doesn't open on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["claude mcp login"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Headless/SSH session, or no default browser"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["claude mcp login celonis --no-browser"]}," and paste the redirect URL manually"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["claude mcp add"]}," doesn't auto-discover the auth server"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Celonis tenant doesn't expose OAuth discovery metadata"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Re-run with explicit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--client-id"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--client-secret"]},"/",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--callback-port"]}," flags"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Callback port conflict (\"address already in use\")"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Another local process is bound to that port"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Pick a different port, re-register the matching redirect URI in Celonis Admin, retry"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["invalid_client"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["unauthorized_client"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Public vs. confidential client mismatch"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Confirm the client type in Celonis Admin; re-run with matching flags"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Login succeeds but ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/mcp"]}," shows disconnected"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Redirect URI mismatch between registration and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--callback-port"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Recheck they match exactly, including ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost:<port>/callback"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Celonis rejects the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost:<port>/callback"]}," redirect URI at registration, or login fails specifically on the redirect step"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Confirmed HTTPS-only enforcement on this tenant's auth server — not a fixable misconfiguration"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Use Path B (Client Credentials) below"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"path-b-client-credentials-default","__idx":10},"children":["Path B: Client Credentials (Default)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use this path as it's the only one confirmed to work end-to-end today. (Path A above remains documented for tenants where Celonis's OAuth app registration accepts loopback redirect URIs.) It requires manually refreshing a short-lived token and fully restarting Claude Code every ~15 minutes."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"b1-get-your-oauth-credentials","__idx":11},"children":["B1. Get your OAuth credentials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In Celonis:"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Go to ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Admin & Settings → Applications"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Select your application (or create one)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Confirm that it has the \"Client Credentials\" grant type enabled. Without this, token requests will fail."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Note down the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Client ID"]}," and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Client Secret"]},"."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You'll also need the ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Team"]},", ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Realm"]},", and ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Asset ID"]}," described in Step 1 above."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"b2-store-your-credentials","__idx":12},"children":["B2. Store your credentials"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," file in your project directory (or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.env"]}," if you want it available globally) with:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"CELONIS_CLIENT_ID=<your-client-id>\nCELONIS_CLIENT_SECRET=<your-client-secret>\nCELONIS_TEAM=<your-team>\nCELONIS_REALM=<your-realm>\nCELONIS_ACCESS_TOKEN=\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"warning","name":"Note"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Claude Code does ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," automatically read ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," files. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CELONIS_ACCESS_TOKEN"]}," must be present in the shell environment that launches Claude Code. The simplest way to guarantee this is to auto-load ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," in your shell profile:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"# Add to ~/.zshrc or ~/.bashrc\n[ -f ~/.env ] && set -a && source ~/.env && set +a\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Then open a new terminal (or run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source ~/.zshrc"]},") so the change takes effect."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," to your ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".gitignore"]}," if this is inside a git repo — never commit credentials."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"b3-add-the-mcp-server-to-your-config","__idx":13},"children":["B3. Add the MCP server to your config"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Add this entry to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".mcp.json"]}," (project-level) or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.claude/settings.json"]}," (global, under ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mcpServers"]},"):"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"mcpServers\": {\n    \"celonis\": {\n      \"type\": \"http\",\n      \"url\": \"<your-constructed-url-from-step-2>\",\n      \"headers\": {\n        \"Authorization\": \"Bearer ${CELONIS_ACCESS_TOKEN}\",\n        \"Accept\": \"application/json, text/event-stream\"\n      }\n    }\n  }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use project-level ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".mcp.json"]}," if you want to share the config (minus credentials) via git. Use global ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["settings.json"]}," if you want the same Celonis connection available across all projects."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"b4-set-up-token-refresh","__idx":14},"children":["B4. Set up token refresh"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["OAuth tokens from Celonis expire in roughly 15 minutes, so you'll need to refresh before each session. Save this as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["refresh-token.sh"]}," in your project directory and run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["chmod +x refresh-token.sh"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"#!/bin/bash\n# Fetches a fresh OAuth 2.0 token from Celonis and updates CELONIS_ACCESS_TOKEN in .env.\nset -euo pipefail\n\nENV_FILE=\"$(cd \"$(dirname \"$0\")\" && pwd)/.env\"\n\nif [ ! -f \"$ENV_FILE\" ]; then\n  echo \"Error: .env file not found at $ENV_FILE\"\n  exit 1\nfi\n\nset -a\nsource \"$ENV_FILE\"\nset +a\n\nfor var in CELONIS_CLIENT_ID CELONIS_CLIENT_SECRET CELONIS_TEAM CELONIS_REALM; do\n  if [ -z \"${!var:-}\" ]; then\n    echo \"Error: $var is not set in .env\"\n    exit 1\n  fi\ndone\n\necho \"Requesting token from Celonis...\"\n\nRESPONSE=$(curl -s -w \"\\n%{http_code}\" -X POST \\\n  \"https://${CELONIS_TEAM}.${CELONIS_REALM}.celonis.cloud/oauth2/token\" \\\n  -H \"Content-Type: application/x-www-form-urlencoded\" \\\n  -d \"grant_type=client_credentials\" \\\n  -d \"client_id=${CELONIS_CLIENT_ID}\" \\\n  -d \"client_secret=${CELONIS_CLIENT_SECRET}\" \\\n  -d \"scope=mcp-asset.tools:execute\")\n\nHTTP_STATUS=$(echo \"$RESPONSE\" | tail -n1)\nBODY=$(echo \"$RESPONSE\" | sed '$d')\n\nif [ \"$HTTP_STATUS\" != \"200\" ]; then\n  echo \"Error: Token request failed (HTTP $HTTP_STATUS)\"\n  echo \"$BODY\"\n  exit 1\nfi\n\nTOKEN=$(echo \"$BODY\" | python3 -c \"import sys, json; d=json.load(sys.stdin); print(d['access_token'])\" 2>/dev/null || true)\n\nif [ -z \"$TOKEN\" ]; then\n  echo \"Error: Could not parse access_token from response:\"\n  echo \"$BODY\"\n  exit 1\nfi\n\nNEW_TOKEN=\"$TOKEN\" ENV_FILE=\"$ENV_FILE\" python3 - <<'EOF'\nimport os, re\ntoken = os.environ['NEW_TOKEN']\nenv_file = os.environ['ENV_FILE']\nwith open(env_file, 'r') as f:\n    content = f.read()\nupdated = re.sub(r'^CELONIS_ACCESS_TOKEN=.*', f'CELONIS_ACCESS_TOKEN={token}', content, flags=re.MULTILINE)\nif 'CELONIS_ACCESS_TOKEN=' not in updated:\n    updated += f'\\nCELONIS_ACCESS_TOKEN={token}\\n'\nwith open(env_file, 'w') as f:\n    f.write(updated)\nEOF\n\necho \"Done. CELONIS_ACCESS_TOKEN updated in .env\"\n","lang":"shell"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Run it with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./refresh-token.sh"]}," any time before starting a Claude Code session."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"b5-activate-and-test","__idx":15},"children":["B5. Activate and test"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./refresh-token.sh"]}," to get a fresh token."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Fully restart Claude Code, with the new token loaded."]}," How you do this depends on whether you're using Terminal or VS Code, and (for VS Code) which scope you chose in Step 4:",{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Terminal"]},": In the same terminal, run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["set -a && source .env && set +a"]},", then Ctrl+C and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["claude"]}," to restart."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["VS Code, project-scope config"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".mcp.json"]},"): The token must be sourced in the terminal you launch VS Code from, and VS Code must be opened from inside this project directory. Run:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"cd /path/to/this/project\nset -a && source .env && set +a\ncode .\n","lang":"shell"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["VS Code, global-scope config"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["~/.claude/settings.json"]},"): The directory doesn't matter, but the token still needs sourcing first:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"shell","header":{"controls":{"copy":{}}},"source":"set -a && source ~/.env && set +a\ncode .\n","lang":"shell"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only fall back to quitting (Cmd+Q) and reopening VS Code via Finder/Dock if ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code ."]}," isn't available. That path needs an extra ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["launchctl setenv"]}," step (see B6 below), and closing the window alone is not enough on its own."]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/mcp"]}," to confirm the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["celonis"]}," server shows as connected."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Test by asking Claude: ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["\"What tools does the Celonis MCP server expose?\""]},"."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"b6-troubleshooting-path-b","__idx":16},"children":["B6. Troubleshooting (Path B)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Every single time you refresh — not just the first time — you must repeat all three steps: refresh, source, restart."]}," Running ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./refresh-token.sh"]}," only updates the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," file on disk. Your currently-running shell (and any Claude Code session launched from it) keeps whatever token it already has in memory until you explicitly re-run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["set -a && source .env && set +a"]}," in that same terminal, and then launch a fresh Claude Code session from it. Skipping the \"source\" step is the single most common cause of a token refresh silently \"not working.\""]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Also note that Claude Code discovers an MCP server's tools once, at session startup. Refreshing the token after a session has already started, or reconnecting a failed server mid-session, does ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["not"]}," re-trigger tool discovery. You must fix the token and then start a brand-new session, in that order. A mid-session reconnect will show the server as healthy but the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mcp__celonis__*"]}," tools still won't display until you restart."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Symptom"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Symptom"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Cause"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cause"]}]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Fix"},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Fix"]}]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Server not in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/mcp"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Config not saved correctly, or wrong file"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Re-check ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".mcp.json"]}," / ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["settings.json"]}," syntax and location"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["FORBIDDEN"]}," error"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Token expired, or wrong auth prefix"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./refresh-token.sh"]},", then ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source .env"]}," in the same terminal, then restart — all three steps, every time"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Unauthorized"]}," / 401"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Token expired mid-session, or refreshed without re-sourcing"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["./refresh-token.sh"]},", then ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source .env"]}," in the same terminal, then restart — all three steps, every time"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Tools connect but ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["mcp__celonis__*"]}," still missing after reconnecting"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Tool discovery only runs at session startup — a mid-session reconnect doesn't re-trigger it"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Start a brand-new session after the token is already valid, rather than fixing it mid-session"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Token request fails (non-200)"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Client Credentials grant type not enabled, or wrong client ID/secret"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Recheck the OAuth app config in Celonis Admin"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["VS Code extension won't pick up new token (macOS)"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Token not sourced in the launching terminal, or (project scope) VS Code not opened from the right directory, or launched via Finder/Dock (doesn't inherit shell env vars)"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Prefer ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["set -a && source .env && set +a"]}," then ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["code ."]}," from the correct directory. If you must launch via Finder/Dock, run ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["launchctl setenv CELONIS_ACCESS_TOKEN \"<token>\""]}," first, then fully quit (Cmd+Q) and reopen"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Server entry missing from ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".mcp.json"]}," entirely"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["claude mcp remove <name>"]}," was run to inspect the config, but it deletes rather than displays"]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["claude mcp get <name>"]}," to inspect without deleting; re-add the entry manually if it was removed"]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"notes","__idx":17},"children":["Notes"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Path B (Client Credentials) is the default and only confirmed-working path today."]}," Path A (Authorization Code + PKCE) is documented for tenants whose Celonis OAuth app registration accepts ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost"]}," redirect URIs — this tenant's does not."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["OAuth 2.0 is the only supported method for new Celonis API credentials as of June 30, 2026."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Path B only — Never commit ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":[".env"]}," or any file containing your Client Secret or Access Token to version control (Path A creates no such file)."]}]}]},"headings":[{"value":"Setting up Celonis Agent Tools (MCP Server) in Claude Code","id":"setting-up-celonis-agent-tools-mcp-server-in-claude-code","depth":1},{"value":"Prerequisites","id":"prerequisites","depth":2},{"value":"Step 1: Construct your MCP Server URL","id":"step-1-construct-your-mcp-server-url","depth":1},{"value":"","id":"_","depth":2},{"value":"Path A: Authorization Code + PKCE","id":"path-a-authorization-code--pkce","depth":1},{"value":"A1. Register an OAuth app for interactive login","id":"a1-register-an-oauth-app-for-interactive-login","depth":2},{"value":"A2. Connect with the Claude Code CLI","id":"a2-connect-with-the-claude-code-cli","depth":2},{"value":"A3. Log in","id":"a3-log-in","depth":2},{"value":"A4. Test","id":"a4-test","depth":2},{"value":"A5. Troubleshooting (Path A)","id":"a5-troubleshooting-path-a","depth":2},{"value":"Path B: Client Credentials (Default)","id":"path-b-client-credentials-default","depth":1},{"value":"B1. Get your OAuth credentials","id":"b1-get-your-oauth-credentials","depth":2},{"value":"B2. Store your credentials","id":"b2-store-your-credentials","depth":2},{"value":"B3. Add the MCP server to your config","id":"b3-add-the-mcp-server-to-your-config","depth":2},{"value":"B4. Set up token refresh","id":"b4-set-up-token-refresh","depth":2},{"value":"B5. Activate and test","id":"b5-activate-and-test","depth":2},{"value":"B6. Troubleshooting (Path B)","id":"b6-troubleshooting-path-b","depth":2},{"value":"Notes","id":"notes","depth":1}],"frontmatter":{"seo":{"title":"Setting up Celonis Agent Tools (MCP Server) in Claude Code"}},"lastModified":"2026-11-23T16:10:33.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/mcp-server-asset/integrations/mcp-claude-code-setup-guide","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}