Skip to main content
POST/mcp/tokens

Create MCP Token

Mints the bearer token an MCP client presents to the project's MCP endpoint.

The body names the tools the token may call: project functions, all functions of named extensions, and tools on the project's registered MCP servers.

There is no wildcard. ttlSeconds is 60 to 3600 (one hour).

The token is minted from an operator session, not a personal access token, and it works only on the MCP endpoint.

It is revoked by its jti.

Parameters
projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Request body
toolsobject

The functions the token may call.

Required unless externalTools names at least one tool.

At most 100 tools in all, functions and external tools together.

functionsstring[]

Names of individual functions the token may call.

No wildcards.

extensionsstring[]

Slugs of extensions: the token may call every function of each one that exists now.

Functions added later are not included.

externalToolsobject[]

Tools on the project's registered MCP servers that the token may call, each named by server and tool.

The caller must be allowed to call that server.

server *string

The name of a registered MCP server of this project.

tool *string

The tool on that server.

ttlSecondsinteger

How long the token lasts, in seconds: 60 to 3600.

Default 3600.

Responses
HTTPK9O CodeDescription
201Created
400K9O_INVALID_FIELD_VALUEThe tool selection is empty, names a wildcard, or names something that is not a function name or extension slug.
403K9O_FORBIDDENThe caller is an MCP token, a plugin token, a delegated agent or a sandbox token; none of these can mint.
403K9O_IAM_POLICY_DENIEDThe caller is not an operator, or the bound IAMPolicy ceiling denies functions:invoke for the caller.
404K9O_NOT_FOUNDThe caller has no access to the project, or a selected function or extension has no active extension function on the project.
Response body (201)
data *object
token *string

The bearer token for the MCP endpoint.

It is shown only in this response.

tokenId *string

The token's id: use it to revoke the token with DELETE /mcp/tokens/{jti}.

tokenType *"Bearer"

Always Bearer.

scope *string

The scope the token carries: project_invoke_only, which allows calling only the named tools.

audience *string

The MCP endpoint URI the token is bound to.

Another project's endpoint refuses it.

tools *string[]

The functions the token may call, resolved to names at mint time.

externalTools *object[]

The external MCP tools the token may call.

server *string

The registered MCP server.

tool *string

The tool on that server.

name *string

The tool's name in tools/list and tools/call.

expiresAt *string <date-time>

When the token stops working.

meta *any
cURL
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/mcp/tokens' \
  -H 'Authorization: Bearer $K9O_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{}'

Showing example in cURL

Request example
{
  "tools": {
    "functions": [
      "string"
    ],
    "extensions": [
      "string"
    ]
  },
  "externalTools": [
    {
      "server": "string",
      "tool": "string"
    }
  ],
  "ttlSeconds": 0
}
Response example (201)
{
  "data": {
    "token": "string",
    "tokenId": "string",
    "tokenType": "Bearer",
    "scope": "string",
    "audience": "string",
    "tools": [
      "string"
    ],
    "externalTools": [
      {
        "server": "string",
        "tool": "string",
        "name": "string"
      }
    ],
    "expiresAt": "string"
  }
}

More in MCP