mirror of
https://github.com/payloadcms/payload.git
synced 2026-09-14 20:07:19 +08:00
73a18dc088
- Adds `overrideAuth` to the MCP Plugin.
- Adds `MCPAccessSettings` as an exported type from the mcpPlugin
```ts
import { type MCPAccessSettings, mcpPlugin } from '@payloadcms/plugin-mcp'
// ... other config
plugins: [
mcpPlugin({
// ... other plugin config
overrideAuth: (req) => {
const { payload } = req
payload.logger.info('[Override MCP auth]:')
return {
posts: {
find: true,
},
products: {
find: true,
update: true,
},
} as MCPAccessSettings
},
})
]
```
### Custom Auth Behaviors
The bypassed system uses an API Key that contains `MCPAccessSettings`
information. The `overrideAuth` function will bypass the API Key system
and use your function when authorizing requests.
This means that your function must return a valid `MCPAccessSettings`
object to use.
27 lines
1.5 KiB
TypeScript
27 lines
1.5 KiB
TypeScript
export { APIError, APIErrorName } from './APIError.js'
|
|
export { AuthenticationError } from './AuthenticationError.js'
|
|
export { DuplicateCollection } from './DuplicateCollection.js'
|
|
export { DuplicateFieldName } from './DuplicateFieldName.js'
|
|
export { DuplicateGlobal } from './DuplicateGlobal.js'
|
|
export { ErrorDeletingFile } from './ErrorDeletingFile.js'
|
|
export { FileRetrievalError } from './FileRetrievalError.js'
|
|
export { FileUploadError } from './FileUploadError.js'
|
|
export { Forbidden } from './Forbidden.js'
|
|
export { InvalidConfiguration } from './InvalidConfiguration.js'
|
|
export { InvalidFieldName } from './InvalidFieldName.js'
|
|
export { InvalidFieldRelationship } from './InvalidFieldRelationship.js'
|
|
export { Locked } from './Locked.js'
|
|
export { LockedAuth } from './LockedAuth.js'
|
|
export { MissingCollectionLabel } from './MissingCollectionLabel.js'
|
|
export { MissingEditorProp } from './MissingEditorProp.js'
|
|
export { MissingFieldInputOptions } from './MissingFieldInputOptions.js'
|
|
export { MissingFieldType } from './MissingFieldType.js'
|
|
export { MissingFile } from './MissingFile.js'
|
|
export { NotFound } from './NotFound.js'
|
|
export { QueryError } from './QueryError.js'
|
|
export { ReservedFieldName } from './ReservedFieldName.js'
|
|
export { UnauthorizedError } from './UnauthorizedError.js'
|
|
export { UnverifiedEmail } from './UnverifiedEmail.js'
|
|
export { ValidationError, ValidationErrorName } from './ValidationError.js'
|
|
export type { ValidationFieldError } from './ValidationError.js'
|