Contents
Context
Served by Nucleo Core (auth.nucleoplatform.com): which companies the person can work in, which
modules each company exposes to AI clients and their API hosts, and the active company.
Base URL, authentication and conventions of this API are on the AI Tools API page.
/api/mcp/contextGet companies, modules and active company
nucleo.ai_tools scope.The companies of the signed-in person in canonical order, with the modules each one can reach
through AI clients (connector_enabled) and the base URL of each module's API, plus the
active company used by the MCP connector.
active_company_source tells how it was chosen: claim (the org_id hint you passed, or
else the company of the access token, set with org_id on /oauth/authorize or later with
nucleo_switch_company through that token),
only (the person has one company), preference (saved with PUT /api/mcp/company or the
connector tool nucleo_switch_company), default (first company).
A module with connector_enabled: false has been switched off for AI clients by that company
(or has no tools API): do not call it. The connector does not offer its tools, and the module
itself refuses AI clients' calls to its AI tools in that company with 403 ai_connector_disabled
(the same switches are in the userinfo claim ai_connector_disabled).
Companies are identified by public_id (a UUID): use it everywhere. id and
active_company_id are the numeric ids, deprecated and kept only for compatibility.
Query parameters
org_idstring (uuid) | integerPreferred company: its public id, or its numeric id (deprecated, still accepted). Used as active company only if the person belongs to it.
Example:0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6
Responses
200Context.application/json
userobjectChild attributes
idintegernamestringemailstring (email)languagestringOne ofenitis_internalboolean
companiesarray of objectAttributes of each item
public_idstring (uuid) | nullPublic id of the company
idintegerdeprecatedNumeric company id (deprecated): use
public_id.slugstringnamestringis_internalbooleanis_demobooleandisabled_sectionsarray of stringmodulesarray of objectAttributes of each item
slugstringOne ofbraincatalogcommerceintelligencenamestringrolestringapi_base_urlstring (uri) | nullconnector_enabledboolean
active_company_public_idstring (uuid) | nullPublic id of the active company.
active_company_idinteger | nulldeprecatedNumeric id of the active company (deprecated): use
active_company_public_id.active_company_sourcestring | nullOne ofclaimonlypreferencedefaultnull
401Missing, expired or revoked token — or a token that is not from a self-registered client. Body:
{"message":"Unauthenticated."}; Intelligence answers withapplication/problem+json. application/jsonmessagestring
curl -X GET 'https://auth.nucleoplatform.com/api/mcp/context?org_id=0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6' \
-H "Authorization: Bearer $NUCLEO_ACCESS_TOKEN" \
-H 'Accept: application/json'const res = await fetch("https://auth.nucleoplatform.com/api/mcp/context?org_id=0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6", {
method: "GET",
headers: {
Authorization: `Bearer ${process.env.NUCLEO_ACCESS_TOKEN}`,
Accept: "application/json",
},
});
const data = await res.json();
console.log(res.status, data);<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('GET', 'https://auth.nucleoplatform.com/api/mcp/context?org_id=0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('NUCLEO_ACCESS_TOKEN'),
'Accept' => 'application/json',
],
'http_errors' => false,
]);
echo $response->getStatusCode(), PHP_EOL;
echo $response->getBody();{
"user": {
"id": 42,
"name": "Giulia Rossi",
"email": "giulia.rossi@acme.example",
"language": "it",
"is_internal": false
},
"companies": [
{
"id": 7,
"public_id": "0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6",
"slug": "acme",
"name": "Acme Apparel",
"is_internal": false,
"is_demo": false,
"disabled_sections": [
"pos"
],
"modules": [
{
"slug": "catalog",
"name": "Catalog",
"role": "editor",
"api_base_url": "https://api-catalog.nucleoplatform.com",
"connector_enabled": true
},
{
"slug": "commerce",
"name": "Commerce",
"role": "viewer",
"api_base_url": "https://api-commerce.nucleoplatform.com",
"connector_enabled": true
},
{
"slug": "intelligence",
"name": "Intelligence",
"role": "viewer",
"api_base_url": "https://api-intelligence.nucleoplatform.com",
"connector_enabled": false
}
]
}
],
"active_company_id": 7,
"active_company_public_id": "0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6",
"active_company_source": "only"
}{
"message": "Unauthenticated."
}/api/mcp/companySet the active company
nucleo.ai_tools scope.Saves the active company of the person for AI clients (one value per person, shared by every AI client they connect, including the MCP connector) and returns the updated context.
Request bodyapplication/json
organization_idstring (uuid) | integerrequiredThe company's public id (
companies[].public_id), or its numeric id (companies[].id, deprecated, still accepted). A public id that does not exist gets403 company_forbidden, like a company the person has no access to.
Responses
200Updated context (same shape as
GET /api/mcp/context).application/jsonuserobjectChild attributes
idintegernamestringemailstring (email)languagestringOne ofenitis_internalboolean
companiesarray of objectAttributes of each item
public_idstring (uuid) | nullPublic id of the company
idintegerdeprecatedNumeric company id (deprecated): use
public_id.slugstringnamestringis_internalbooleanis_demobooleandisabled_sectionsarray of stringmodulesarray of objectAttributes of each item
slugstringOne ofbraincatalogcommerceintelligencenamestringrolestringapi_base_urlstring (uri) | nullconnector_enabledboolean
active_company_public_idstring (uuid) | nullPublic id of the active company.
active_company_idinteger | nulldeprecatedNumeric id of the active company (deprecated): use
active_company_public_id.active_company_sourcestring | nullOne ofclaimonlypreferencedefaultnull
401Missing, expired or revoked token — or a token that is not from a self-registered client. Body:
{"message":"Unauthenticated."}; Intelligence answers withapplication/problem+json. application/jsonmessagestring
403The person has no access to that company.application/json
errorstringOne ofcompany_requiredcompany_forbiddencompany_not_readyai_connector_disabledunsupported_versionunknown_toolpermission_deniedinvalid_argumentsmessagestringrequiredIn the language of
X-Nucleo-Languagewhere translated.permissionstringpermission_deniedonly.supportedarray of integerunsupported_versiononly.errorsobjectinvalid_argumentson Commerce and Intelligence (standard validation shape).detailsarray of objectinvalid_argumentson Brain and Catalog.Attributes of each item
fieldstringerrorstring
422Validation failed.application/json
messagestringerrorsobject
curl -X PUT https://auth.nucleoplatform.com/api/mcp/company \
-H "Authorization: Bearer $NUCLEO_ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"organization_id": "0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6"
}'const res = await fetch("https://auth.nucleoplatform.com/api/mcp/company", {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.NUCLEO_ACCESS_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"organization_id": "0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6"
}),
});
const data = await res.json();
console.log(res.status, data);<?php
require 'vendor/autoload.php';
$client = new GuzzleHttp\Client();
$response = $client->request('PUT', 'https://auth.nucleoplatform.com/api/mcp/company', [
'headers' => [
'Authorization' => 'Bearer ' . getenv('NUCLEO_ACCESS_TOKEN'),
],
'json' => [
'organization_id' => '0199e5c2-7a1b-7c3d-8e4f-a1b2c3d4e5f6',
],
'http_errors' => false,
]);
echo $response->getStatusCode(), PHP_EOL;
echo $response->getBody();{
"user": {
"id": 1,
"name": "string",
"email": "jane@example.com",
"language": "en",
"is_internal": true
},
"companies": [
{
"public_id": "9b2f4c1e-5d7a-4e8b-9c3d-2a1f0e6b7c8d",
"id": 1,
"slug": "string",
"name": "string",
"is_internal": true,
"is_demo": true,
"disabled_sections": [
"string"
],
"modules": [
{
"slug": "brain",
"name": "string",
"role": "string",
"api_base_url": "https://shop.acme.example",
"connector_enabled": true
}
]
}
],
"active_company_public_id": "9b2f4c1e-5d7a-4e8b-9c3d-2a1f0e6b7c8d",
"active_company_id": 1,
"active_company_source": "claim"
}{
"message": "Unauthenticated."
}{
"error": "company_forbidden",
"message": "You have no access to this company."
}{
"message": "The organization id field is required.",
"errors": {
"organization_id": [
"The organization id field is required."
]
}
}{
"message": "The organization id must be a number or a public id.",
"errors": {
"organization_id": [
"The organization id must be a number or a public id."
]
}
}