playerthree/mcp
playerthree/mcp: the remote MCP binding (Streamable HTTP endpoint), its tool surface, observation paging and the OAuth 2.1 authorization server.
Interfaces
AuthorizationServer
Defined in: packages/playerthree/src/mcp/oauth/server.ts:156
The authorization server: its metadata URLs, request handling and the owner-side connection and consent operations.
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
issuer | readonly | string | - | packages/playerthree/src/mcp/oauth/server.ts:157 |
ready | readonly | Promise<void> | Resolves once the store has loaded. | packages/playerthree/src/mcp/oauth/server.ts:162 |
resource | readonly | string | The MCP endpoint URL tokens are bound to. | packages/playerthree/src/mcp/oauth/server.ts:159 |
resourceMetadataUrl | readonly | string | - | packages/playerthree/src/mcp/oauth/server.ts:160 |
Methods
allConnections()
allConnections(): OwnedConnectionStatus[];Defined in: packages/playerthree/src/mcp/oauth/server.ts:174
Every owner's connections, oldest first. For operator tooling (the operator console); never show it to players.
Returns
challenge()
challenge(invalid, request?): string;Defined in: packages/playerthree/src/mcp/oauth/server.ts:186
WWW-Authenticate value for a 401 (invalid: a token was presented but is not valid), for the request's origin.
Parameters
| Parameter | Type |
|---|---|
invalid | boolean |
request? | Request |
Returns
string
close()
close(): void;Defined in: packages/playerthree/src/mcp/oauth/server.ts:187
Returns
void
connections()
connections(owner): ConnectionStatus[];Defined in: packages/playerthree/src/mcp/oauth/server.ts:172
Parameters
| Parameter | Type |
|---|---|
owner | string |
Returns
consentRequest()
consentRequest(id): ConsentRequest | undefined;Defined in: packages/playerthree/src/mcp/oauth/server.ts:169
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
ConsentRequest | undefined
fetch()
fetch(request): Promise<Response | undefined>;Defined in: packages/playerthree/src/mcp/oauth/server.ts:168
Web-standard face: a Response for authorization server paths, else undefined.
Parameters
| Parameter | Type |
|---|---|
request | Request |
Returns
Promise<Response | undefined>
handle()
handle(req, res): Promise<boolean>;Defined in: packages/playerthree/src/mcp/oauth/server.ts:166
node:http face: answers and returns true for authorization server paths, else returns false untouched.
Parameters
| Parameter | Type |
|---|---|
req | IncomingMessage |
res | ServerResponse |
Returns
Promise<boolean>
handles()
handles(pathname): boolean;Defined in: packages/playerthree/src/mcp/oauth/server.ts:164
Whether a pathname belongs to the authorization server (/.well-known/oauth-*, /oauth/*).
Parameters
| Parameter | Type |
|---|---|
pathname | string |
Returns
boolean
onChange()
onChange(listener): () => void;Defined in: packages/playerthree/src/mcp/oauth/server.ts:184
Connection credential or role changes. Listeners receive identifiers only, never tokens.
Parameters
| Parameter | Type |
|---|---|
listener | (connection) => void |
Returns
() => void
removeOwner()
removeOwner(owner): void;Defined in: packages/playerthree/src/mcp/oauth/server.ts:180
Revokes every connection of an owner.
Parameters
| Parameter | Type |
|---|---|
owner | string |
Returns
void
resolveConsent()
resolveConsent(id, answer): object;Defined in: packages/playerthree/src/mcp/oauth/server.ts:171
Answers a pending request (single use). Throws PlayerThreeError('invalid') for unknown/expired ids, owners or roles.
Parameters
| Parameter | Type |
|---|---|
id | string |
answer | ConsentDecision |
Returns
object
| Name | Type | Defined in |
|---|---|---|
redirect | string | packages/playerthree/src/mcp/oauth/server.ts:171 |
revokeConnection()
revokeConnection(owner, id): void;Defined in: packages/playerthree/src/mcp/oauth/server.ts:178
Revokes a connection and every token of it at once. Throws PlayerThreeError('invalid') for unknown ids.
Parameters
| Parameter | Type |
|---|---|
owner | string |
id | string |
Returns
void
updateConnection()
updateConnection(
owner,
id,
patch
): ConnectionStatus;Defined in: packages/playerthree/src/mcp/oauth/server.ts:176
Sets this exact commander's granted compatible roles without modifying other connections.
Parameters
| Parameter | Type |
|---|---|
owner | string |
id | string |
patch | { roles: readonly string[]; } |
patch.roles | readonly string[] |
Returns
verify()
verify(token): OAuthGrant | undefined;Defined in: packages/playerthree/src/mcp/oauth/server.ts:182
Resource-server side: an access token issued for this endpoint (under any of its origins), or undefined.
Parameters
| Parameter | Type |
|---|---|
token | string |
Returns
OAuthGrant | undefined
AuthorizationServerOptions
Defined in: packages/playerthree/src/mcp/oauth/server.ts:72
Options of createAuthorizationServer.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
accessTokenSeconds? | number | Access token lifetime (default 3600). | packages/playerthree/src/mcp/oauth/server.ts:92 |
aliases? | readonly (string | URL)[] | Other origins the same server is reached at (e.g. in development both the Vite dev server and the game server). Metadata, challenges, iss and the tokens' audience follow the origin a request came in on (the Host or X-Forwarded-Host header, honoured only when it names one of these origins); anything else gets issuer. The consent page is always on issuer. | packages/playerthree/src/mcp/oauth/server.ts:81 |
allowLoopbackClients? | boolean | Development only: accept http://localhost… Client ID Metadata Document URLs. | packages/playerthree/src/mcp/oauth/server.ts:90 |
dataDir? | string | - | packages/playerthree/src/mcp/oauth/server.ts:88 |
issuer | string | URL | Public origin of the game server (the issuer), e.g. https://game.example. No path. | packages/playerthree/src/mcp/oauth/server.ts:74 |
mcpPath? | string | Pathname of the MCP endpoint (default /mcp). The tokens' audience is issuer + mcpPath. | packages/playerthree/src/mcp/oauth/server.ts:83 |
onError? | (error) => void | - | packages/playerthree/src/mcp/oauth/server.ts:97 |
refreshTokenSeconds? | number | Refresh token lifetime, renewed on every rotation (default 30 days). | packages/playerthree/src/mcp/oauth/server.ts:94 |
resourceName? | string | Human-readable resource name in the protected resource metadata (default: the game title). | packages/playerthree/src/mcp/oauth/server.ts:96 |
store? | ConnectionStore | Connection storage (default: JSON files under dataDir/oauth/<game id>, else in memory). | packages/playerthree/src/mcp/oauth/server.ts:87 |
Methods
consentUrl()
consentUrl(requestId): string;Defined in: packages/playerthree/src/mcp/oauth/server.ts:85
The game's consent page for a pending request (absolute URL, or a path on the issuer).
Parameters
| Parameter | Type |
|---|---|
requestId | string |
Returns
string
CimdOptions
Defined in: packages/playerthree/src/mcp/oauth/cimd.ts:44
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
allowLoopback? | boolean | Development only: accept http:// client ids on loopback hosts and loopback addresses. | packages/playerthree/src/mcp/oauth/cimd.ts:46 |
maxBytes? | number | - | packages/playerthree/src/mcp/oauth/cimd.ts:48 |
timeoutMs? | number | - | packages/playerthree/src/mcp/oauth/cimd.ts:47 |
ConnectionStatus
Defined in: packages/playerthree/src/mcp/oauth/server.ts:101
A connection as the game shows it to its owner.
Extended by
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
active | boolean | A call in the last 30 s, or a call in flight (e.g. blocked in game_wait). | packages/playerthree/src/mcp/oauth/server.ts:111 |
authorizedAt | number | Last consent (sign-in) for this connection: a repeat sign-in from the same client updates it. | packages/playerthree/src/mcp/oauth/server.ts:108 |
client | OAuthClientInfo | - | packages/playerthree/src/mcp/oauth/server.ts:104 |
commander | string | - | packages/playerthree/src/mcp/oauth/server.ts:103 |
createdAt | number | - | packages/playerthree/src/mcp/oauth/server.ts:106 |
id | string | - | packages/playerthree/src/mcp/oauth/server.ts:102 |
lastSeenAt | number | null | - | packages/playerthree/src/mcp/oauth/server.ts:109 |
roles | string[] | - | packages/playerthree/src/mcp/oauth/server.ts:105 |
ConnectionStore
Defined in: packages/playerthree/src/mcp/oauth/store.ts:72
Every method may be sync or async; writes are issued in order.
Methods
deleteClient()
deleteClient(id): void | Promise<void>;Defined in: packages/playerthree/src/mcp/oauth/store.ts:77
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void | Promise<void>
deleteConnection()
deleteConnection(id): void | Promise<void>;Defined in: packages/playerthree/src/mcp/oauth/store.ts:75
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void | Promise<void>
load()
load():
| ConnectionStoreData
| Promise<ConnectionStoreData>;Defined in: packages/playerthree/src/mcp/oauth/store.ts:73
Returns
| ConnectionStoreData
| Promise<ConnectionStoreData>
saveClient()
saveClient(client): void | Promise<void>;Defined in: packages/playerthree/src/mcp/oauth/store.ts:76
Parameters
| Parameter | Type |
|---|---|
client | StoredClient |
Returns
void | Promise<void>
saveConnection()
saveConnection(connection): void | Promise<void>;Defined in: packages/playerthree/src/mcp/oauth/store.ts:74
Parameters
| Parameter | Type |
|---|---|
connection | StoredConnection |
Returns
void | Promise<void>
ConnectionStoreData
Defined in: packages/playerthree/src/mcp/oauth/store.ts:66
Properties
| Property | Type | Defined in |
|---|---|---|
clients | StoredClient[] | packages/playerthree/src/mcp/oauth/store.ts:68 |
connections | StoredConnection[] | packages/playerthree/src/mcp/oauth/store.ts:67 |
ConsentDecision
Defined in: packages/playerthree/src/mcp/oauth/server.ts:132
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
approve | boolean | - | packages/playerthree/src/mcp/oauth/server.ts:139 |
commander | string | Exact named commander selected by the authenticated owner. | packages/playerthree/src/mcp/oauth/server.ts:136 |
owner | string | The game's authenticated player id (OWNER_RE), with an existing commander roster. | packages/playerthree/src/mcp/oauth/server.ts:134 |
roles | readonly string[] | Roles to grant (at least one when approving). | packages/playerthree/src/mcp/oauth/server.ts:138 |
ConsentEvent
Defined in: packages/playerthree/src/mcp/server.ts:42
playerthree/mcp: the remote MCP binding (Streamable HTTP endpoint), its tool surface, observation paging and the OAuth 2.1 authorization server.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
granted | boolean | - | packages/playerthree/src/mcp/server.ts:52 |
match | string | Empty for a commander token (it is not bound to one match). | packages/playerthree/src/mcp/server.ts:44 |
owner? | string | Commander tokens: the roster owner id the game registered. | packages/playerthree/src/mcp/server.ts:49 |
role | string | - | packages/playerthree/src/mcp/server.ts:47 |
team | string | Empty for a commander token. | packages/playerthree/src/mcp/server.ts:46 |
via | "elicitation" | "implicit" | elicitation: the human answered the consent form. implicit: the client cannot elicit; adding the server with the token is the consent. | packages/playerthree/src/mcp/server.ts:51 |
ConsentRequest
Defined in: packages/playerthree/src/mcp/oauth/server.ts:120
What the game's consent page shows.
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
client | OAuthClientInfo | - | packages/playerthree/src/mcp/oauth/server.ts:122 |
domain? | string | Host of a metadata-document client_id: the document was served from there (verified). Absent for DCR clients (self-asserted). | packages/playerthree/src/mcp/oauth/server.ts:124 |
expiresAt | number | - | packages/playerthree/src/mcp/oauth/server.ts:129 |
id | string | - | packages/playerthree/src/mcp/oauth/server.ts:121 |
redirect | object | Where the browser returns after the answer. MCP: the page MUST show the host; warn when it is loopback only. | packages/playerthree/src/mcp/oauth/server.ts:126 |
redirect.host | string | - | packages/playerthree/src/mcp/oauth/server.ts:126 |
redirect.loopback | boolean | - | packages/playerthree/src/mcp/oauth/server.ts:126 |
redirect.uri | string | - | packages/playerthree/src/mcp/oauth/server.ts:126 |
roles | string[] | Roles the owner can grant (every manifest role). | packages/playerthree/src/mcp/oauth/server.ts:128 |
McpOptions
Defined in: packages/playerthree/src/mcp/server.ts:56
Options of the MCP endpoint.
Extended by
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
allowedOrigins? | readonly string[] | Exact Origin values allowed to call the endpoint (DNS-rebinding protection). Requests carrying any other Origin are rejected with 403. Non-browser MCP clients send no Origin. Default: none. | packages/playerthree/src/mcp/server.ts:61 |
auth? | AuthorizationServer | The OAuth authorization server (createAuthorizationServer): its access tokens authenticate OAuth connections (one named commander + compatible role grants), and 401s carry its challenge. Seat/commander tokens keep working next to it. | packages/playerthree/src/mcp/server.ts:67 |
onConsent? | (event) => void | Observe consent decisions (e.g. to log them or show them in the owner's UI). | packages/playerthree/src/mcp/server.ts:69 |
onError? | (error) => void | Out-of-band errors (SDK errors, internal failures). Never forwarded to agents. | packages/playerthree/src/mcp/server.ts:71 |
McpRequestHandler()
Defined in: packages/playerthree/src/mcp/server.ts:75
The MCP endpoint as a request handler with a node:http face and a web-standard fetch face.
McpRequestHandler(req, res): Promise<void>;Defined in: packages/playerthree/src/mcp/server.ts:77
node:http face: fully handles the response. Does not check the path — route before calling.
Parameters
| Parameter | Type |
|---|---|
req | IncomingMessage |
res | ServerResponse |
Returns
Promise<void>
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
surfaceHash | readonly | string | packages/playerthree/src/mcp/server.ts:82 |
Methods
close()
close(): Promise<void>;Defined in: packages/playerthree/src/mcp/server.ts:81
Aborts in-flight exchanges.
Returns
Promise<void>
fetch()
fetch(request): Promise<Response>;Defined in: packages/playerthree/src/mcp/server.ts:79
Web-standard face.
Parameters
| Parameter | Type |
|---|---|
request | Request |
Returns
Promise<Response>
MountMcpOptions
Defined in: packages/playerthree/src/mcp/server.ts:1006
playerthree/mcp: the remote MCP binding (Streamable HTTP endpoint), its tool surface, observation paging and the OAuth 2.1 authorization server.
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
allowedOrigins? | readonly string[] | Exact Origin values allowed to call the endpoint (DNS-rebinding protection). Requests carrying any other Origin are rejected with 403. Non-browser MCP clients send no Origin. Default: none. | McpOptions.allowedOrigins | packages/playerthree/src/mcp/server.ts:61 |
auth? | AuthorizationServer | The OAuth authorization server (createAuthorizationServer): its access tokens authenticate OAuth connections (one named commander + compatible role grants), and 401s carry its challenge. Seat/commander tokens keep working next to it. | McpOptions.auth | packages/playerthree/src/mcp/server.ts:67 |
onConsent? | (event) => void | Observe consent decisions (e.g. to log them or show them in the owner's UI). | McpOptions.onConsent | packages/playerthree/src/mcp/server.ts:69 |
onError? | (error) => void | Out-of-band errors (SDK errors, internal failures). Never forwarded to agents. | McpOptions.onError | packages/playerthree/src/mcp/server.ts:71 |
path? | string | Default /mcp. Matched exactly against the request pathname. | - | packages/playerthree/src/mcp/server.ts:1008 |
OAuthClientInfo
Defined in: packages/playerthree/src/mcp/oauth/store.ts:13
Client metadata as the authorization server validated it. Self-asserted for dcr; cimd is served by id's host.
Extended by
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
id | string | The OAuth client_id: the metadata document URL (cimd) or the id this server issued (dcr). | packages/playerthree/src/mcp/oauth/store.ts:15 |
logoUri? | string | - | packages/playerthree/src/mcp/oauth/store.ts:20 |
name | string | client_name, control characters removed, at most 100 characters. | packages/playerthree/src/mcp/oauth/store.ts:18 |
registration | ClientRegistration | - | packages/playerthree/src/mcp/oauth/store.ts:16 |
softwareId? | string | - | packages/playerthree/src/mcp/oauth/store.ts:21 |
softwareVersion? | string | - | packages/playerthree/src/mcp/oauth/store.ts:22 |
uri? | string | - | packages/playerthree/src/mcp/oauth/store.ts:19 |
OAuthGrant
Defined in: packages/playerthree/src/mcp/oauth/server.ts:143
An authenticated OAuth access token, as the MCP binding uses it. Everything is read live.
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
commander | readonly | string | packages/playerthree/src/mcp/oauth/server.ts:146 |
connection | readonly | string | packages/playerthree/src/mcp/oauth/server.ts:144 |
owner | readonly | string | packages/playerthree/src/mcp/oauth/server.ts:145 |
Methods
activity()
activity(delta): void;Defined in: packages/playerthree/src/mcp/oauth/server.ts:152
Marks activity; +1/-1 around calls in flight.
Parameters
| Parameter | Type |
|---|---|
delta | -1 | 0 | 1 |
Returns
void
holds()
holds(role): boolean;Defined in: packages/playerthree/src/mcp/oauth/server.ts:150
The connection still exists and holds role.
Parameters
| Parameter | Type |
|---|---|
role | string |
Returns
boolean
roles()
roles(): readonly string[];Defined in: packages/playerthree/src/mcp/oauth/server.ts:148
Current roles (edits apply to the next call).
Returns
readonly string[]
ObservationPage
Defined in: packages/playerthree/src/mcp/paging.ts:10
One page: a partial observation, plus [from, to) item ranges (of of) of the lists it holds only part of.
Properties
| Property | Type | Defined in |
|---|---|---|
items? | Record<string, { from: number; of: number; to: number; }> | packages/playerthree/src/mcp/paging.ts:12 |
observation | Record<string, unknown> | packages/playerthree/src/mcp/paging.ts:11 |
OwnedConnectionStatus
Defined in: packages/playerthree/src/mcp/oauth/server.ts:115
A connection with its owner, as the operator console lists them across owners.
Extends
Properties
| Property | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|
active | boolean | A call in the last 30 s, or a call in flight (e.g. blocked in game_wait). | ConnectionStatus.active | packages/playerthree/src/mcp/oauth/server.ts:111 |
authorizedAt | number | Last consent (sign-in) for this connection: a repeat sign-in from the same client updates it. | ConnectionStatus.authorizedAt | packages/playerthree/src/mcp/oauth/server.ts:108 |
client | OAuthClientInfo | - | ConnectionStatus.client | packages/playerthree/src/mcp/oauth/server.ts:104 |
commander | string | - | ConnectionStatus.commander | packages/playerthree/src/mcp/oauth/server.ts:103 |
createdAt | number | - | ConnectionStatus.createdAt | packages/playerthree/src/mcp/oauth/server.ts:106 |
id | string | - | ConnectionStatus.id | packages/playerthree/src/mcp/oauth/server.ts:102 |
lastSeenAt | number | null | - | ConnectionStatus.lastSeenAt | packages/playerthree/src/mcp/oauth/server.ts:109 |
owner | string | - | - | packages/playerthree/src/mcp/oauth/server.ts:116 |
roles | string[] | - | ConnectionStatus.roles | packages/playerthree/src/mcp/oauth/server.ts:105 |
StoredClient
Defined in: packages/playerthree/src/mcp/oauth/store.ts:58
A client registered through POST /oauth/register (RFC 7591).
Extends
Properties
StoredConnection
Defined in: packages/playerthree/src/mcp/oauth/store.ts:32
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
access | StoredTokenDigest[] | Live access tokens (newest last). | packages/playerthree/src/mcp/oauth/store.ts:54 |
authorizedAt | number | Last consent for this exact named commander connection. | packages/playerthree/src/mcp/oauth/store.ts:47 |
client | OAuthClientInfo | - | packages/playerthree/src/mcp/oauth/store.ts:37 |
commander | string | Exact named commander selected on the authenticated consent page. | packages/playerthree/src/mcp/oauth/store.ts:39 |
createdAt | number | - | packages/playerthree/src/mcp/oauth/store.ts:45 |
id | string | con_ + 16 base64url characters. | packages/playerthree/src/mcp/oauth/store.ts:34 |
lastSeenAt | number | null | - | packages/playerthree/src/mcp/oauth/store.ts:48 |
owner | string | The game's owner id (OWNER_RE): the player who approved the connection. | packages/playerthree/src/mcp/oauth/store.ts:36 |
refresh | StoredTokenDigest | The current refresh token. | packages/playerthree/src/mcp/oauth/store.ts:50 |
resource | string | The resource (MCP endpoint URL) the tokens are bound to. | packages/playerthree/src/mcp/oauth/store.ts:43 |
retired | string[] | Rotated-away refresh tokens: presenting one again revokes the connection (refresh token reuse). | packages/playerthree/src/mcp/oauth/store.ts:52 |
roles | string[] | Granted subset of that commander's compatible manifest roles. | packages/playerthree/src/mcp/oauth/store.ts:41 |
scope | string | - | packages/playerthree/src/mcp/oauth/store.ts:44 |
StoredTokenDigest
Defined in: packages/playerthree/src/mcp/oauth/store.ts:25
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
digest | string | SHA-256 hex of the token. | packages/playerthree/src/mcp/oauth/store.ts:27 |
expiresAt | number | ms since epoch | packages/playerthree/src/mcp/oauth/store.ts:29 |
ToolAnnotationsSpec
Defined in: packages/playerthree/src/mcp/surface.ts:15
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
destructiveHint? | readonly | boolean | packages/playerthree/src/mcp/surface.ts:17 |
idempotentHint | readonly | boolean | packages/playerthree/src/mcp/surface.ts:18 |
openWorldHint | readonly | false | packages/playerthree/src/mcp/surface.ts:19 |
readOnlyHint | readonly | boolean | packages/playerthree/src/mcp/surface.ts:16 |
ToolSpec
Defined in: packages/playerthree/src/mcp/surface.ts:22
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
annotations | readonly | ToolAnnotationsSpec | - | packages/playerthree/src/mcp/surface.ts:30 |
description | readonly | string | Static PlayerThree text plus developer-declared numbers/identifiers from the manifest. | packages/playerthree/src/mcp/surface.ts:27 |
inputSchema | readonly | JsonSchema | - | packages/playerthree/src/mcp/surface.ts:28 |
method | readonly | "usage" | keyof SeatControl | - | packages/playerthree/src/mcp/surface.ts:24 |
name | readonly | string | - | packages/playerthree/src/mcp/surface.ts:23 |
outputSchema | readonly | JsonSchema | - | packages/playerthree/src/mcp/surface.ts:29 |
title | readonly | string | - | packages/playerthree/src/mcp/surface.ts:25 |
Type Aliases
CimdErrorCode
type CimdErrorCode =
| "invalid_client_id"
| "blocked_address"
| "redirect"
| "status"
| "bad_content_type"
| "too_large"
| "timeout"
| "network"
| "bad_document";Defined in: packages/playerthree/src/mcp/oauth/cimd.ts:26
CimdResult
type CimdResult =
| {
document: ClientDocument;
maxAgeMs: number;
ok: true;
}
| {
code: CimdErrorCode;
ok: false;
};Defined in: packages/playerthree/src/mcp/oauth/cimd.ts:42
ClientRegistration
type ClientRegistration = "cimd" | "dcr";Defined in: packages/playerthree/src/mcp/oauth/store.ts:10
How the client identified itself: a Client ID Metadata Document URL, or Dynamic Client Registration.
ToolErrorCode
type ToolErrorCode = ServerErrorCode | "consent_declined";Defined in: packages/playerthree/src/mcp/meta.ts:8
Closed set of tool-level error codes ({"error": code} in an isError result).
Variables
LIMITS
const LIMITS: object;Defined in: packages/playerthree/src/mcp/surface.ts:51
Limits shared with the host's own argument validation.
Type Declaration
| Name | Type | Default value | Description | Defined in |
|---|---|---|---|---|
maxIntentsPerCall | 64 | 64 | - | packages/playerthree/src/mcp/surface.ts:52 |
maxOffset | number | - | game_skill offsets (UTF-16 code units). | packages/playerthree/src/mcp/surface.ts:62 |
maxPage | 10000 | 10_000 | Topic and observation page numbers. | packages/playerthree/src/mcp/surface.ts:59 |
maxSeed | number | - | - | packages/playerthree/src/mcp/surface.ts:57 |
maxTick | number | - | - | packages/playerthree/src/mcp/surface.ts:55 |
maxTopicChars | 128 | 128 | - | packages/playerthree/src/mcp/surface.ts:60 |
maxUntilKinds | 16 | 16 | - | packages/playerthree/src/mcp/surface.ts:54 |
maxVersion | number | - | - | packages/playerthree/src/mcp/surface.ts:56 |
maxWaitSeconds | 60 | 60 | - | packages/playerthree/src/mcp/surface.ts:53 |
OAUTH_SCOPE
const OAUTH_SCOPE: "play" = 'play';Defined in: packages/playerthree/src/mcp/oauth/server.ts:41
The one scope this server grants: play the roles the owner picked on the consent page.
SURFACE_HASH_META
const SURFACE_HASH_META: "dev.playerthree/surfaceHash" = 'dev.playerthree/surfaceHash';Defined in: packages/playerthree/src/mcp/meta.ts:5
_meta key carrying the surfaceHash on tools/list and every tools/call result (clients pin it).
TOOL_ORDER
const TOOL_ORDER: readonly ControlMethod[];Defined in: packages/playerthree/src/mcp/surface.ts:34
Deterministic tool order.
Functions
addressAllowed()
function addressAllowed(address, allowLoopback?): boolean;Defined in: packages/playerthree/src/mcp/oauth/cimd.ts:107
A resolved address the server may connect to.
Parameters
| Parameter | Type | Default value |
|---|---|---|
address | string | undefined |
allowLoopback? | boolean | false |
Returns
boolean
createAuthorizationServer()
function createAuthorizationServer<M>(typedHost, opts): AuthorizationServer;Defined in: packages/playerthree/src/mcp/oauth/server.ts:273
The OAuth 2.1 authorization server for typedHost's MCP endpoint (see the module comment for its routes).
Type Parameters
| Type Parameter |
|---|
M extends AnyManifest |
Parameters
| Parameter | Type |
|---|---|
typedHost | PlayerThreeHost<M> |
opts | AuthorizationServerOptions |
Returns
createMcpRequestHandler()
function createMcpRequestHandler<M>(typedHost, opts?): McpRequestHandler;Defined in: packages/playerthree/src/mcp/server.ts:329
The remote MCP endpoint for typedHost, unmounted; mountMcp wires it (and the authorization server) into a node:http server.
Type Parameters
| Type Parameter |
|---|
M extends AnyManifest |
Parameters
| Parameter | Type |
|---|---|
typedHost | PlayerThreeHost<M> |
opts? | McpOptions |
Returns
fetchClientDocument()
function fetchClientDocument(clientId, opts?): Promise<CimdResult>;Defined in: packages/playerthree/src/mcp/oauth/cimd.ts:249
Fetches and validates the metadata document a URL-formatted client_id points to.
Parameters
| Parameter | Type |
|---|---|
clientId | string |
opts? | CimdOptions |
Returns
Promise<CimdResult>
jsonConnectionStore()
function jsonConnectionStore(dir): ConnectionStore;Defined in: packages/playerthree/src/mcp/oauth/store.ts:102
<dir>/connections.json, written atomically (temp file + rename) with mode 0600.
Parameters
| Parameter | Type |
|---|---|
dir | string |
Returns
memoryConnectionStore()
function memoryConnectionStore(): ConnectionStore;Defined in: packages/playerthree/src/mcp/oauth/store.ts:81
In-memory connection store (the default): connections and registered clients are lost on restart.
Returns
mergeObservationPages()
function mergeObservationPages(pages): Record<string, unknown>;Defined in: packages/playerthree/src/mcp/paging.ts:102
Reassemble a full observation from all its pages, in page order (inverse of pageObservation).
Parameters
| Parameter | Type |
|---|---|
pages | readonly object[] |
Returns
Record<string, unknown>
methodEnabled()
function methodEnabled(manifest, method): boolean;Defined in: packages/playerthree/src/mcp/surface.ts:98
Whether the manifest enables the mode that gates a control method.
Parameters
| Parameter | Type |
|---|---|
manifest | AnyManifest |
method | keyof SeatControl |
Returns
boolean
mountMcp()
function mountMcp<M>(
httpServer,
host,
opts?
): object;Defined in: packages/playerthree/src/mcp/server.ts:1016
Serve MCP on an existing node:http server: requests whose pathname equals path — and, with auth, the
authorization server's paths (/.well-known/oauth-*, /oauth/*) — are handled here and never reach the
server's other request listeners (regardless of registration order); everything else passes through.
Type Parameters
| Type Parameter |
|---|
M extends AnyManifest |
Parameters
| Parameter | Type |
|---|---|
httpServer | Server |
host | PlayerThreeHost<M> |
opts? | MountMcpOptions |
Returns
object
| Name | Type | Defined in |
|---|---|---|
handler | McpRequestHandler | packages/playerthree/src/mcp/server.ts:1020 |
close() | () => Promise<void> | packages/playerthree/src/mcp/server.ts:1020 |
pageObservation()
function pageObservation(
observation,
schema,
budget
): ObservationPage[];Defined in: packages/playerthree/src/mcp/paging.ts:71
Pages of observation whose JSON each fits budget code units (except an indivisible item larger than the budget).
One page when it already fits.
Parameters
| Parameter | Type |
|---|---|
observation | unknown |
schema | JsonSchema |
budget | number |
Returns
redirectMatches()
function redirectMatches(registered, given): boolean;Defined in: packages/playerthree/src/mcp/oauth/cimd.ts:165
Exact string match, except that a registered plain-http loopback redirect URI matches any port on the same loopback host with the same path and query (RFC 8252 §7.3: native apps listen on an ephemeral port).
Parameters
| Parameter | Type |
|---|---|
registered | string |
given | string |
Returns
boolean
serverInstructions()
function serverInstructions(manifest, hash): string;Defined in: packages/playerthree/src/mcp/server.ts:215
Static server instructions. Only PlayerThree text and developer-declared manifest data.
Parameters
| Parameter | Type |
|---|---|
manifest | AnyManifest |
hash | string |
Returns
string
toolSurface()
function toolSurface(manifest, skills): ToolSpec[];Defined in: packages/playerthree/src/mcp/surface.ts:298
The tool surface for a game. skills must be every skill the server serves
(developer skills, generated reference and SDK defaults) — game_skill's name enum comes from it.
Parameters
| Parameter | Type |
|---|---|
manifest | AnyManifest |
skills | readonly SkillDef[] |
Returns
ToolSpec[]
