Download the PHP package josbeir/cakephp-synapse without Composer
On this page you can find all versions of the php package josbeir/cakephp-synapse. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package cakephp-synapse
Synapse: a CakePHP MCP-Server plugin
Expose your CakePHP application functionality via the Model Context Protocol (MCP).
Table of Contents
- Overview
- Features
- Installation
- Requirements
- Installing the Plugin
- Quick Start
- Configuration
- Built-in Tools
- Built-in Prompts
- Creating Custom Tools, Resources, and Prompts
- CLI usage
- Running the Server
- Command Options
- Testing with MCP Inspector
- Transport Options
- Discovery Caching
- Testing
- Contributing
- License
- Credits
Overview
Synapse is a CakePHP plugin that implements the Model Context Protocol (MCP), allowing AI assistants and other MCP clients to interact with your CakePHP application through a standardized interface.
[!WARNING] This plugin uses the MCP PHP SDK which is currently in active development. Features and APIs may change as the SDK evolves.
The Model Context Protocol is an open protocol that enables seamless integration between AI assistants (like Claude) and your application's data and functionality. With Synapse, you can expose:
- Tools: Functions that AI assistants can call (e.g., database queries, route inspection)
- Resources: Data sources that can be read
- Prompts: Pre-configured templates for common tasks
Features
- 🚀 Rapid Integration: Enable MCP support in your CakePHP app with minimal setup
- 🔍 Attribute-Based Discovery: Finds MCP tools, resources, and prompts using PHP 8+ attributes and class scanning
- 🛠️ Built-in Tools: Includes tools for system info, database schema exploration, route inspection, code execution, log inspection, cache management, ORM introspection, and more
- 📚 Advanced Documentation Search: Full-text search with fuzzy matching and relevance ranking, powered by SQLite FTS5 (indexes official CakePHP markdown docs)
- 🧩 Customizable & Extensible: Easily define your own tools, resources, and prompts using attributes and configuration
- ⚡ Prompt Workflows: Built-in prompt flows for common development tasks, code review, debugging, and feature building
Installation
Requirements
- PHP 8.2 or higher
- CakePHP 5.2 or higher
Installing the Plugin
Install via Composer as a development dependency:
[!NOTE] This plugin is typically used as a development tool to allow AI assistants to interact with your application during development. It should not be installed in production environments.
The plugin will automatically register itself and discover MCP elements in your application.
[!TIP] After updating the plugin, it's recommended to re-index the documentation to ensure all features work correctly:
Quick Start
-
Install the plugin (see above)
- Configure your MCP-enabled client:
To connect Claude Code/Desktop or other MCP clients (VSCode/Zed/...):
- Configure the client to use stdio transport
- Point it to your CakePHP bin directory:
bin/cake synapse server - The client will communicate with your app via the MCP protocol
Most clients require a command wich will be your cake executable bin/cake followed by arguments: synapse server
Or run when using DDEV instance
Configuration
Various configuration options are available for Synapse. Refer to config/synapse.php in this plugin for details on available settings and customization.
Built-in Tools
Synapse includes several built-in tools and resources for common operations:
| Category | Name | Description |
|---|---|---|
| System | system_info |
Get CakePHP version, PHP version, debug mode, etc. |
| System | config_read |
Read configuration values |
| System | debug_status |
Check if debug mode is enabled |
| System | list_env_vars |
List all available environment variables |
| Code Execution | tinker |
Execute arbitrary PHP code with full application context |
| Database | database_connections |
List all configured database connections |
| Database | database_schema |
Get detailed schema information for tables (view all tables, inspect columns, constraints, indexes, understand foreign key relationships) |
| Routes | list_routes |
List all routes with filtering and sorting |
| Routes | get_route |
Get detailed information about a specific route |
| Routes | match_url |
Find which route matches a given URL |
| Routes | detect_route_collisions |
Find potential route conflicts |
| Documentation | search_docs |
Search documentation with relevance ranking, fuzzy matching, and filtering |
| Documentation | get_doc |
Retrieve full document content by document ID (format: source::path) |
| Documentation | docs_stats |
View index statistics and available sources |
| Documentation | docs://search/{query} |
Search CakePHP documentation and return formatted results |
| Documentation | docs://content/{documentId} |
Retrieve full document content by document ID (format: source::path) |
| Commands | list_commands |
List all available CakePHP console commands with optional filtering and sorting |
| Commands | get_command_info |
Get detailed information about a specific console command (options, arguments, help) |
| Commands | run_command |
Run a registered CakePHP console command in a subprocess with configurable timeout |
| Logs | log_list |
List all log files in the application logs directory with size and modification time |
| Logs | log_read |
Read the last N lines from a log file, optionally filtered by log level (error, warning, info, debug, …) |
| Cache | cache_configs |
List all configured CakePHP cache configurations with engine information |
| Cache | cache_read |
Read a value from a cache configuration by key |
| Cache | cache_write |
Write a string value to a cache configuration |
| Cache | cache_delete |
Delete a key from a cache configuration |
| Cache | cache_clear |
Clear all entries from a cache configuration |
| ORM | orm_describe |
Describe a CakePHP ORM Table: associations, behaviors, display field, primary key, entity class |
| ORM | orm_find |
Run a find query (all, first, or count) on an ORM Table with a configurable row limit |
[!WARNING] The
tinkertool executes arbitrary code in your application. Use responsibly and avoid modifying data without explicit approval.[!TIP] The
tinkertool can be used to query the database using CakePHP's ORM. The tinker context provides access to$this->fetchTable()for easy database operations.[!NOTE] Documentation is indexed from the official CakePHP markdown documentation. The index is built locally using SQLite FTS5 for fast, dependency-free full-text search.
Built-in Prompts
Synapse includes pre-defined prompt workflows that guide LLMs through common CakePHP development tasks. Prompts combine multiple tools (search docs, read documentation, tinker) into structured, best-practice workflows.
Available Prompts
| Prompt | Description | Arguments |
|---|---|---|
documentation-expert |
Get comprehensive guidance on CakePHP features with examples | topic (required), depth (optional: basic/intermediate/advanced) |
debug-helper |
Systematic debugging workflow for errors and issues | error (required), context (optional: controller/model/database/view) |
feature-builder |
Guide for implementing complete features following conventions | feature (required), component (optional: controller/model/behavior/helper/middleware/command/full-stack) |
database-explorer |
Explore database schema, relationships, and data | table (required), show (optional: schema/data/relationships/all) |
code-reviewer |
Review code against CakePHP conventions and best practices | code (required), focus (optional: conventions/security/performance/testing/all) |
migration-guide |
Help migrate code between CakePHP versions | fromVersion, toVersion (required), area (optional: specific feature or general) |
testing-assistant |
Generate test cases and testing guidance | subject (required), testType (optional: unit/integration/fixture/all) |
performance-analyzer |
Analyze and optimize performance issues | concern (required), context (optional: code snippet or description) |
orm-query-helper |
Build complex ORM queries with guidance | queryGoal (required), tables (optional: comma-separated list) |
tinker-workshop |
Interactive PHP exploration and testing guide | goal (required: explore/test/debug), subject (optional) |
quality-assurance |
Coding guidelines and QA best practices for CakePHP | context (optional: guidelines/integration/troubleshooting/all), tools (optional: all or comma-separated list) |
Prompts automatically:
- Search relevant documentation
- Read detailed guides
- Execute test code via tinker
- Provide structured, comprehensive answers following best practices
Benefits:
- Faster workflows - Common tasks become one-step operations
- Best practices - Prompts encode CakePHP expertise and conventions
- Consistency - Standardized approaches to common problems
- Discovery - See available workflows without remembering tool combinations
Configuring Prompts
Prompts can reference a specific CakePHP version and use various quality tools. Configure both in config/synapse.php:
Creating Custom Tools, Resources, and Prompts
You can extend Synapse with your own tools, resources, and prompts using PHP attributes. Synapse automatically discovers classes in your src/ directory using MCP attributes.
Tools expose functions that AI assistants can call. Create them with #[McpTool]:
Resources expose data sources. Create them with #[McpResourceTemplate].
Prompts guide LLMs through workflows. Create them with #[McpPrompt].
For detailed documentation on all MCP capabilities, attributes, and implementation patterns, see the MCP PHP SDK documentation.
CLI usage
Use the CLI to manage and search the index:
Running the Server
[!NOTE] In most cases, you do not need to run the MCP server manually. The server is typically started automatically by your IDE or MCP-enabled client (such as Claude Desktop, VSCode, Zed, etc.) when you configure it to use your CakePHP app. The client will launch the server using the appropriate command (e.g.,
bin/cake synapse server) and handle the connection for you.
If you want to run the MCP server manually for testing or debugging purposes, you can use the following CLI commands:
Command Options
| Option | Short | Description |
|---|---|---|
--transport |
-t |
Transport type (currently only stdio is supported) |
--no-cache |
-n |
Disable discovery caching for this run |
--clear-cache |
-c |
Clear discovery cache before starting |
--inspect |
-i |
Launch MCP Inspector to test the server interactively (requires Node.js/npx) |
--verbose |
-v |
Enable verbose output (pipes logging to stderr) |
--quiet |
-q |
Suppress all output except errors |
Testing with MCP Inspector
The --inspect flag launches the MCP Inspector, a development tool that provides a web-based UI for testing your MCP server:
This will:
- Start the MCP Inspector (downloads automatically via npx if not installed)
- Launch the server in inspector mode
- Open a web browser with an interactive UI
- Allow you to test tools, resources, and prompts interactively
Requirements:
- Node.js and npx must be installed
- A web browser
The inspector is invaluable during development for:
- Testing tool functionality
- Inspecting resource data
- Debugging server behavior
- Verifying tool schemas and documentation
Transport Options
Currently, Synapse supports:
- stdio - Standard input/output (default, recommended for most MCP clients)
Future versions may include HTTP/SSE transport.
Discovery Caching
Discovery caching improves server startup performance by caching the discovered MCP elements (tools, resources, prompts).
Configuration
Synapse uses CakePHP's built-in PSR-16 cache system. Configure caching in config/synapse.php
Command Options
Testing
Run the test suite:
Contributing
Contributions are welcome! Please follow these guidelines:
- Code Standards: Follow CakePHP coding standards
- Tests: Add tests for new features
- PHPStan: Ensure level 8 compliance
- Documentation: Update README for new features
Development Setup
License
This plugin is open-sourced software licensed under the MIT license.
Credits
- Built with CakePHP
- Implements Model Context Protocol
- Uses the MCP PHP SDK
[!NOTE] The MCP PHP SDK is in active development and APIs may change.
All versions of cakephp-synapse with dependencies
ext-sqlite3 Version *
cakephp/cakephp Version ^5.2
mcp/sdk Version ^0.5
symfony/filesystem Version ^7.0 || ^8.0
symfony/finder Version ^7.0 || ^8.0