npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

payload-plugin-mcp-granular

v0.1.3

Published

A field-granular MCP plugin for Payload CMS based on the official plugin-mcp package

Readme

Payload MCP Granular Plugin

A plugin for Payload that derives from the official @payloadcms/plugin-mcp package and adds field-level granularity for collection find, create, and update operations.

What It Adds

  • Backward-compatible support for the official enabled: true and enabled: { ... } MCP config
  • New granularity config for collections
  • API key UI that lets admins choose which top-level fields each MCP key can find, create, and update
  • MCP tool schemas filtered down to only the allowed fields for the current API key
  • Runtime field access wrappers so non-allowed fields are discarded on writes and omitted on reads during MCP traffic

Requirements

  • Payload ^3.80.0
  • A project already using or ready to use Payload's MCP plugin model

Installation

pnpm add payload-plugin-mcp-granular

Quick Start

import { buildConfig } from 'payload'
import { mcpPlugin } from 'payload-plugin-mcp-granular'

export default buildConfig({
  collections: [
    {
      slug: 'students',
      fields: [
        { name: 'name', type: 'text' },
        { name: 'email', type: 'email' },
        { name: 'notes', type: 'textarea' },
      ],
    },
  ],
  plugins: [
    mcpPlugin({
      collections: {
        students: {
          enabled: {
            find: true,
            update: true,
          },
          granularity: {
            find: true,
            update: true,
          },
        },
      },
    }),
  ],
})

With the config above, the admin UI for each MCP API key will expose find / update toggles for students, and once enabled it will reveal field checkboxes such as name, email, and notes.

Granularity Config

You can enable granular field control in two ways.

Apply it to all enabled field-based operations:

collections: {
  students: {
    enabled: {
      find: true,
      create: true,
      update: true,
      delete: true,
    },
    granularity: true,
  },
}

Or apply it per operation:

collections: {
  students: {
    enabled: {
      find: true,
      update: true,
    },
    granularity: {
      find: true,
      update: true,
    },
  },
}

How API Key Permissions Work

There are still two layers of access, just like the official plugin:

  1. Enable the collection and operations in your Payload config.
  2. Create an MCP API key in the admin panel and allow the exact operations for that key.

When granularity is enabled for a collection operation:

  • Turning on find, create, or update for that collection reveals a second group of field checkboxes
  • Each checkbox represents one top-level field from the collection
  • Only the checked fields are exposed in the MCP tool schema for create / update
  • Only the checked fields are allowed at runtime for MCP traffic

Behavior Notes

  • Granularity is currently supported for collections only
  • Granularity is top-level only in v1
  • delete remains collection-level only
  • Globals keep the upstream plugin behavior
  • If an operation is enabled for a key but no fields are selected, that granular MCP tool is treated as disabled for that key
  • Non-MCP traffic is not affected

Example Behavior

If you configure:

collections: {
  students: {
    enabled: {
      find: true,
      update: true,
    },
    granularity: {
      find: true,
      update: true,
    },
  },
}

And in the API key UI you allow:

  • students.update = true
  • students.updateFields.name = true
  • students.find = true
  • students.findFields.name = true

Then:

  • the MCP client can update the name field
  • the MCP client cannot update email, notes, or other top-level fields
  • findStudents responses only expose name plus normal system metadata such as id

Local Development

Build the package:

pnpm install
pnpm build

Create a tarball to test in another Payload app:

npm pack

Related Links