Set up an MCP connection
Connect an MCP client to Contracts AI so you can ask questions and search contracts from your AI assistant using a Bearer token.
MCP (Model Context Protocol) lets compatible AI clients call Contracts AI tools over HTTP—ask questions about your contracts, search the repository, open a contract by ID, or list upcoming renewals—without opening the Contracts AI UI.
Contracts AI exposes a single MCP endpoint. You authenticate with a Bearer JWT (the same kind of token used for other Contracts AI APIs).
What you need
- Access to Contracts AI (and an admin who can create an OAuth application, if you use client credentials)
- An MCP-capable client that supports remote / HTTP MCP servers
- Your Contracts AI API base URL (production is typically
https://api.contracts.ai; use your tenant or staging API host if that is where your data lives)
Step 1: Get an access token
Option A — OAuth client credentials (recommended for shared or long-lived setups)
- Open Admin → Security → Manage OAuth Applications.
- Create Application with a clear name (for example
MCP Integration) and any redirect URI your org requires for registration (client-credentials usage does not rely on the browser redirect). - Copy the Client ID (and Client Secret, if your application has one).
- Request a token:
curl -X POST https://api.contracts.ai/api/oauth/token \
-H "Content-Type: application/json" \
-d '{
"grant_type": "client_credentials",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET"
}'
Omit client_secret if the OAuth app was created without one.
- From the response, copy
access_token. Use it asBearer <access_token>.
Permissions: The token runs as the user who created the OAuth app (or an org admin fallback). That user’s contract access applies to every MCP tool call.
Option B — Sign-in JWT
Sign in to Contracts AI normally and use a valid session / API access JWT as the Bearer token. Prefer Option A for MCP so you are not tied to a personal browser session.
Step 2: MCP endpoint
| Item | Value |
|---|---|
| URL | https://api.contracts.ai/api/mcp/ |
| Method | POST (JSON-RPC); GET returns a short discovery / health payload |
| Auth header | Authorization: Bearer YOUR_ACCESS_TOKEN |
| Transport | HTTP (Streamable HTTP / JSON-RPC) |
Replace the host with your environment’s API base if you are not on production.
Quick discovery check:
curl https://api.contracts.ai/api/mcp/
Step 3: Connect your MCP client
Exact steps vary by client. In general:
- Open your client’s MCP / connectors / custom server settings.
- Add a remote / HTTP MCP server.
- Set the server URL to
https://api.contracts.ai/api/mcp/(or your API host +/api/mcp/). - Add the header:
- Name:
Authorization - Value:
Bearer YOUR_ACCESS_TOKEN
- Name:
- Save and restart or refresh the client if prompted.
- Confirm Contracts AI tools appear (names below).
Example MCP server config
Many clients use an mcpServers entry with a URL and headers:
{
"mcpServers": {
"contracts-ai": {
"url": "https://api.contracts.ai/api/mcp/",
"headers": {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
}
}
}
Use the format required by your client if it differs; the important values are the URL and Bearer header.
Available tools
| Tool | Use it to |
|---|---|
| ask_contracts | Ask a natural-language question about contracts in your organization |
| search_contracts | Find contracts by text, counterparty, active/inactive, with a result limit |
| get_contract | Load full details for one contract by numeric ID or con_xxx public ID |
| list_renewals | List renewals / expiries in a days-ahead window (optional auto-renewal only) |
Example prompts
- “Which contracts renew in the next 90 days?”
- “Search for agreements with Acme.”
- “What are the payment terms in contract
con_…?” - “Do we have liability caps over $1M with this vendor?”
Security practices
- Treat the access token like a password; do not paste it into tickets or screenshots.
- Prefer a dedicated OAuth application for MCP so you can Deactivate or Regenerate Client ID without affecting other integrations.
- Remember MCP calls use the creating user’s permissions—use an account with the least access needed.
- Rotate credentials if a token or Client ID may have leaked.
Troubleshooting
| Issue | What to check |
|---|---|
| 401 / unauthorized | Bearer header present; token not expired; Client ID active |
| Tools missing in client | URL ends with /api/mcp/; client supports remote HTTP MCP; restart after config change |
| Empty or wrong contracts | Wrong API host (prod vs staging / tenant); token user’s org and access rules |
invalid_client on token request | Client ID correct; app Active; secret matches if the app has one |
Related
- OAuth Applications — register Client IDs used for
client_credentials - API docs / Setting up the API — broader token and REST usage
Summary
Create or reuse an OAuth app, obtain a Bearer token from POST /api/oauth/token (grant_type=client_credentials), point your MCP client at https://api.contracts.ai/api/mcp/ with Authorization: Bearer …, then use ask_contracts, search_contracts, get_contract, and list_renewals.
Did this answer your question?