Skip to main content
Use a service client when an internal AI gateway, automated agent, or backend workload must connect to ClosedLoop AI without a person authorizing it in a browser. The workload authenticates with a signed JWT or a shared secret, then receives a short-lived, read-only access token. For LiteLLM, use the guided integration in ClosedLoop AI. For another gateway or workload, create and manage a service client from MCP access settings.

Connect LiteLLM

1

Open the LiteLLM integration

In ClosedLoop AI, open Integrations → Developer tools → LiteLLM and click Connect.You need integration management permission. A workspace owner or admin can grant this permission to another member.
2

Create and save the credential

Click Create LiteLLM credential. Copy the generated environment variables into your secret manager before leaving the page.
The client secret is shown only once. If you lose it, generate a new secret from the LiteLLM integration.
3

Copy the generated LiteLLM configuration

Copy the generated config.yaml block into LiteLLM. ClosedLoop AI automatically supplies the correct MCP and token URLs for your workspace region.Restart or reload LiteLLM after changing its configuration, then ask it to list the available tools.
4

Verify tool discovery

Return to the LiteLLM integration in ClosedLoop AI and click Check again. The integration becomes connected after LiteLLM lists the ClosedLoop AI tools.Then call find_reference_customers or get_overview through LiteLLM to verify a complete request. LiteLLM may expose a namespaced name such as closedloop_ai-find_reference_customers.
Settings → MCP access remains the advanced surface for owners and admins managing custom gateways, public keys, and all service clients. Use public-key authentication when a non-LiteLLM client supports OAuth private_key_jwt. Use a shared secret for clients that support only client_secret_basic or client_secret_post.

Before you begin

You need:
  • Integration management permission for LiteLLM, or a workspace owner or admin account for advanced MCP access
  • A client that supports HTTP MCP and the OAuth client_credentials flow
  • A secret manager for the private key or shared secret

Set up another machine-to-machine client

1

Choose your regional endpoints

Use every URL from the same row:Credentials created for one region do not work in the other region.
2

Create a service client

  1. In ClosedLoop AI, open Settings → MCP access.
  2. Click Create service client.
  3. Enter a name that identifies the gateway or workload using it.
  4. Copy the client ID. If you plan to use shared-secret authentication, also copy the client secret into your secret manager.
The client secret is shown only once. If you lose it, rotate the credential and save the new secret.
3

Configure a shared-secret client

Set these values in your gateway:Use client_secret_basic when your gateway lets you choose the client authentication method. ClosedLoop AI also supports client_secret_post.If your gateway sends an OAuth resource value, set it to the exact regional MCP URL. Gateways that omit resource are supported.
4

Test the connection

Ask the gateway to list the available tools, then call a read-only tool such as get_overview.A successful connection does not open a browser. The gateway receives a one-hour token with the mcp:read scope and must fetch a new one when it expires.

Use public-key authentication

Public-key authentication keeps the private key in your infrastructure. ClosedLoop AI stores only the public JSON Web Key (JWK).
1

Generate a key pair

Generate either an RSA key of at least 2048 bits with public exponent 65537 for RS256, or a P-256 key for ES256. This RSA example requires OpenSSL and Node.js 20 or later:
Save closedloop-mcp-private.pem in your secret manager. The last command prints the public JWK you will register.
2

Register the public key

  1. In ClosedLoop AI, open Settings → MCP access.
  2. Find the service client and click Add public key.
  3. Enter a unique key ID, select the matching algorithm, and paste the public JWK.
  4. Click Register public key.
Never paste or upload the private key. ClosedLoop AI needs only the public JWK.
A service client can have up to two active public keys so you can rotate without downtime.
3

Configure the official TypeScript client

Install the MCP client package:
Configure PrivateKeyJwtProvider with the same client ID, algorithm, and regional MCP URL:
Set CLOSEDLOOP_MCP_URL to the exact regional MCP URL and keep the private-key file outside source control.After the first successful public-key connection, revoke the generated shared-secret credential unless another integration still needs it.

LiteLLM configuration reference

LiteLLM currently requires a client ID and shared secret for this flow. It does not expose private_key_jwt configuration.
The guided LiteLLM integration generates this block with the correct regional URLs. Store the generated values as CLOSEDLOOP_MCP_CLIENT_ID and CLOSEDLOOP_MCP_CLIENT_SECRET, then add the configuration to config.yaml:
For a US workspace, change both URLs to https://mcp.closedloop.sh and https://mcp.closedloop.sh/token. LiteLLM fetches, caches, and renews access tokens automatically. To verify the setup, list its tools and call find_reference_customers or get_overview.

Rotate or revoke credentials

  • Access tokens expire after one hour. Service-client secrets expire after 180 days.
  • ClosedLoop AI notifies workspace owners and admins in Settings → MCP access 30 and 7 days before a secret expires.
  • When you rotate a credential, its existing secret remains valid for at most 24 hours. Update the gateway, verify the new secret, then revoke the old credential.
  • Revoking a credential immediately invalidates its issued access tokens. Revoking a service client immediately invalidates all its credentials and tokens.
  • Public keys do not expire automatically. Register the replacement, test it, then revoke the old key.
  • Revoking a public key immediately invalidates every access token issued through that key.
Create a separate service client for each gateway or workload so access can be rotated, audited, and revoked independently.

Troubleshooting

MCP Overview

Set up interactive clients and learn how MCP access works.

Core tools reference

Browse core tools and their parameters.