devkit-for-strapi-mcp
v0.2.5Strapi codebase intelligence for AI agents (not content CRUD): real UIDs, schemas, refs, refactors.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
server_info DevKit version, licence tier and which tools actually run
The running DevKit server: its version (the one to name in a bug report), the licence tier, which tools really run (without a licence the Pro tools answer an upsell), the indexed roots and how current the index is (`freshness`).
list_projects List Strapi projects
List the Strapi projects discovered in the workspace (name, root, Strapi version, counts, `freshness`). Call this first in a multi-project workspace, then pass `from`/`project` to the other tools; project_info gives one project in full.
project_info Describe one Strapi project (and why a plugin ref may be unverified)
One project in full: Strapi version, TS or JS, package manager, API prefix, counts, every local and installed plugin with whether DevKit verifies refs into it (and if not, why), health and freshness. Call it to orient yourself, or when a plugin ref comes back `external`.
| Parameter | Type | Description |
|---|---|---|
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
add_project Register a Strapi project by path
Index a Strapi project from an ABSOLUTE path: its root or any file/folder inside it (a folder is also scanned downward, for monorepos). Use it when a tool returns `noProject`. Idempotent; returns the projects now known.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the Strapi project root, or to any file/folder inside it. |
refresh Re-index projects from disk (full rescan)
Rescan every project from disk and rebuild the index. Rarely needed: each call already re-indexes what changed on disk. For a project added since startup, or edits made outside on a project whose `freshness.diskTracking` is 'off'.
| Parameter | Type | Description |
|---|---|---|
cold | boolean | Also read every installed plugin again, ignoring the cache (slower; default false). |
list_content_types List content-types
List the real content-type UIDs (e.g. api::article.article) of a Strapi project. Use these exact UIDs — do not invent them.
| Parameter | Type | Description |
|---|---|---|
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
list_components List components
List the real component UIDs (e.g. shared.seo) of a Strapi project.
| Parameter | Type | Description |
|---|---|---|
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
list_artifacts List services/controllers/policies/middlewares
List the real refs of a project's services, controllers, policies and middlewares (optionally one kind). Use the exact refs returned.
| Parameter | Type | Description |
|---|---|---|
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
kind | string | Only this kind (default: all four). |
project | string | A project name or root, when no path is at hand. |
get_model_diagram Data model diagram (Mermaid)
The data model as a Mermaid `erDiagram`, read from the schemas: content-types (optionally components) with their fields, one line per association with its cardinalities, media and the plugin types they link to. For a README, a doc or an issue.
| Parameter | Type | Description |
|---|---|---|
allPlugins | boolean | Every installed plugin type, not only those linked to (default false). |
components | boolean | Include components (default false). |
focus | array | Only these UIDs and the types they link to. |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
hideCustomFields | Leave out custom fields: true for all, or their names (listed under `customFields` in the answer). Default: none. | |
media | boolean | Media fields → the upload plugin's File (default true). |
project | string | A project name or root, when no path is at hand. |
strapiFields | boolean | The fields Strapi adds: createdAt, updatedAt, publishedAt, createdBy/updatedBy (default false). |
get_schema Get a content-type / component schema
The real attributes (fields, relations, components) of a content-type or component: use it instead of guessing field names.
| Parameter | Type | Description |
|---|---|---|
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
uid | string | A content-type or component UID. |
uids | array | Several UIDs to fetch in one call. |
resolve Resolve a reference to its file(s)
The file(s) defining a Strapi ref, tagged by kind — installed plugins included (in node_modules).
| Parameter | Type | Description |
|---|---|---|
ref * | string | A Strapi ref: a content-type or component UID (api::article.article, shared.seo), a service/controller/policy/middleware ref (plugin::users-permissions.user, global::is-owner) or a route handler (api:… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
validate_reference Validate a Strapi reference
Call this before writing a magic string: is this Strapi ref real in the project, as Strapi registers names (an API file `hasAccess.js` is `has-access`)? valid | unknown (+ didYouMean) | external: in a plugin DevKit cannot verify (project_info says why).
| Parameter | Type | Description |
|---|---|---|
ref * | string | A Strapi ref: a content-type or component UID (api::article.article, shared.seo), a service/controller/policy/middleware ref (plugin::users-permissions.user, global::is-owner) or a route handler (api:… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
kind | string | Check it as this kind only (`method`: the service/controller a handler or method call goes through). |
project | string | A project name or root, when no path is at hand. |
find_references Find references to a Strapi entity
Every call-site of a ref (or `ref#method`) in the project's own code (src/, config/, database/migrations): the total, then a page of `path:line:col [via] snippet` lines (1-based). A UID written as a plain value counts as `[literal]`; `unresolvedCalls` are the Strapi calls whose UID DevKit cannot read, which may reach it too.
| Parameter | Type | Description |
|---|---|---|
compact | boolean | One line per hit (default true); false for full objects. |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
limit | integer | Max references per ref (default 50). |
offset | integer | Skip this many (pagination). |
project | string | A project name or root, when no path is at hand. |
ref | string | A Strapi ref: a content-type or component UID (api::article.article, shared.seo), a service/controller/policy/middleware ref (plugin::users-permissions.user, global::is-owner) or a route handler (api:… |
refs | array | Several refs at once. |
list_routes List HTTP routes
The HTTP route table — the project's routes, createCoreRouter's auto-CRUD and the plugins' (`origin`) — with method, mounted `fullPath`, handler, policies, middlewares, auth and where each is declared. With `pipeline: true`: what a request goes through, in Strapi's order, each step's status (`not-found-by-strapi`: Strapi throws at startup). Use it to explain a 401/403 or a startup error about a policy or middleware.
| Parameter | Type | Description |
|---|---|---|
admin | boolean | Include admin-panel routes (default false). |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
handler | string | Only handlers containing this (`api::article.article.find`). |
method | string | Only this HTTP method. |
path | string | Only routes matching this pattern, a part of it, or a concrete URL (`/api/articles/12`). |
pipeline | boolean | Add each route's pipeline (needs method, path or handler; at most 20 routes). |
plugins | boolean | Include the plugins' routes (default true). |
project | string | A project name or root, when no path is at hand. |
list_unused Find unused Strapi entities/methods
Definitions no Strapi ref reaches: methods, content-types, components, services, policies, middlewares. Only Strapi refs count, so a method called directly in TS still appears — verify before deleting. `onlyArchivedCallers`: only called by migrations Strapi never runs; `requiredByPath`: its file is loaded by path, so the module is used.
| Parameter | Type | Description |
|---|---|---|
file | string | Only this file, absolute or relative to the project root (default: the whole app). |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
kinds | array | Restrict to certain kinds (default: all). |
project | string | A project name or root, when no path is at hand. |
coverage List indexed call forms
The Strapi call forms DevKit indexes (`via` tag + example) and those it does not (`indexed: false`): whether find_references/list_unused can be trusted for a pattern.
list_broken_refs Find references that point at nothing
Magic strings that point at nothing (refs into plugins DevKit cannot verify are skipped). After apply_edits, it should return none.
| Parameter | Type | Description |
|---|---|---|
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
config_sync_status config-sync: its options and the files of its sync directory
strapi-plugin-config-sync, from the files only (no database): its version, its options and where each comes from (the warnings say which default exclusions a short `excludedConfig` drops), the sync directory and its files by status — `ok`, `excluded`, `invalid` (not JSON), or of a type not registered here.
| Parameter | Type | Description |
|---|---|---|
files | boolean | List every file with a readable name and status (default: counts). |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
key | string | One file's content, by `<type>.<name>` (user-role.public). |
project | string | A project name or root, when no path is at hand. |
config_sync_diff config-sync: the real diff between config/sync and the database
The diff config-sync's admin page shows, from the real plugin: each entry that differs between config/sync and the database (`different`, `only-in-db`, `only-in-sync-dir`, `invalid-file`: not JSON, empty or not an object), what differs in a few words, and its `likelyDirection` (import | export | unknown) from the file's git history. It includes what a Strapi start changes by itself: after changing a schema, a controller or a route, export those entries and commit them with the code. It loads the project's Strapi the way config-sync's CLI does, which writes to the database as a `strapi develop`…
| Parameter | Type | Description |
|---|---|---|
env | string | NODE_ENV for the run (default development). |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
key | string | One entry, `<type>.<name>`: every difference, and both sides when they fit. |
project | string | A project name or root, when no path is at hand. |
type | string | Only one type (`admin-role`, `user-role`, `core-store`…). |
config_sync_export config-sync: export entries from the database into config/sync
Write entries from the database into config/sync with the plugin's own export, in the exact form config-sync compares. Only entries that differ; one only in config/sync has its file deleted; an `invalid-file` is replaced only when named. Commit the files with the code that caused them. It loads the project's Strapi the way config-sync's CLI does, which writes to the database as a `strapi develop` start does (schema sync, migrations): a local development database only — a remote one, or a Strapi 4 database under Strapi 5 code, is refused first.
| Parameter | Type | Description |
|---|---|---|
env | string | NODE_ENV for the run (default development). |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
keys | array | The entries to export (default: every difference). |
project | string | A project name or root, when no path is at hand. |
config_sync_import config-sync: import entries from config/sync into the database
Apply config/sync entries to the database with the plugin's own import (a role, a content-manager view, a setting). `keys` is required, never everything; an entry only in the database is deleted from it; an `invalid-file` is never imported. The entries still different afterwards are exported back (`reexport`), so the diff converges. Refused with NODE_ENV=production. It loads the project's Strapi the way config-sync's CLI does, which writes to the database as a `strapi develop` start does (schema sync, migrations): a local development database only — a remote one, or a Strapi 4 database under…
| Parameter | Type | Description |
|---|---|---|
keys * | array | The entries to import, `<type>.<name>`. |
env | string | NODE_ENV for the run (default development). |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
reexport | boolean | Export back the entries still different afterwards (default true). |
find_relation_usages Find relation-field usages
Where a content-type's relation fields are used by name in queries (populate, filters, where), nested levels included. Before retargeting or removing a relation.
| Parameter | Type | Description |
|---|---|---|
uid * | string | A content-type UID, e.g. api::article.article |
field | string | A relation field name; omit for all relations. |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
list_refs List refs by glob
Refs matching a glob (`plugin::billing.*`, `api::*`, `*`; only `*` is special), each with the kinds it resolves to.
| Parameter | Type | Description |
|---|---|---|
pattern * | string | Glob, e.g. plugin::billing.* or api::* |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
dependencies What a ref uses (outgoing edges)
The refs `ref` uses: relations in its schema, services/controllers it calls…
| Parameter | Type | Description |
|---|---|---|
ref * | string | A Strapi ref: a content-type or component UID (api::article.article, shared.seo), a service/controller/policy/middleware ref (plugin::users-permissions.user, global::is-owner) or a route handler (api:… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
transitive | boolean | Follow the chain (default false). |
dependents What uses a ref (incoming edges)
The refs that use `ref`: what would break if it moved or changed.
| Parameter | Type | Description |
|---|---|---|
ref * | string | A Strapi ref: a content-type or component UID (api::article.article, shared.seo), a service/controller/policy/middleware ref (plugin::users-permissions.user, global::is-owner) or a route handler (api:… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
transitive | boolean | Follow the chain (default false). |
plan_rename_method Plan a service/controller method rename (dry-run)
Plan renaming a service/controller method: its declaration, every call-site and, for a controller, the route handlers. Writes nothing: review the plan, then `apply_edits` its `planId`.
| Parameter | Type | Description |
|---|---|---|
method * | string | The current method name. |
newName * | string | The new method name. |
ref * | string | The service/controller ref (api::page.notifier). |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
plan_rename_entity Plan an entity rename (dry-run)
Plan renaming a content-type, component, service, controller, policy or middleware: every call-site and route handler, and the files. The `warnings` list the UIDs Strapi also stores in the database, which the plan does not migrate. Writes nothing: review, then `apply_edits` its `planId`.
| Parameter | Type | Description |
|---|---|---|
newName * | string | The new last segment: item makes api::product.product api::product.item. |
ref * | string | The UID or ref (api::product.product, shared.seo). |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
plan_move Plan moving an artifact or content-type to another namespace (dry-run)
Plan moving a service/controller/policy/middleware, or a content-type with its whole resource (service, controller, routes; relation targets repointed), to another namespace: every call-site rewritten, the files relocated. Refused whole if unsafe. Writes nothing: review, then `apply_edits`.
| Parameter | Type | Description |
|---|---|---|
ref * | string | An artifact ref (plugin::src.helper) or a content-type UID. |
toNamespace * | string | plugin::dst or api::foo. |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
plan_move_entities Plan moving a set of artifacts/content-types to one namespace (dry-run)
plan_move for several refs to one namespace, in one plan, so the refs between them stay right. Refused whole if any is unsafe.
| Parameter | Type | Description |
|---|---|---|
refs * | array | The refs to move together. |
toNamespace * | string | plugin::dst or api::foo. |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
create_plugin Scaffold a new local plugin (dry-run)
Plan a new local plugin (package.json and a strapi-server.js that registers its folders) and its entry in `config/plugins` (else a warning says what to add). Writes nothing: review, then `apply_edits`.
| Parameter | Type | Description |
|---|---|---|
name * | string | Plugin name, kebab-case. |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
extract_to_plugin Extract artifacts into a new plugin (dry-run)
create_plugin and plan_move in one plan: a new local plugin, and these services/controllers/policies/middlewares moved into it. Refused whole if unsafe.
| Parameter | Type | Description |
|---|---|---|
name * | string | New plugin name, kebab-case. |
refs * | array | The refs to move into it. |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
plan_change_relation Plan retargeting a relation field (dry-run)
Plan changing the `target` of a content-type's relation field in schema.json. Refused if the field isn't a relation or the target is unknown; warns about a bidirectional relation's orphaned inverse. Writes nothing: review, then `apply_edits`.
| Parameter | Type | Description |
|---|---|---|
field * | string | The relation field. |
newTarget * | string | The new target content-type UID. |
uid * | string | The content-type UID. |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
plan_rename_attribute Plan a content-type attribute rename — schema + relation query-keys only (dry-run)
Plan renaming an attribute in schema.json and, for a relation, its populate/filters usages. NOT a complete field rename: object access (`entity.field`, `data: { field }`, destructuring) is not rewritten — the warnings say to review it by hand. Writes nothing: review, then `apply_edits`.
| Parameter | Type | Description |
|---|---|---|
newName * | string | New attribute name. |
oldName * | string | Current attribute name. |
uid * | string | The content-type UID. |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
project | string | A project name or root, when no path is at hand. |
apply_edits Apply a reviewed plan to disk (contractual)
⚠️ Writes files: applies exactly the reviewed plan (plan_*, create_plugin, extract_to_plugin) by its `planId`. If a file it touches changed since, nothing is written.
| Parameter | Type | Description |
|---|---|---|
planId * | string | The planId from a plan_* result. |
apply_rename Rename a Strapi entity or method (writes files)
⚠️ Writes files: plan_rename_* and apply_edits in one call, without review. Prefer those two to review first.
| Parameter | Type | Description |
|---|---|---|
newName * | string | The new method name, or the UID's new last segment. |
ref * | string | A Strapi ref: a content-type or component UID (api::article.article, shared.seo), a service/controller/policy/middleware ref (plugin::users-permissions.user, global::is-owner) or a route handler (api:… |
configSync | boolean | With config-sync: also update the config/sync files this refactor concerns (roles' permissions, content-manager views). Default: the user's setting, true unless turned off. false when config/sync isn'… |
from | string | A path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace. |
method | string | The method to rename; omit to rename the entity. |
project | string | A project name or root, when no path is at hand. |