devkit-for-strapi-mcp

v0.2.5
io.github.PaulRichez/devkit-for-strapi-mcp Checked 38 minutes ago Published 20 days ago

Strapi 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`.

ParameterTypeDescription
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
path *stringAbsolute 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'.

ParameterTypeDescription
coldbooleanAlso 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.

ParameterTypeDescription
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
kindstringOnly this kind (default: all four).
projectstringA 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.

ParameterTypeDescription
allPluginsbooleanEvery installed plugin type, not only those linked to (default false).
componentsbooleanInclude components (default false).
focusarrayOnly these UIDs and the types they link to.
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
hideCustomFieldsLeave out custom fields: true for all, or their names (listed under `customFields` in the answer). Default: none.
mediabooleanMedia fields → the upload plugin's File (default true).
projectstringA project name or root, when no path is at hand.
strapiFieldsbooleanThe 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.

ParameterTypeDescription
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA project name or root, when no path is at hand.
uidstringA content-type or component UID.
uidsarraySeveral 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).

ParameterTypeDescription
ref *stringA 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:…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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).

ParameterTypeDescription
ref *stringA 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:…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
kindstringCheck it as this kind only (`method`: the service/controller a handler or method call goes through).
projectstringA 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.

ParameterTypeDescription
compactbooleanOne line per hit (default true); false for full objects.
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
limitintegerMax references per ref (default 50).
offsetintegerSkip this many (pagination).
projectstringA project name or root, when no path is at hand.
refstringA 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:…
refsarraySeveral 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.

ParameterTypeDescription
adminbooleanInclude admin-panel routes (default false).
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
handlerstringOnly handlers containing this (`api::article.article.find`).
methodstringOnly this HTTP method.
pathstringOnly routes matching this pattern, a part of it, or a concrete URL (`/api/articles/12`).
pipelinebooleanAdd each route's pipeline (needs method, path or handler; at most 20 routes).
pluginsbooleanInclude the plugins' routes (default true).
projectstringA 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.

ParameterTypeDescription
filestringOnly this file, absolute or relative to the project root (default: the whole app).
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
kindsarrayRestrict to certain kinds (default: all).
projectstringA 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.

ParameterTypeDescription
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
filesbooleanList every file with a readable name and status (default: counts).
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
keystringOne file's content, by `<type>.<name>` (user-role.public).
projectstringA 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`…

ParameterTypeDescription
envstringNODE_ENV for the run (default development).
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
keystringOne entry, `<type>.<name>`: every difference, and both sides when they fit.
projectstringA project name or root, when no path is at hand.
typestringOnly 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.

ParameterTypeDescription
envstringNODE_ENV for the run (default development).
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
keysarrayThe entries to export (default: every difference).
projectstringA 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…

ParameterTypeDescription
keys *arrayThe entries to import, `<type>.<name>`.
envstringNODE_ENV for the run (default development).
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA project name or root, when no path is at hand.
reexportbooleanExport 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.

ParameterTypeDescription
uid *stringA content-type UID, e.g. api::article.article
fieldstringA relation field name; omit for all relations.
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
pattern *stringGlob, e.g. plugin::billing.* or api::*
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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…

ParameterTypeDescription
ref *stringA 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:…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA project name or root, when no path is at hand.
transitivebooleanFollow the chain (default false).

dependents What uses a ref (incoming edges)

The refs that use `ref`: what would break if it moved or changed.

ParameterTypeDescription
ref *stringA 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:…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA project name or root, when no path is at hand.
transitivebooleanFollow 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`.

ParameterTypeDescription
method *stringThe current method name.
newName *stringThe new method name.
ref *stringThe service/controller ref (api::page.notifier).
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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`.

ParameterTypeDescription
newName *stringThe new last segment: item makes api::product.product api::product.item.
ref *stringThe UID or ref (api::product.product, shared.seo).
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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`.

ParameterTypeDescription
ref *stringAn artifact ref (plugin::src.helper) or a content-type UID.
toNamespace *stringplugin::dst or api::foo.
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
refs *arrayThe refs to move together.
toNamespace *stringplugin::dst or api::foo.
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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`.

ParameterTypeDescription
name *stringPlugin name, kebab-case.
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
name *stringNew plugin name, kebab-case.
refs *arrayThe refs to move into it.
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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`.

ParameterTypeDescription
field *stringThe relation field.
newTarget *stringThe new target content-type UID.
uid *stringThe content-type UID.
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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`.

ParameterTypeDescription
newName *stringNew attribute name.
oldName *stringCurrent attribute name.
uid *stringThe content-type UID.
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
projectstringA 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.

ParameterTypeDescription
planId *stringThe 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.

ParameterTypeDescription
newName *stringThe new method name, or the UID's new last segment.
ref *stringA 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:…
configSyncbooleanWith 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'…
fromstringA path inside the project (the file you are editing; relative to its root with `project`), in a multi-project workspace.
methodstringThe method to rename; omit to rename the entity.
projectstringA project name or root, when no path is at hand.