codeigniter MCP server
Commit Nov 9, 2026Scaffolds CodeIgniter 4 modules and provides real-time database and route introspection for AI coding assistants.
Also known as X-Gunner/codeigniter-mcp
- Stars
- 2
- Tools
- 8
- Downloads, 30 days
- —
- Latest version
- —
- Last commit
- Nov 9, 2026
- License
- MIT
What is codeigniter MCP?
codeigniter scaffolds CodeIgniter 4 modules and provides real-time database and route introspection for AI coding assistants. It exposes 8 tools, such as scaffold_full_resource, scaffold_controller, scaffold_service.
Summary generated from the project's README
About codeigniter MCP server
Developers working with CodeIgniter 4 can accelerate their workflow by using this tool to scaffold production-ready modules and inspect application state. It functions through a dual-engine design that connects an outer Node/TypeScript server to an inner PHP Spark command. This setup allows AI assistants to generate complete CRUD resources, including controllers, services, and repositories, in under 15 milliseconds while maintaining strict architectural standards.
Users can run the server locally via stdio using npx or connect remote agents through streamable HTTP using an API key for authentication. The system provides real-time introspection of the live database schema, compiled routes, and migration status. By bridging the gap between the AI and the running PHP environment, it prevents syntax hallucinations and ensures that generated code follows specific framework conventions like dependency injection and CSRF protection.
What you can do with it
- 1Inspect live database schemasAsk the AI to examine actual table columns, data types, and primary keys from the running application.
Written from the project's README. Every use case is checked against a quote from it.
codeigniter MCP tools 8
Detected from the READMEscaffold_full_resourcescaffold_controllerscaffold_servicescaffold_repositoryvalidate_routerun_migrationlint_against_framework_rulesscaffold_ci4_mcp_server
Configuration
APP_ROOTMCP_TRANSPORTRATE_LIMIT_PER_MINUTE
Automated checks
Ran Nov 14, 2026Full report →Not verified yet. A server needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablex-gunner/codeigniter-mcp is public and reachablegithub.com/x-gunner/codeigniter-mcp ↗Pass
- Package names this repository as its sourceNot checked
- Build provenance (Sigstore attestation)Not checked
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit or release 2026-11-09github.com/x-gunner/codeigniter-mcp ↗Pass
- OpenSSF ScorecardNot checked
- Package name not close to a popular packageNot checked
- No critical advisory in the package or its dependenciesNot checked
- No hidden instructions to the model8 tool descriptions and the README read; no override phrases, credential paths or hidden charactersPass
- Destructive tools are labelledNo tool named like delete, drop or execPass
- Remote endpoint answers the MCP handshakeNot checked
README
View on GitHubcodeigniter-mcp
💼 Enterprise Modernization & Custom AI Tooling: Migrating monolithic CodeIgniter 3 systems to CI4? Need custom MCP servers, architecture audits, or dedicated team support? Message Cristofher on Agensi →
Model Context Protocol (MCP) server built for high-velocity AI development on CodeIgniter 4 and modern PHP architectures (MVC + Services/Repository layer).
Eliminates LLM hallucinations, scaffolds complete production-ready modules in <15 milliseconds, and unlocks real-time live database and route introspection directly inside your AI IDE (Claude Code, Cursor, Windsurf, Trae, OpenAI Codex, and Google Project Astra).
Architecture: The "Top 1%" Dual-Engine Design
Most MCP servers are either purely external (blind to running application state) or heavy PHP extensions. codeigniter-mcp uses a Dual-Engine Architecture bridging the best of both worlds:
flowchart TB
subgraph AI["AI Coding Assistant"]
Client["Claude Code / Cursor / Windsurf / Trae / Codex / Astra"]
end
subgraph Outer["Engine 1: Outer Server (Node/TypeScript)"]
MCPNode["codeigniter-mcp (stdio / HTTP)"]
Scaffold["Lightning Scaffolding (<15 ms)\nCRUD, Controllers, Services, Entities"]
Linter["AST Linter & Conventions\nStrict types, PascalCase, Zero-SQL Controllers"]
RouteVal["Route Collision Analyzer\nCI4 placeholders, (:segment), $routes->resource()"]
Migrator["Safe Migration Runner\nExplicit confirmation, interpreted PHP errors"]
end
subgraph Inner["Engine 2: Inner In-App Server (PHP Spark Command)"]
SparkCmd["php spark mcp:serve\n(Generated via scaffold_ci4_mcp_server)"]
LiveDB["Live DB Introspection\nReal tables, columns, nullability, keys"]
SafeQuery["Safe SELECT Query Engine\nCapped row limit, mutation blocking"]
ActiveRoutes["Live Route Reflector\nReads compiled Services::routes()"]
MigStatus["Migration Version Status\nReads active batch history"]
end
Client -->|Local stdio or Streamable HTTP| MCPNode
MCPNode --> Scaffold
MCPNode --> Linter
MCPNode --> RouteVal
MCPNode --> Migrator
MCPNode -.->|Generates app/Commands/McpServer.php| SparkCmd
Client -.->|Direct live introspection| SparkCmd
SparkCmd --> LiveDB
SparkCmd --> SafeQuery
SparkCmd --> ActiveRoutes
SparkCmd --> MigStatus
- Outer Engine (
codeigniter-mcp): Runs in Node/TypeScript overstdioorhttp. Handles sub-millisecond code scaffolding, static syntax validation, and route collision checks without touching PHP runtime dependencies. - Inner Engine (
php spark mcp:serve): Scaffolds a zero-dependency, native CodeIgniter 4 Spark command (app/Commands/McpServer.php) that runs a pure JSON-RPC 2.0 MCP server over stdio for real-time live schema reflection, safe read-only SQL queries, and compiled route inspection.
Highlights
- 8 Production Tools: Complete CRUD scaffolding, modular controllers, services, repositories, route validation, migration runner, AST convention linter, and native CI4 MCP server generator.
- Vibecoding Ready (Zero Hallucinations): The AI assistant never confuses CI3, Laravel, and CI4 syntax. Generates clean
BaseController, dependency-injected Services, Query Builder Models, and CSRF-protected forms. - Enterprise-Grade Security:
- Symlink Traversal Mitigation: Canonical
realpathSyncresolution prevents reading or writing outsideAPP_ROOT. - DNS Rebinding Protection: Enforces strict
Hostheader matching (returns 403 Forbidden). - HTTP API Key Authentication: Supports
Authorization: Bearer <key>orX-API-Keyheaders. - Safe PDO Mutations: Prevents false 404s on unchanged MySQL row updates (
rowCount() > 0 || $this->findById($id)). - Destructive Operations Guarded: Requires explicit
confirm: trueoroverwrite: true.
- Symlink Traversal Mitigation: Canonical
- 4 Convention Resources + 3 Token-Saving Prompts: Compact prompt templates save token context and speed up LLM responses.
AI Agent Skill (Agensi.io Marketplace)
Prefer installing as a ready-to-use AI Agent Skill?
Get the CodeIgniter 4 Master skill directly from Agensi.io:
- Plug-and-play workflow instructions (
SKILL.md) for Claude Code, Cursor, Trae, Copilot, and Windsurf. - Architectural Guardrails: Guarantees zero SQL in controllers, CSRF-protected forms, and type safety.
- Automated MCP Triggers: Configures your agent to automatically invoke
codeigniter-mcptools when creating modules or inspecting databases.
Quickstart
Run with npx (No installation needed)
npx -y codeigniter-mcp
Install globally
npm install -g codeigniter-mcp
From source (Contributors)
git clone https://github.com/X-Gunner/codeigniter-mcp.git
cd codeigniter-mcp
npm install
npm run build
npm test
npm run verify
IDE & AI Agent Configuration
1. Claude Code / Claude Desktop
Add to claude_desktop_config.json or run claude mcp add codeigniter-mcp:
{
"mcpServers": {
"codeigniter-mcp": {
"command": "npx",
"args": ["-y", "codeigniter-mcp"],
"env": {
"APP_ROOT": "/absolute/path/to/your/codeigniter4_project",
"RATE_LIMIT_PER_MINUTE": "30"
}
}
}
}
2. Cursor / Windsurf / Trae
In your project root or global settings (.cursor/mcp.json or settings UI):
{
"mcpServers": {
"codeigniter-mcp": {
"command": "npx",
"args": ["-y", "codeigniter-mcp"],
"env": {
"APP_ROOT": "/absolute/path/to/your/codeigniter4_project"
}
}
}
}
3. Remote Agents / OpenAI Codex / Google Project Astra (Streamable HTTP)
For cloud agents that connect over HTTP instead of spawning local sub-processes:
# Start server in HTTP mode
MCP_TRANSPORT=http MCP_PORT=3000 MCP_BIND_HOST=127.0.0.1 MCP_API_KEY=secret_token APP_ROOT=/path/to/project npx codeigniter-mcp
Configure your remote AI agent:
{
"mcpServers": {
"codeigniter-mcp": {
"url": "http://127.0.0.1:3000/mcp",
"headers": {
"Authorization": "Bearer secret_token"
}
}
}
}
Available Tools (8 Tools)
| Tool | Purpose | Key Parameters |
|---|---|---|
scaffold_full_resource |
Generates full CRUD in ~15 ms: Controller + Service + Model/Repository + Migration + View + Tests (8 files). | resourceName, fields[], withTests, withRepository, overwrite |
scaffold_controller |
Generates standalone Controller with strict validation; enforces zero SQL in controllers. | resourceName, methods[], fields[], overwrite |
scaffold_service |
Generates business logic Service with contract-first DI (injects Model in CI4). | resourceName, fields[], withRepository, overwrite |
scaffold_repository |
Generates Repository interface + PDO implementation (no-op in CI4, data lives in Models). | resourceName, overwrite |
validate_route |
Analyzes app/Config/Routes.php to detect route collisions, CI4 placeholders ((:num), (:segment)), and $routes->resource(). |
method, path |
run_migration |
Executes native migrations (spark migrate or bin/migrate). Interprets PHP errors into actionable messages; requires explicit confirmation. |
direction (up|down), confirm (bool) |
lint_against_framework_rules |
Lints PHP source code against framework conventions and AST security rules. | filePath |
scaffold_ci4_mcp_server |
Scaffolds native CI4 in-app MCP command (app/Commands/McpServer.php) for live runtime introspection via php spark mcp:serve. |
commandName, className, readOnly, overwrite |
In-App Live Introspection (php spark mcp:serve)
Once you run scaffold_ci4_mcp_server, your CodeIgniter 4 application gains its own native MCP server:
php spark mcp:serve
This exposes live runtime tools to your AI assistant:
ci4_db_tables: Reflects active database schema, columns, data types, and primary keys.ci4_db_query: Runs safe, read-onlySELECTqueries (capped at 50 rows, destructive keywords blocked).ci4_routes_list: Reads dynamically compiled routes directly fromServices::routes().ci4_migration_status: QueriesServices::migrations()for active and pending migration batches.
Token-Saving Prompts (3 Prompts)
Compact input templates that minimize token consumption:
| Prompt | Description |
|---|---|
create_full_resource |
Converts compact definitions (e.g. Patient fullName:string:true, age:int:false) into exact tool parameters. |
run_migration |
Prepares migration direction while enforcing safety confirmation. |
lint_file |
Directs the model to inspect and repair a specific file against framework standards. |
Convention Resources (4 Resources)
Read-only context injected into the LLM context window:
convention://naming: Rules for PascalCase, camelCase, kebab-case, and mandatory suffixes.convention://architecture: Explains MVC + Service + Repository separation.convention://folder-structure: CodeIgniter 4 directory tree mapping.convention://security-rules: Guidelines for CSRF tokens, PDO parameterized statements, and strict typing.
Configuration Variables
| Variable | Default | Description |
|---|---|---|
APP_ROOT |
— | Required. Absolute path to the PHP application root directory. |
RATE_LIMIT_PER_MINUTE |
20 |
Maximum write/scaffold operations permitted per minute per session. |
MCP_TRANSPORT |
stdio |
Communication protocol (stdio or http). |
MCP_PORT |
3000 |
Port for Streamable HTTP transport mode. |
MCP_BIND_HOST |
127.0.0.1 |
Local IP binding to guard against DNS rebinding attacks. |
MCP_API_KEY |
— | Optional Bearer token or X-API-Key required for HTTP transport. |
PHP_BINARY |
php |
Path or name of the PHP CLI binary to execute. |
Testing & Quality Assurance
# Run complete test suite (165 tests across 17 files)
npm test
# Typecheck with zero warnings
npm run typecheck
# Acceptance checklist against real stdio MCP transport
npm run verify
codeigniter-mcp — acceptance checklist
✅ Handshake: serverInfo.name = codeigniter-mcp
✅ Exposes 8 tools (found 8)
✅ Exposes 4 convention resources (found 4)
✅ Exposes 3 token-saving prompts (found 3)
✅ scaffold_full_resource creates 8 files on disk (7 ms)
✅ php -l passes on all generated files (8 files OK)
✅ lint_against_framework_rules → compliant
✅ validate_route POST /orders → valid
✅ run_migration without confirm → blocked (zero executions)
✅ run_migration with confirm=true executes via bin/migrate
✅ scaffold again → no overwrite, 8 files skipped
✅ Path traversal outside APP_ROOT → ValidationError
✅ Runner failure → actionable MigrationFailedError
Result: 13 passed · 0 failed · 0 skipped
Documentation
- docs/tools.md — Comprehensive parameter references for all 8 tools.
- docs/profiles.md — Profiles, auto-detection (
ci4vsspec), and configuration. - docs/security.md — Deep dive into the security architecture and guardrails.
- docs/testing.md — Testing strategy, E2E fixtures, and CI automation.
💼 Enterprise Support, Migration & Consulting Services
Need dedicated support, custom tool development, or legacy modernization for your engineering team?
We offer professional architecture and migration services tailored for enterprise CodeIgniter ecosystems:
- Legacy Migration (CI3 → CI4): Safe, phased migration of legacy monolithic CodeIgniter 3 systems to modern CodeIgniter 4 + PHP 8.2+ with clean MVC, Service layer, and typed entities.
- Custom MCP & AI Tooling: Custom-tailored Model Context Protocol servers and specialized IDE prompts tailored to your proprietary schema, internal libraries, and coding standards.
- Architecture & Security Audits: Comprehensive review of existing repositories to eliminate controller SQL leakage, harden PDO parameters, implement CSRF/Auth safeguards, and modernize routing.
- Monthly Retainer / Dedicated Support: Direct SLA-backed architecture advisory, prompt engineering support, and framework maintenance for engineering teams.
👉 Inquire or Request a Consultation:
- Direct Chat & Messages: Message Cristofher Robles on Agensi
- Marketplace Skill: Available on Agensi.io (
CodeIgniter 4 Master)
Contributing
Contributions are welcome! Please read CONTRIBUTING.md before submitting pull requests.
License
Distributed under the MIT License. Copyright (c) 2026 Cristofher Robles. See LICENSE for more information.
codeigniter MCP questions
What tools does codeigniter MCP provide?
It exposes 8 tools, including scaffold_full_resource, scaffold_controller, scaffold_service, scaffold_repository, validate_route.