211 lines
4.8 KiB
Markdown
211 lines
4.8 KiB
Markdown
# mcp
|
|
|
|
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
|
|
|
## `mcp.consumeAuthCode`
|
|
|
|
*Source: `src/store/mcp/consumeAuthCode.js`*
|
|
|
|
Marks an authorization code as used.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `code` | `string` | The authorization code to mark used. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<boolean>` — True once marked.
|
|
|
|
## `mcp.createAuthCode`
|
|
|
|
*Source: `src/store/mcp/createAuthCode.js`*
|
|
|
|
Stores an OAuth 2.1 authorization code with PKCE parameters.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.code` | `string` | The generated authorization code. |
|
|
| `input.clientId` | `string` | The client ID. |
|
|
| `input.googleAuthId` | `number` | The ID of the authenticated user. |
|
|
| `input.redirectUri` | `string` | The redirect URI used in the authorize request. |
|
|
| `input.codeChallenge` | `string` | The PKCE code challenge. |
|
|
| `input.codeChallengeMethod` | `string` | The PKCE method (e.g. S256). |
|
|
| `[input.scope]` | `string|null` | Granted scope. |
|
|
| `input.expiresAt` | `string|Date` | Expiration ISO string or Date. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<string>` — The authorization code.
|
|
|
|
## `mcp.createRefreshToken`
|
|
|
|
*Source: `src/store/mcp/createRefreshToken.js`*
|
|
|
|
Stores an OAuth 2.1 refresh token.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.refreshToken` | `string` | The refresh token string. |
|
|
| `input.clientId` | `string` | The client ID. |
|
|
| `input.googleAuthId` | `number` | The user ID. |
|
|
| `[input.scope]` | `string|null` | Scopes granted. |
|
|
| `input.expiresAt` | `string|Date` | Expiration Date or ISO string. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<object>` — Created token record or id.
|
|
|
|
## `mcp.deleteClient`
|
|
|
|
*Source: `src/store/mcp/deleteClient.js`*
|
|
|
|
Deletes a registered MCP client by client ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `clientId` | `string` | The client identifier to delete. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<boolean>` — True if deleted.
|
|
|
|
## `mcp.getAuthCode`
|
|
|
|
*Source: `src/store/mcp/getAuthCode.js`*
|
|
|
|
Retrieves an authorization code record.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `code` | `string` | The authorization code. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<object|null>` — The auth code record or null.
|
|
|
|
## `mcp.getClient`
|
|
|
|
*Source: `src/store/mcp/getClient.js`*
|
|
|
|
Retrieves an MCP client by client ID.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `clientId` | `string` | The client identifier. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<object|null>` — The client record or null if not found.
|
|
|
|
## `mcp.getRefreshToken`
|
|
|
|
*Source: `src/store/mcp/getRefreshToken.js`*
|
|
|
|
Retrieves an OAuth 2.1 refresh token.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `refreshToken` | `string` | The refresh token. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<object|null>` — The refresh token record or null.
|
|
|
|
## `mcp.listAuthorizations`
|
|
|
|
*Source: `src/store/mcp/listAuthorizations.js`*
|
|
|
|
Lists active authorizations for a Google Auth user.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The user ID. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<object>>` — List of authorized clients and token counts.
|
|
|
|
## `mcp.listClients`
|
|
|
|
*Source: `src/store/mcp/listClients.js`*
|
|
|
|
Lists all registered MCP clients.
|
|
|
|
**Returns**
|
|
|
|
`Promise<Array<object>>` — List of client records.
|
|
|
|
## `mcp.registerClient`
|
|
|
|
*Source: `src/store/mcp/registerClient.js`*
|
|
|
|
Registers a new OAuth MCP client.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `input` | `object` | |
|
|
| `input.clientId` | `string` | Unique client identifier. |
|
|
| `[input.clientSecret]` | `string|null` | Optional client secret for confidential clients. |
|
|
| `input.clientName` | `string` | Human-readable client name. |
|
|
| `input.redirectUris` | `string|Array<string>` | JSON string or array of redirect URIs. |
|
|
| `[input.grantTypes]` | `string|Array<string>` | Supported grant types. |
|
|
| `[input.responseTypes]` | `string|Array<string>` | Supported response types. |
|
|
| `[input.scope]` | `string|null` | Allowed scope. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<object>` — The created client record.
|
|
|
|
## `mcp.revokeAuthorizations`
|
|
|
|
*Source: `src/store/mcp/revokeAuthorizations.js`*
|
|
|
|
Revokes all active authorizations (tokens) for a user and MCP client.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `googleAuthId` | `number` | The user ID. |
|
|
| `clientId` | `string` | The MCP client ID. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<boolean>` — True once revoked.
|
|
|
|
## `mcp.revokeRefreshToken`
|
|
|
|
*Source: `src/store/mcp/revokeRefreshToken.js`*
|
|
|
|
Revokes an OAuth 2.1 refresh token.
|
|
|
|
**Parameters**
|
|
|
|
| Name | Type | Description |
|
|
| --- | --- | --- |
|
|
| `refreshToken` | `string` | The refresh token to revoke. |
|
|
|
|
**Returns**
|
|
|
|
`Promise<boolean>` — True once revoked.
|