The Server Token Creation Endpoint
For engineers automating the deployment of new AI agent infrastructure, generating deterministic authentication boundaries dynamically relies heavily on the token instantiation endpoint.The API Endpoint
POST /servers/{serverId}/tokens
The target orchestration node is inferred inherently from the {serverId} deployed directly into the network HTTP request path.
Request Body Formatting
Using the mappedCreateServerTokenRequest structure, submit a JSON object housing a token map mapping the constraints explicitly to ServerTokenCreate.
name(string): A mandatory human-readable identifier. Useful when listing and auditing long-term credentials later to determine deprecation readiness.expiresAt(string, optional): An ISO 8601 formatted datetime layout dictating when the credential inherently self-destructs. If omitted entirely, the credential maintains active perpetuity natively.
Important: Handling the Response
The201 Created return delivers the CreateServerTokenResponse mapping object explicitly containing the newly generated schema.
value property contains the raw, globally unique cryptography string your downstream pipelines need to communicate natively with HasMCP. You must cache/inject this intelligently.