---
title: "Create an MCP access token"
method: POST
path: "/auth/mcp/access-token"
tags: ["Auth"]
---

# Create an MCP access token

`POST /auth/mcp/access-token`

Creates a JWT MCP access token for the project. If threadId is provided, the token will be bound to that thread. If threadId is omitted, a sessionless token will be created using the provided contextKey (or from Bearer token if not provided). Sessionless tokens can only access resources and prompts, not session-specific features. The token expires in 15 minutes and can be used as a bearer token.

## Request body

- CreateMcpAccessToken — Create MCP access token request
  - `threadId` string — Thread ID for the MCP access token. If provided, the token will be bound to this thread. If omitted, a sessionless token will be created.
  - `contextKey` string — Context key for sessionless MCP access tokens. If not provided, will be extracted from Bearer token.

## Response `201`

MCP access token created successfully

- McpAccessTokenResponse — MCP access token response
  - `mcpAccessToken` string — JWT MCP access token to be used as bearer token. Only included when MCP servers are configured for the project.
  - `expiresAt` number — Expiration time of the token in milliseconds since epoch. Only included when mcpAccessToken is present.
  - `hasSession` boolean — Whether the token is bound to a specific thread session. Only included when mcpAccessToken is present.

## Other responses

- `400` — Bad request - invalid authentication context or API key
- `404` — Thread not found or does not belong to project

---

[API](https://skmtc.net/tambo-ai/apis/tambo-api.md) · [All operations](https://skmtc.net/tambo-ai/apis/tambo-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tambo-ai/tambo-api/revisions/312691b28f1c/schema)
