laravel-agent-mcp
Copilot instructions4 starsChanged 5 months agoMITView on GitHub
anilcancakir/laravel-agent-mcp is a Laravel PACKAGE (not an application): a secure, read-only MCP server that exposes 25 read-only tools to LLM agents. PHP ^8.3 (CI runs 8.3, 8.4, 8.5), Laravel 12/13 via illuminate/contracts, built on laravel/mcp >=0.6 <0.10. Other runtime deps: phpmyadmin/sql-parser, spatie/laravel-package-tools. Tests run on Orchestra Testbench against in-memory SQLite; there is no app bootstrap or .env to run.
- Reads credentials
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,349 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this copilot-instructions.md into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Do not add declare(strict_types=1).
- Very specific: line 34
Read-only: there are no write tools and none may be added.
≈ “Common” is an estimate: at least 1 in 5 of the 3,779 Copilot instructions 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
<!-- Generated by ac:claude-md-rules-creator on 2026-05-31. Block-level HTML comment, stripped before injection: zero token cost for the model, visible to a human reader. -->CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Stack
anilcancakir/laravel-agent-mcp is a Laravel PACKAGE (not an application): a secure, read-only MCP server that exposes 25 read-only tools to LLM agents. PHP ^8.3 (CI runs 8.3, 8.4, 8.5), Laravel 12/13 via illuminate/contracts, built on laravel/mcp >=0.6 <0.10. Other runtime deps: phpmyadmin/sql-parser, spatie/laravel-package-tools. Tests run on Orchestra Testbench against in-memory SQLite; there is no app bootstrap or .env to run.
Commands
composer testruns the Pest suite;composer test-coverageenforces the 80% coverage gate.composer analyseruns PHPStan/Larastan at level 6 oversrcandtests.vendor/bin/pintfixes code style (Laravel preset);vendor/bin/pint --testchecks without writing.
Layout (non-obvious)
src/Tools/is the 25 MCP tools. Each extendsAbstractAgentTooland itshandle()runs the same pipeline in order:authorize()(the per-tool config gate) first, thenaudit()(records the argument shape, never values), then the read-only work, thenredactor()on the output. A new tool follows this exact order and is gated byconfig('agent-mcp.tools.<name>').src/Server/AgentMcpServer.phpholds the$toolsregistry array and the server#[Instructions].src/Support/is final static helpers (InstallMode,AgentTarget,GuidelineInjector,SkillInstaller,OutputRedactor).src/Database/andsrc/Sql/hold the read-only connection resolver and the SELECT-only statement validator.config/agent-mcp.phpis the consumer-facing config: every tool enable flag, the auth keys, and the query limits.resources/boost/ships the laravel-boost skills and guideline; theresources/boost/**rule covers editing them.
Conventions (project-specific)
- Do not add
declare(strict_types=1); pint is configured to strip it and the whole package omits it. - Outside
config/, read the environment withIlluminate\Support\Env::get, never theenv()helper. - Support and value classes are
finalwith class and method docblocks that explain WHY. laravel/boostis not a dependency: reference its classes only by string FQCN (e.g.class_exists('Laravel\Boost\BoostServiceProvider')), never auseimport.
Invariants (do not break)
- Read-only: there are no write tools and none may be added. Every database read goes through the hardened read-only connection, and
db_raw_selectis validated SELECT-only. Surface a change for the operator instead of writing. - Auth is a single server-admin key (
AGENT_MCP_KEY), fail-closed: not Sanctum, not a user model, not a database table. Do not add per-user auth. - The package must stay green across the whole
laravel/mcp>=0.6 <0.10range. Code that touches the mcp surface (Response, Request, transport, trace handling) works across it; do not widen the constraint without testing the new minor.
Git workflow
mainis protected: no direct pushes. Land every change through a pull request that passes CI (the "CI Passed" check) and one approval, then squash-merge; the head branch is deleted on merge.- Branch off
mainfor work (feat/...,fix/...,chore/...) and open a PR intomain. - Release by pushing a
vX.Y.Ztag onmain:.github/workflows/release.ymlvalidates, creates the GitHub Release with generated notes, and pings Packagist (which also auto-updates from the tag via its GitHub integration). Do not create releases by hand. - Dependabot opens grouped weekly PRs for
composerandgithub-actions; low-risk ones (GitHub Actions minor/patch, dev-dependency patches) auto-merge once CI passes.
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.

