codeigniter-mcp
The server provides tools to generate, validate, and maintain a CodeIgniter-inspired PHP framework with MVC + Service/Repository architecture, running as an MCP server.
Scaffold complete CRUD resources: Generate Controller, Service, Repository (interface + implementation), Entity, Migration, and tests in one call.
Generate individual layers: Create Controllers, Services, or Repositories (always with interface) independently.
Validate routes: Check Routes.php for exact/pattern collisions and syntax errors without modifying files.
Run database migrations: Execute up/down migrations with explicit confirmation required for destructive operations.
Lint against framework conventions: Validate PHP files for strict types, naming, no queries in controllers, input validation, and repository interfaces.
Access framework documentation: Provide naming, architecture, folder structure, and security rules via MCP resources.
Security & safety: Enforce path traversal protection, Zod input validation, rate limiting, overwrite prevention, and sanitized errors.
Deployment: Support local (stdio) and remote (HTTP) transports, integrable with LLM clients like Claude Code, Cursor, and VS Code.
Generates and maintains idiomatic CodeIgniter framework code, including scaffolding full CRUD resources, controllers, services, repositories, migrations, and route validation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@codeigniter-mcpGenerate a Product resource CRUD with title, price, and description fields."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
codeigniter-mcp
MCP (Model Context Protocol) server that accelerates the development of a PHP framework inspired by CodeIgniter: MVC + optional Services/Repository layer (lightweight Ports/Adapters). Its goal is extreme development speed without sacrificing security.
The server exposes 7 tools and 4 resources that allow an LLM (Claude Code, Cursor, VS Code, etc.) to generate, validate and maintain idiomatic framework code without friction and without structure hallucinations.
Published on npm — run it with
npx codeigniter-mcp, no build required.
Version:
0.1.2— Semantic versioning: any input/output schema change breaks compatibility and must be versioned explicitly.
Table of Contents
Related MCP server: MySQL MCP Server
Requirements
Dependency | Version | Notes |
Node.js | >= 20.12 | MCP server runtime + tooling (tested on Node 24) |
npm | >= 9 | Package manager |
PHP | 8.2+ | Only to run the generated code (not to run the MCP server) |
Composer / PHPUnit | — | For the generated PHP tests |
Installation
Quick start (published package — no build needed):
npx -y codeigniter-mcp # run directly over stdio
npm install -g codeigniter-mcp # or install globallyFrom source (for contributors):
npm install
npm run build # compiles TypeScript → dist/
npm test # full suite (unit + integration + e2e)Configuration
The server is configured through environment variables (see mcp.json):
Variable | Default | Description |
| — | Required. Absolute path to the target PHP framework root. All tools operate only inside this directory. |
|
| Write operations allowed per minute per session. |
|
|
|
|
| HTTP transport port. |
mcp.json (Claude Code / Cursor)
{
"mcpServers": {
"codeigniter-mcp": {
"command": "npx",
"args": ["-y", "codeigniter-mcp"],
"env": {
"APP_ROOT": "/path/to/mi-framework",
"RATE_LIMIT_PER_MINUTE": "20"
}
}
}
}Uses the published package — no build required;
npxdownloads it on first run. Contributors can point the server at a local build instead:"command": "node"with"args": ["dist/index.js"]. The SDK 1.x stdio transport uses newline-delimited JSON messages (noContent-Length); official clients handle it automatically.
Usage in MCP clients
Claude Code: add the codeigniter-mcp block above to your user or project
mcp.json (npx downloads the package automatically on first run), restart the
session, and ask something like:
Generate the full CRUD of the
Productresource with fieldstitle(string, required, max:255),price(float) anddescription(text, optional).
VS Code / Cursor: register the same block in the MCP configuration.
Remote deployment (Streamable HTTP):
MCP_TRANSPORT=http MCP_PORT=3000 APP_ROOT=/path/to/mi-framework npx -y codeigniter-mcp
# or, from a local build:
# MCP_TRANSPORT=http MCP_PORT=3000 APP_ROOT=/path/to/mi-framework node dist/index.jsClients connect to http://localhost:3000/.
Tools
All tools return deterministic structured output:
{ success: true, ... } on success or { success: false, error: { type, message } }
on failure. They never throw exceptions that break the MCP session.
1. scaffold_full_resource
Generates the complete CRUD of a resource.
Input
Field | Type | Rules |
| string |
|
| array |
|
| bool | Generates unit and integration tests (default |
| bool | Generates repositories (default |
| bool | Destructive. Overwrites existing files (default |
Output — filesCreated[], filesSkipped[], warnings[].
Example
{
"resourceName": "Product",
"fields": [
{ "name": "title", "type": "string", "required": true, "validation": "max:255" },
{ "name": "price", "type": "float", "required": true },
{ "name": "description", "type": "text", "required": false }
]
}Generates (in deterministic order):
app/Controllers/ProductController.php
app/Services/ProductService.php
app/Repositories/ProductRepositoryInterface.php
app/Repositories/ProductRepository.php
app/Entities/Product.php
app/Database/Migrations/2026_08_12_create_products_table.php
tests/Unit/ProductServiceTest.php
tests/Integration/ProductControllerTest.phpRules: withRepository=false → no repositories are generated (the Service stays
contract-first) and it warns; with withTests=true and no repository it skips
the unit test and warns. Rate limited.
2. scaffold_controller
Generates only the Controller. Available methods:
index | show | store | update | destroy (default: all).
Hard rule: the controller only calls the {Resource}Service. If the
generated content included SQL, the tool fails at build-time with
ConventionViolationError without writing the file.
3. scaffold_service
Generates only the Service (business logic + validation). Rule: if the
repository interface does not exist, it reports it in warnings but still
generates the Service injecting the interface (contract first, implementation
later).
4. scaffold_repository
Generates always interface + implementation together. There is no implementation without a contract. The implementation uses PDO with prepared statements (SQL-injection safe). Rate limited.
5. validate_route
Read only. Verifies against app/Config/Routes.php:
Exact collision (same method + path).
Pattern collision (
/products/{id}vs/products/{slug}).Shape errors (unbalanced braces, invalid parameters).
Input: { method: "GET|POST|PUT|PATCH|DELETE", path: "/kebab-case/{param}" }.
Output: valid, conflicts[], suggestions[]. Never modifies Routes.php.
6. run_migration — DESTRUCTIVE
Runs migrations through the framework's native runner:
php bin/migrate <direction> [migrationName].
Input: { direction: "up|down", migrationName?, confirm: boolean }.
Hard rule: if confirm !== true the tool returns
DestructiveOpBlockedError without touching the database or executing
anything (tested: zero executions). Rate limited. migrationName is validated
with a regex (only [a-z0-9_], optional .php) to prevent path traversal.
7. lint_against_framework_rules
Validates a PHP file against the conventions. compliant=false if at least one
error violation exists; warnings do not block.
Rule | Applies to | Severity |
| all | error |
| all (class/file/methods) | error |
| Controllers | error |
| Controllers/Services | error |
| Repositories | error |
(layer file without class) | Controllers/Services/Repositories/Entities | warning |
Resources
explain_convention exposes the framework conventions documentation so the
model generates idiomatic code without hallucinating structure. URIs:
URI | Content |
| PascalCase / camelCase / kebab-case, mandatory suffixes |
| MVC + Service + Repository (lightweight Ports/Adapters) |
| Framework folder tree |
| Hard security rules of the tools |
Generated PHP framework contract
The generated code assumes a minimal framework with:
PSR-4 with roots
App\→app/andTests\→tests/.PHP 8.2+ and
declare(strict_types=1);in every file.app/Config/Routes.phpwith syntax$routes->get('/products/{id}', 'ProductController::show');.Native migration runner
bin/migrate:php bin/migrate up|down [migration.php]Prints one line per executed migration to stdout (relative paths).
Base class
App\Core\Migrationthat migrations extend (up(): string/down(): stringreturn SQL).PDO injected into the repositories.
Generated layers (non-negotiable rules):
Controller — only receives the request, calls the Service, returns the response. ZERO business logic, ZERO queries, ZERO inline validation.
Service — business logic + input validation. Receives the Repository by dependency injection through the interface.
RepositoryInterface — data access contract (port).
Repository — concrete adapter against the DB (PDO + prepared statements).
Entity — immutable typed object that travels between layers.
Migration —
{YYYY_MM_DD}_create_{table}_table.php/Create{Table}Table.
Security model
Zod validation on every input, without exception.
No tool passes raw user input to shell, SQL or filesystem without sanitizing it and running it through its schema.
Least privilege: all paths are resolved with
resolveInAppRoot(insideAPP_ROOT); path traversal is blocked and reported asValidationError.Every destructive operation requires explicit
confirm/overwrite: true; without the flag the tool fails in a controlled way.Rate limiting (token bucket) on the 3 heavy write tools:
scaffold_full_resource,scaffold_repository,run_migration.Error messages never expose absolute system paths, credentials or stack traces (unexpected errors are replaced by a generic actionable message).
The generated PHP code uses prepared statements and validates input in the Service (sanitization by default).
Testing
npm test # 114 tests: unit + integration + e2e
npm run test:watch # watch mode
npm run typecheck # tsc --noEmit over src + testsCoverage:
Unit (
tests/unit/): core (fs-safe, rate-limiter, config), PHP templates, and the 7 tools (happy path, invalid input → typed error, destructive operation without confirmation, collision/overwrite, rate limit).Integration (
tests/integration/server.test.ts): real server over the SDKInMemoryTransport— tool/resource listing, protocol calls, alive session after errors.E2E (
tests/integration/e2e.test.ts): startssrc/index.tsover stdio, JSON-RPC handshake, scaffold ofProductfrom scratch,php -lof the 8 generated files (if PHP is installed),run_migrationblocked withoutconfirmand executed with a realbin/migrate.
Local development
npm run dev # tsx src/index.ts (needs APP_ROOT in env)
npm run inspector # MCP Inspector over the build (node dist/index.js)To test a single tool in isolation with the Inspector:
APP_ROOT=/path/to/mi-framework npm run inspectorAcceptance verification
Run the end-to-end acceptance checklist against a throwaway framework skeleton (no cleanup needed, it deletes itself):
Run the checklist against the local build:
npm run build
npm run verifyTest the published package instead:
# bash (macOS / Linux)
VERIFY_MCP_COMMAND="npx -y codeigniter-mcp" npm run verify# PowerShell (Windows)
$env:VERIFY_MCP_COMMAND = "npx -y codeigniter-mcp"
node scripts/verify-mcp.mjsIt reports ✅/❌ per criterion: handshake, 7 tools, 4 resources, full CRUD
scaffold (8 files), php -l, lint compliance, route validation, destructive-op
guard, migration execution and path-traversal protection. Exit code 0 means
everything passed.
End-to-end example
Set
APP_ROOTto an empty framework directory.Call
scaffold_full_resourcewithProduct(see the Tool 1 example).Run
validate_routeoverPOST /products(no collisions).Run
run_migrationwith{ direction: "up", confirm: true }to create theproductstable.Run
lint_against_framework_ruleson every generated file: all must returncompliant: true.Run the generated PHP tests:
vendor/bin/phpunit tests/Unit tests/Integration.
The resource is functional without manual editing (spec acceptance criterion: full CRUD generated in <30s, zero post-generation manual edits).
FAQ
Can I generate only one layer? Yes: scaffold_controller, scaffold_service
and scaffold_repository generate individual layers with the same rules.
What happens if a file already exists? With overwrite: false (default) it
is not touched: the tool reports it in filesSkipped/warnings with reason: exists_no_overwrite.
Does the server write outside APP_ROOT? No. resolveInAppRoot prevents it
(ValidationError on path traversal attempts).
How do I disable the rate limit? Raise RATE_LIMIT_PER_MINUTE in the
server configuration.
Do errors expose system paths? Never. Unexpected errors always return a generic actionable message.
Contributing
Contributions are welcome! Read CONTRIBUTING.md to set up the development environment, run the tests and open a pull request. Security issues should be reported privately — see SECURITY.md. Release history is tracked in CHANGELOG.md.
License
MIT © 2026 X-Gunner
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityFmaintenanceA comprehensive Model Context Protocol server that provides advanced Node.js development tooling for automating project creation, component generation, package management, and documentation with AI-powered assistance.79MIT
- AlicenseBqualityBmaintenanceComprehensive Model Context Protocol server for MySQL databases featuring 191 specialized tools for CRUD operations, JSON functions, spatial/GIS, schema management, performance monitoring, and advanced features like OAuth 2.1 authentication and connection pooling.43808MIT
- Alicense-qualityCmaintenanceGenerates production-ready MCP servers from natural language, OpenAPI specs, database schemas, GraphQL schemas, or ontologies.691MIT
- AlicenseAqualityCmaintenanceA production-ready Model Context Protocol (MCP) server that bridges your Symfony/PHP project with LLMs such as Claude. It exposes tools that let the AI read your project's routes, services, Twig templates, and PHP source code.8MIT
Related MCP Connectors
MCP (Model Context Protocol) server for Appwrite
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/X-Gunner/codeigniter-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server