api-platform-mcp
Skill2 starsChanged 6 months agoMITView on GitHub
Expose API Platform 4.3 operations as Model Context Protocol tools for AI agents (Claude, ChatGPT, etc.) via the new `api-platform/mcp` + `symfony/mcp-bundle` components — marked `@experimental` upstream. Covers `#[McpTool]` standalone (`name`, `description`, `processor`, optional `validate: true`), the `mcp:` keyword on `#[ApiResource]` (with `operations: []` to disable HTTP routes and expose only as MCP), `McpToolCollection` with `structuredContent: true` for Hydra-aware responses, the `mcp.yaml` configuration (http/stdio transports, session store), JSON Schema override via `#[ApiProperty(schema: …)]` for LLMs that reject union types, and the safety guardrails (pin the version, restrict tools — no destructive Delete without confirmation, audit log, dedicated rate limit on `/mcp`). Trigger on "MCP", "expose API to AI agent", "model context protocol", or "give my Claude tool access to the API".
In this repository52 other files it gives its agents.
- api-platform-dto-resourcesSkill
- api-platform-errorsSkill
- api-platform-file-uploadSkill
- api-platform-filtersSkill
- api-platform-identifiersSkill
- api-platform-mutatorsSkill
- api-platform-openapiSkill
- api-platform-paginationSkill
- api-platform-performanceSkill
- api-platform-resilienceSkill
- api-platform-resourcesSkill
- api-platform-securitySkill
- api-platform-serializationSkill
- api-platform-state-processorsSkill
- api-platform-state-providersSkill
- api-platform-testsSkill
- api-platform-upgradeSkill
- api-platform-userSkill
- api-platform-versioningSkill
- bootstrap-checkSkill
- brainstormingSkill
- config-env-parametersSkill
- controller-cleanupSkill
- cqrs-and-handlersSkill
- daily-workflowSkill
- doctrine-batch-processingSkill
- doctrine-fetch-modesSkill
- doctrine-fixtures-foundrySkill
- doctrine-migrationsSkill
- doctrine-relationsSkill
- doctrine-transactionsSkill
- effective-contextSkill
- executing-plansSkill
- functional-testsSkill
- interfaces-and-autowiringSkill
- makefile-disciplineSkill
- messenger-retry-failuresSkill
- ports-and-adaptersSkill
- quality-checksSkill
- rate-limitingSkill
- runner-selectionSkill
- strategy-patternSkill
- symfony-cacheSkill
- symfony-messengerSkill
- symfony-schedulerSkill
- symfony-votersSkill
- tdd-with-pestSkill
- tdd-with-phpunitSkill
- test-doubles-mockingSkill
- using-symfony-superpowersSkill
- value-objects-and-dtosSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Add audit logging + dedicated rate limiting on /mcp.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Platform 4.3 — MCP (Model Context Protocol) — @experimental
Use when
- An AI agent (Claude, ChatGPT, Cursor, …) needs to call the API as a tool.
- Specific operations should be exposed only to agents (no HTTP route).
- The agent should consume Hydra-aware structured content for better context.
Default workflow
- Install
api-platform/mcp+symfony/mcp-bundlewith a pinned exact version (composer require api-platform/mcp:4.3.x). - Configure
mcp.yaml(transports, session store) and enable inapi_platform.yaml. - Define tools — either standalone with
#[McpTool], or on existing resources via themcp:keyword. - For collections, use
McpToolCollection(structuredContent: true). - Enable validation explicitly (
validate: true) on tools that mutate state. - Add audit logging + dedicated rate limiting on
/mcp.
Guardrails
@experimental: the API surface may change between minor releases. Pin the exact version.- Restricted tool set: expose only tools that are safe for an agent. No Delete without explicit confirmation flow.
- Schema strict: explicitly declare input schemas via
#[ApiProperty(schema: ...)]for LLMs that reject union types. - Audit log: trace every MCP call (who, what, when) — an AI agent is not a human user.
- Rate limiting: a dedicated limiter on
/mcp(cf.gerard:rate-limiting). - No PII leakage: review every tool's response payload — assume the AI may use it in a prompt that goes to a third party.
Progressive disclosure
SKILL.mdcovers posture and rules.reference.mdcarries the full install, configuration, both declaration patterns (#[McpTool]standalone andmcp:on#[ApiResource]),McpToolCollection, validation, schema override, and bonnes pratiques.
Output contract
- A pinned
api-platform/mcpversion. - Tools declared with
#[McpTool]and / or viamcp:on resources. - Schemas overridden where needed for LLM compatibility.
- Audit logging configured for
/mcp. - Dedicated rate limit on the
/mcpendpoint.
References
reference.md- Upstream: https://api-platform.com/docs/core/mcp/
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

