# 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` — 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` — 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` — 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` — 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` — 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` — 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` — The refresh token record or null. ## `mcp.listClients` *Source: `src/store/mcp/listClients.js`* Lists all registered MCP clients. **Returns** `Promise>` — 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` | JSON string or array of redirect URIs. | | `[input.grantTypes]` | `string|Array` | Supported grant types. | | `[input.responseTypes]` | `string|Array` | Supported response types. | | `[input.scope]` | `string|null` | Allowed scope. | **Returns** `Promise` — The created client record. ## `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` — True once revoked.