Create or update a native custom-agent MCP connection
Creates or updates an agent-scoped MCP connection for a native custom agent. Credentials are stored separately per agent even when multiple agents use the same MCP server URL.
POST
/agents/{id}/native/mcp-connectionsAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
idstringrequiredQuery parameters
fieldsToReturnstringComma-separated list of top-level response fields to return. Overrides the endpoint compact default unless responseShape=full is used.
responseShapestringAdvanced override. Omit for the endpoint compact default. Use full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:
compactfullHeader parameters
LT-Response-ShapestringAdvanced override. Set to full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:
fullRequest body
requiredapplication/jsonauthModestringAuth mode: none, bearer, or oauth.
bearerTokenobjectBearer token for bearer auth. Write-only.
idobjectExisting MCP connection id to update.
namestringMCP server name.
oauthClientIdobjectOAuth client id for advanced OAuth setup.
oauthClientSecretobjectOAuth client secret for advanced OAuth setup. Write-only.
urlstringMCP server URL.
Responses
201
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
Request
curl -X POST "https://leadtime.app/api/public/agents/string/native/mcp-connections" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"authMode": "string",
"bearerToken": {},
"id": {},
"name": "string",
"oauthClientId": {},
"oauthClientSecret": {},
"url": "string"
}'const response = await fetch("https://leadtime.app/api/public/agents/string/native/mcp-connections", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"authMode": "string",
"bearerToken": {},
"id": {},
"name": "string",
"oauthClientId": {},
"oauthClientSecret": {},
"url": "string"
})
});import requests
response = requests.post(
"https://leadtime.app/api/public/agents/string/native/mcp-connections",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
json={
"authMode": "string",
"bearerToken": {},
"id": {},
"name": "string",
"oauthClientId": {},
"oauthClientSecret": {},
"url": "string"
},
)Response
No example response.
Unauthorized - Invalid or missing authentication token
Forbidden - Insufficient API scopes or permissions