├── .env.example ├── .github └── workflows │ └── tests.yml ├── .gitignore ├── .php-cs-fixer.php ├── CONTRIBUTING.md ├── FILE_INDEX.md ├── LICENSE.md ├── README.md ├── check.bat ├── codecov.yml ├── composer.json ├── config └── mcp.php ├── coverage.xml ├── docs ├── api │ ├── _ .md │ ├── _ClientCapabilities.md │ ├── _CompletionRequest.md │ ├── _FastMCP.md │ ├── _HttpClientTransport.md │ ├── _HttpTransport.md │ ├── _Implementation.md │ ├── _LoggingMessageNotification.md │ ├── _MCP.md │ ├── _MCPClient.md │ ├── _MCPServer.md │ ├── _MCPServerCommand.md │ ├── _MCPServiceProvider.md │ ├── _ModelPreferences.md │ ├── _PaginatedRequest.md │ ├── _PaginatedResult.md │ ├── _ProgressNotification.md │ ├── _Prompt.md │ ├── _PromptsCapability.md │ ├── _Resource.md │ ├── _ResourceTemplate.md │ ├── _ResourcesCapability.md │ ├── _Root.md │ ├── _RootsCapability.md │ ├── _ServerCapabilities.md │ ├── _StdioTransport.md │ ├── _Tool.md │ ├── _ToolsCapability.md │ ├── _TransportFactory.md │ ├── _WebSocketTransport.md │ ├── __.md │ └── ______________.md ├── index.md └── index.rst ├── examples ├── README.md ├── cli_tool.php ├── http_client.php ├── http_server.php ├── websocket_client.php └── websocket_server.php ├── index.html ├── phpcs.xml ├── phpdoc.dist.xml ├── phpstan.neon ├── phpunit.xml ├── scripts └── generate-docs.php ├── src ├── Capabilities │ ├── ClientCapabilities.php │ ├── PromptsCapability.php │ ├── ResourcesCapability.php │ ├── RootsCapability.php │ ├── ServerCapabilities.php │ ├── ServerCapabilities │ │ ├── PromptsCapability.php │ │ └── ResourcesCapability.php │ └── ToolsCapability.php ├── Commands │ └── MCPServerCommand.php ├── Contracts │ ├── MCPServerInterface.php │ ├── NotificationInterface.php │ ├── PromptInterface.php │ ├── RequestInterface.php │ ├── ResourceInterface.php │ ├── ResourceTemplateInterface.php │ ├── ToolInterface.php │ └── TransportInterface.php ├── Facades │ └── MCP.php ├── Implementation.php ├── Logging │ └── LoggingLevel.php ├── MCPClient.php ├── MCPServiceProvider.php ├── Notifications │ ├── LoggingMessageNotification.php │ └── ProgressNotification.php ├── Pagination │ ├── PaginatedRequest.php │ └── PaginatedResult.php ├── Requests │ └── CompletionRequest.php ├── Root.php ├── Sampling │ └── ModelPreferences.php ├── Server │ ├── FastMCP.php │ ├── MCPServer.php │ ├── Prompt.php │ ├── Resource.php │ ├── ResourceTemplate.php │ └── Tool.php └── Transport │ ├── HttpClientTransport.php │ ├── HttpTransport.php │ ├── StdioTransport.php │ ├── TransportFactory.php │ └── WebSocketTransport.php └── tests ├── Facades └── MCPTest.php ├── Feature ├── ExampleTest.php ├── MCPServerTest.php └── ServerRunner.php ├── Server └── MCPServerTest.php ├── TestCase.php ├── Transport ├── HttpTransportTest.php ├── StdioTransportTest.php ├── TransportTest.php └── WebSocketTransportTest.php └── Unit ├── Capabilities ├── CapabilitiesTest.php ├── PromptsCapabilityTest.php ├── ResourcesCapabilityTest.php ├── RootsCapabilityTest.php ├── ServerCapabilities │ ├── PromptsCapabilityTest.php │ └── ResourcesCapabilityTest.php └── ToolsCapabilityTest.php ├── Commands └── MCPServerCommandTest.php ├── ExampleTest.php ├── ImplementationTest.php ├── Logging └── LoggingLevelTest.php ├── MCPClientTest.php ├── MCPServiceProviderTest.php ├── Notifications └── ProgressNotificationTest.php ├── Pagination ├── PaginatedResultTest.php └── PaginationTest.php ├── Requests └── CompletionRequestTest.php ├── RootTest.php ├── Sampling └── ModelPreferencesTest.php └── Server ├── FastMCPTest.php └── MCPServerTest.php /.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=LaravelMCP 2 | APP_ENV=testing 3 | APP_KEY=base64:your-test-key-here 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=sqlite 12 | DB_DATABASE=database/database.sqlite 13 | 14 | BROADCAST_DRIVER=log 15 | CACHE_DRIVER=file 16 | FILESYSTEM_DISK=local 17 | QUEUE_CONNECTION=sync 18 | SESSION_DRIVER=file 19 | SESSION_LIFETIME=120 20 | 21 | MCP_SERVER_HOST=127.0.0.1 22 | MCP_SERVER_PORT=3000 23 | MCP_SERVER_TRANSPORT=http 24 | MCP_API_BASE_URL=http://localhost:3000 25 | MCP_API_KEY=test-api-key -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: Tests 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | tests: 11 | runs-on: ubuntu-latest 12 | 13 | strategy: 14 | matrix: 15 | php: [8.1, 8.2, 8.3] 16 | laravel: [10.*] 17 | 18 | steps: 19 | - uses: actions/checkout@v4 20 | 21 | - name: Setup PHP 22 | uses: shivammathur/setup-php@v2 23 | with: 24 | php-version: ${{ matrix.php }} 25 | extensions: mbstring, xml, ctype, iconv, intl, xdebug 26 | coverage: xdebug 27 | 28 | - name: Install Dependencies 29 | run: composer install --prefer-dist --no-progress 30 | 31 | - name: Check Code Style 32 | run: | 33 | vendor/bin/php-cs-fixer fix --dry-run --diff 34 | vendor/bin/phpcs 35 | 36 | - name: Static Analysis 37 | run: vendor/bin/phpstan analyse 38 | 39 | - name: Execute tests via PHPUnit with coverage 40 | run: vendor/bin/phpunit --coverage-clover coverage.xml 41 | 42 | - name: Upload coverage to Codecov 43 | uses: codecov/codecov-action@v4 44 | with: 45 | token: ${{ secrets.CODECOV_TOKEN }} 46 | files: ./coverage.xml 47 | fail_ci_if_error: false # Set to true once coverage is stable 48 | verbose: true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /vendor 3 | composer.lock 4 | clover.xml 5 | # IDE and Editor Files 6 | .idea/ 7 | .vscode/ 8 | *.sublime-project 9 | *.sublime-workspace 10 | *.code-workspace 11 | .project 12 | .settings/ 13 | .classpath 14 | .buildpath 15 | *.swp 16 | *.swo 17 | *~ 18 | 19 | # Testing and Coverage 20 | /coverage 21 | .phpunit.result.cache 22 | .phpunit.cache 23 | phpunit.xml.bak 24 | .php_cs.cache 25 | .php-cs-fixer.cache 26 | 27 | # Environment Files 28 | .env 29 | .env.backup 30 | .env.*.local 31 | 32 | # Operating System Files 33 | .DS_Store 34 | Thumbs.db 35 | *.log 36 | 37 | # Build and Distribution 38 | /build 39 | /dist 40 | *.phar 41 | 42 | # Cache and Temporary Files 43 | *.cache 44 | *.tmp 45 | *.temp 46 | 47 | # Local Development 48 | /storage/*.key 49 | /.vagrant 50 | /node_modules 51 | npm-debug.log 52 | yarn-error.log 53 | *.hot-update.js 54 | *.hot-update.json 55 | 56 | # Documentation 57 | /docs/_build/ 58 | /docs/_static/ 59 | /docs/_templates/ 60 | 61 | # Misc 62 | *.bak 63 | *.orig 64 | .php_cs 65 | .php_cs.dist -------------------------------------------------------------------------------- /.php-cs-fixer.php: -------------------------------------------------------------------------------- 1 | in([ 5 | __DIR__ . '/src', 6 | __DIR__ . '/tests', 7 | ]) 8 | ->name('*.php') 9 | ->ignoreDotFiles(true) 10 | ->ignoreVCS(true); 11 | 12 | return (new PhpCsFixer\Config()) 13 | ->setRules([ 14 | '@PSR12' => true, 15 | 'array_syntax' => ['syntax' => 'short'], 16 | 'ordered_imports' => ['sort_algorithm' => 'alpha'], 17 | 'no_unused_imports' => true, 18 | 'not_operator_with_successor_space' => true, 19 | 'trailing_comma_in_multiline' => true, 20 | 'phpdoc_scalar' => true, 21 | 'unary_operator_spaces' => true, 22 | 'binary_operator_spaces' => true, 23 | 'blank_line_before_statement' => [ 24 | 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], 25 | ], 26 | 'phpdoc_single_line_var_spacing' => true, 27 | 'phpdoc_var_without_name' => true, 28 | 'class_attributes_separation' => [ 29 | 'elements' => [ 30 | 'method' => 'one', 31 | ], 32 | ], 33 | 'method_argument_space' => [ 34 | 'on_multiline' => 'ensure_fully_multiline', 35 | 'keep_multiple_spaces_after_comma' => true, 36 | ], 37 | 'single_trait_insert_per_statement' => true, 38 | ]) 39 | ->setFinder($finder); -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to LaravelMCP 2 | 3 | We love your input! We want to make contributing to LaravelMCP as easy and transparent as possible, whether it's: 4 | 5 | - Reporting a bug 6 | - Discussing the current state of the code 7 | - Submitting a fix 8 | - Proposing new features 9 | - Becoming a maintainer 10 | 11 | ## We Develop with Github 12 | We use GitHub to host code, to track issues and feature requests, as well as accept pull requests. 13 | 14 | ## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html) 15 | Pull requests are the best way to propose changes to the codebase. We actively welcome your pull requests: 16 | 17 | 1. Fork the repo and create your branch from `main`. 18 | 2. If you've added code that should be tested, add tests. 19 | 3. If you've changed APIs, update the documentation. 20 | 4. Ensure the test suite passes. 21 | 5. Make sure your code lints. 22 | 6. Issue that pull request! 23 | 24 | ## Any contributions you make will be under the MIT Software License 25 | In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. 26 | 27 | ## Report bugs using Github's [issue tracker](https://github.com/laravelmcp/mcp/issues) 28 | We use GitHub issues to track public bugs. Report a bug by [opening a new issue](https://github.com/laravelmcp/mcp/issues/new); it's that easy! 29 | 30 | ## Write bug reports with detail, background, and sample code 31 | 32 | **Great Bug Reports** tend to have: 33 | 34 | - A quick summary and/or background 35 | - Steps to reproduce 36 | - Be specific! 37 | - Give sample code if you can. 38 | - What you expected would happen 39 | - What actually happens 40 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 41 | 42 | ## Use a Consistent Coding Style 43 | 44 | * Use PHP 8.1+ features 45 | * Follow PSR-12 coding standards 46 | * 4 spaces for indentation rather than tabs 47 | * You can try running `composer cs-fix` for style unification 48 | 49 | ## License 50 | By contributing, you agree that your contributions will be licensed under its MIT License. -------------------------------------------------------------------------------- /FILE_INDEX.md: -------------------------------------------------------------------------------- 1 | # Laravel MCP File Index 2 | 3 | ## Root Directory 4 | - `README.md` - Main documentation and usage guide 5 | - `composer.json` - Package dependencies and metadata 6 | - `composer.lock` - Locked package versions 7 | - `phpunit.xml` - PHPUnit test configuration 8 | - `phpstan.neon` - PHPStan static analysis configuration 9 | - `phpcs.xml` - PHP CodeSniffer configuration 10 | - `.php-cs-fixer.php` - PHP CS Fixer configuration 11 | - `.env.example` - Example environment configuration 12 | - `CONTRIBUTING.md` - Contribution guidelines 13 | - `LICENSE.md` - MIT license details 14 | - `check.bat` - Windows batch script for running checks 15 | 16 | ## Source Code (`src/`) 17 | ### Core Files 18 | - `MCPServiceProvider.php` - Laravel service provider for MCP 19 | - `MCPClient.php` - Main client implementation 20 | - `Root.php` - Root management implementation 21 | - `Implementation.php` - Base implementation class 22 | 23 | ### Directories 24 | - `Contracts/` - Interface definitions 25 | - `Capabilities/` - Feature capability implementations 26 | - `Logging/` - Logging system implementation 27 | - `Pagination/` - Pagination support classes 28 | - `Requests/` - Request handling classes 29 | - `Notifications/` - Progress notification system 30 | - `Sampling/` - Sampling functionality 31 | - `Transport/` - Transport layer implementations (HTTP, WebSocket, Stdio) 32 | - `Commands/` - Artisan command implementations 33 | - `Server/` - Server-side implementations 34 | - `Facades/` - Laravel facade implementations 35 | 36 | ## Examples (`examples/`) 37 | - `README.md` - Examples documentation 38 | - `http_server.php` - HTTP transport server example 39 | - `http_client.php` - HTTP transport client example 40 | - `websocket_server.php` - WebSocket transport server example 41 | - `websocket_client.php` - WebSocket transport client example 42 | - `cli_tool.php` - Command-line interface example 43 | 44 | ## Tests (`tests/`) 45 | ### Core Test Files 46 | - `TestCase.php` - Base test case class 47 | 48 | ### Test Directories 49 | - `Unit/` - Unit tests 50 | - `Feature/` - Feature tests 51 | - `Transport/` - Transport layer tests 52 | - `Commands/` - Command tests 53 | - `Facades/` - Facade tests 54 | - `Server/` - Server implementation tests 55 | 56 | ## Configuration (`config/`) 57 | - Configuration files for the package 58 | 59 | ## GitHub Workflows (`.github/`) 60 | - GitHub Actions workflow configurations 61 | 62 | ## Build and Cache Directories 63 | - `build/` - Build artifacts 64 | - `vendor/` - Composer dependencies 65 | - `.phpunit.cache/` - PHPUnit cache 66 | - `.git/` - Git repository data 67 | 68 | ## Development Configuration Files 69 | - `.gitignore` - Git ignore rules 70 | - `.php-cs-fixer.cache` - PHP CS Fixer cache 71 | - `phpunit.xml.bak` - PHPUnit configuration backup 72 | - `.phpunit.result.cache` - PHPUnit results cache 73 | 74 | ## Directory Structure 75 | ``` 76 | laravelmcp/ 77 | ├── src/ # Source code 78 | │ ├── Contracts/ # Interfaces 79 | │ ├── Capabilities/ # Feature implementations 80 | │ ├── Transport/ # Transport implementations 81 | │ └── ... # Other components 82 | ├── tests/ # Test suite 83 | │ ├── Unit/ # Unit tests 84 | │ ├── Feature/ # Feature tests 85 | │ └── ... # Other test categories 86 | ├── examples/ # Example implementations 87 | ├── config/ # Configuration files 88 | └── .github/ # GitHub configurations 89 | ``` 90 | 91 | ## Key Components 92 | 1. **Core Implementation** 93 | - `MCPClient.php` - Main client class 94 | - `MCPServiceProvider.php` - Service provider 95 | - `Root.php` - Root management 96 | 97 | 2. **Transport Layer** 98 | - HTTP implementation 99 | - WebSocket implementation 100 | - Stdio implementation 101 | 102 | 3. **Feature Modules** 103 | - Capabilities system 104 | - Logging system 105 | - Pagination support 106 | - Notification system 107 | - Resource management 108 | 109 | 4. **Development Tools** 110 | - PHPUnit for testing 111 | - PHPStan for static analysis 112 | - PHP CS Fixer for code style 113 | - Composer for dependency management -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2024 LaravelMCP 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /check.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | echo Running PHP CS Fixer... 3 | set PHP_CS_FIXER_IGNORE_ENV=1 4 | vendor\bin\php-cs-fixer fix 5 | if errorlevel 1 ( 6 | echo PHP CS Fixer found issues 7 | exit /b 1 8 | ) 9 | 10 | echo. 11 | echo Running PHP_CodeSniffer... 12 | vendor\bin\phpcs --standard=phpcs.xml 13 | if errorlevel 1 ( 14 | echo PHP_CodeSniffer found issues 15 | exit /b 1 16 | ) 17 | 18 | echo. 19 | echo Running PHPStan... 20 | vendor\bin\phpstan analyse 21 | if errorlevel 1 ( 22 | echo PHPStan found issues 23 | exit /b 1 24 | ) 25 | 26 | echo. 27 | echo Running PHPUnit... 28 | vendor\bin\phpunit 29 | if errorlevel 1 ( 30 | echo PHPUnit tests failed 31 | exit /b 1 32 | ) 33 | 34 | echo. 35 | echo All checks passed successfully! -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: yes 3 | notify: 4 | wait_for_ci: yes 5 | 6 | coverage: 7 | precision: 2 8 | round: down 9 | range: "70...100" 10 | status: 11 | project: 12 | default: 13 | target: 80% # the required coverage value 14 | threshold: 1% # the leniency in hitting the target 15 | patch: 16 | default: 17 | target: 80% 18 | threshold: 1% 19 | 20 | parsers: 21 | gcov: 22 | branch_detection: 23 | conditional: yes 24 | loop: yes 25 | method: no 26 | macro: no 27 | 28 | comment: 29 | layout: "reach,diff,flags,files" 30 | behavior: default 31 | require_changes: false 32 | require_base: no 33 | require_head: no 34 | 35 | ignore: 36 | - "tests/**/*" 37 | - "examples/**/*" 38 | - "config/**/*" -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravelmcp/mcp", 3 | "description": "Laravel implementation of the Model Context Protocol (MCP) SDK", 4 | "type": "library", 5 | "license": "MIT", 6 | "keywords": [ 7 | "laravel", 8 | "mcp", 9 | "model-context-protocol", 10 | "sdk" 11 | ], 12 | "homepage": "https://github.com/laravelmcp/mcp", 13 | "support": { 14 | "issues": "https://github.com/laravelmcp/mcp/issues", 15 | "source": "https://github.com/laravelmcp/mcp" 16 | }, 17 | "authors": [ 18 | { 19 | "name": "Mohamed Abdelmenem", 20 | "email": "mohamedabdelmenem01@gmail.com" 21 | } 22 | ], 23 | "require": { 24 | "php": "^8.1", 25 | "cboden/ratchet": "^0.4.4", 26 | "guzzlehttp/guzzle": "^7.0", 27 | "illuminate/support": "^10.0", 28 | "ratchet/pawl": "^0.4.3", 29 | "react/http": "^1.9", 30 | "react/socket": "^1.12" 31 | }, 32 | "require-dev": { 33 | "friendsofphp/php-cs-fixer": "^3.49", 34 | "mockery/mockery": "^1.6", 35 | "orchestra/testbench": "^8.0", 36 | "phpstan/phpstan": "^1.10", 37 | "phpstan/phpstan-mockery": "^1.1", 38 | "phpunit/phpunit": "^10.0", 39 | "nette/php-generator": "^4.1", 40 | "squizlabs/php_codesniffer": "^3.8" 41 | }, 42 | "autoload": { 43 | "psr-4": { 44 | "LaravelMCP\\MCP\\": "src/" 45 | } 46 | }, 47 | "autoload-dev": { 48 | "psr-4": { 49 | "Tests\\": "tests/" 50 | } 51 | }, 52 | "extra": { 53 | "laravel": { 54 | "providers": [ 55 | "LaravelMCP\\MCP\\MCPServiceProvider" 56 | ], 57 | "aliases": { 58 | "MCP": "LaravelMCP\\MCP\\Facades\\MCP" 59 | } 60 | } 61 | }, 62 | "config": { 63 | "sort-packages": true, 64 | "allow-plugins": { 65 | "php-http/discovery": true 66 | } 67 | }, 68 | "scripts": { 69 | "docs": "php scripts/generate-docs.php", 70 | "test": "phpunit", 71 | "cs": "php-cs-fixer fix", 72 | "stan": "phpstan analyse" 73 | }, 74 | "minimum-stability": "dev", 75 | "prefer-stable": true 76 | } 77 | -------------------------------------------------------------------------------- /config/mcp.php: -------------------------------------------------------------------------------- 1 | env('MCP_SERVER_NAME', 'Laravel MCP'), 14 | 'server_version' => env('MCP_SERVER_VERSION', '1.0.0'), 15 | 'base_url' => env('MCP_BASE_URL', 'https://api.mcp.example.com'), 16 | 'api_key' => env('MCP_API_KEY'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Server Capabilities 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Configure which MCP capabilities your server supports. 24 | | 25 | */ 26 | 27 | 'capabilities' => [ 28 | 'prompts' => [ 29 | 'listChanged' => true, 30 | ], 31 | 'resources' => [ 32 | 'subscribe' => true, 33 | 'listChanged' => true, 34 | ], 35 | 'tools' => [ 36 | 'listChanged' => true, 37 | ], 38 | 'logging' => true, 39 | 'completion' => true, 40 | ], 41 | 42 | /* 43 | |-------------------------------------------------------------------------- 44 | | Default Settings 45 | |-------------------------------------------------------------------------- 46 | | 47 | | Here you can set default values for various MCP operations. 48 | | 49 | */ 50 | 51 | 'defaults' => [ 52 | 'timeout' => env('MCP_TIMEOUT', 30), 53 | 'retry_attempts' => env('MCP_RETRY_ATTEMPTS', 3), 54 | 'max_connections' => env('MCP_MAX_CONNECTIONS', 100), 55 | ], 56 | 57 | /* 58 | |-------------------------------------------------------------------------- 59 | | Transport Settings 60 | |-------------------------------------------------------------------------- 61 | | 62 | | Configure how the MCP server communicates with clients. 63 | | 64 | */ 65 | 66 | 'transport' => [ 67 | 'type' => env('MCP_TRANSPORT_TYPE', 'http'), // http, websocket, stdio 68 | 'host' => env('MCP_HOST', '127.0.0.1'), 69 | 'port' => env('MCP_PORT', 3000), 70 | ], 71 | ]; -------------------------------------------------------------------------------- /docs/api/_ .md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### boot 8 | 9 | Bootstrap any application services. 10 | 11 | This method is called after all other service providers have been 12 | registered. It sets up console commands and performs any other 13 | required bootstrapping. 14 | 15 | -------------------------------------------------------------------------------- /docs/api/_CompletionRequest.md: -------------------------------------------------------------------------------- 1 | # CompletionRequest 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### __construct 8 | 9 | ### getType 10 | 11 | ### getArguments 12 | 13 | ### getMethod 14 | 15 | ### getParams 16 | 17 | ### create 18 | 19 | -------------------------------------------------------------------------------- /docs/api/_FastMCP.md: -------------------------------------------------------------------------------- 1 | # FastMCP 2 | 3 | Namespace: `` 4 | 5 | A fast implementation of the MCP server interface. 6 | 7 | This class provides a lightweight and efficient implementation of the MCP server 8 | with support for tools, resources, prompts, and lifecycle management. 9 | 10 | @package LaravelMCP\MCP\Server 11 | 12 | ## Methods 13 | 14 | ### __construct 15 | 16 | Create a new FastMCP instance. 17 | 18 | @param MCPServerInterface|null $server Optional server instance to use 19 | 20 | ### tool 21 | 22 | Register a tool with the server. 23 | 24 | @param string $name Tool name 25 | @param array $parameters Tool parameters 26 | @return Closure Registration handler 27 | 28 | ### resource 29 | 30 | Register a resource with the server. 31 | 32 | @param string $uri Resource URI 33 | @return Closure Registration handler 34 | 35 | ### prompt 36 | 37 | Register a prompt with the server. 38 | 39 | @param string $name Prompt name 40 | @param array $arguments Prompt arguments 41 | @return Closure Registration handler 42 | 43 | ### lifespan 44 | 45 | Set the server lifecycle handler. 46 | 47 | @param Closure $handler Lifecycle handler function 48 | 49 | ### getServer 50 | 51 | Get the underlying server instance. 52 | 53 | @return MCPServerInterface 54 | 55 | ### getDependencies 56 | 57 | Get the list of server dependencies. 58 | 59 | @return array 60 | 61 | ### getLifespan 62 | 63 | Get the server lifecycle handler. 64 | 65 | @return Closure|null 66 | 67 | ### handleCompletion 68 | 69 | Handle completion requests. 70 | 71 | @param array $arguments Completion arguments 72 | @param array $messages Message history 73 | @return array Completion response 74 | 75 | -------------------------------------------------------------------------------- /docs/api/_HttpClientTransport.md: -------------------------------------------------------------------------------- 1 | # HttpClientTransport 2 | 3 | Namespace: `` 4 | 5 | HTTP client-based transport implementation for the MCP system. 6 | 7 | This transport uses Guzzle HTTP client to communicate with the MCP server 8 | over HTTP/HTTPS. It supports: 9 | - Authenticated requests using API keys 10 | - JSON-based message exchange 11 | - Message queueing for asynchronous processing 12 | 13 | @package LaravelMCP\MCP\Transport 14 | 15 | ## Methods 16 | 17 | ### __construct 18 | 19 | Create a new HTTP client transport instance. 20 | 21 | Initializes the Guzzle client with the provided base URL and API key. 22 | The client is configured to: 23 | - Use the base URL for all requests 24 | - Include the API key in Authorization header 25 | - Use JSON for request/response content 26 | 27 | @param string $baseUrl The base URL of the MCP server 28 | @param string $apiKey The API key for authentication 29 | 30 | ### start 31 | 32 | Start the transport. 33 | 34 | Marks the transport as running, enabling message sending and receiving. 35 | 36 | ### stop 37 | 38 | Stop the transport. 39 | 40 | Marks the transport as stopped, preventing further message processing. 41 | 42 | ### send 43 | 44 | Send data to the MCP server. 45 | 46 | Sends a POST request to the server's root endpoint with the provided 47 | data as JSON. If the server responds with valid JSON, it is added 48 | to the message queue for processing. 49 | 50 | @param array $data The data to send to the server 51 | @throws \GuzzleHttp\Exception\GuzzleException When the HTTP request fails 52 | @throws \JsonException When JSON decoding fails 53 | 54 | ### receive 55 | 56 | Receive data from the message queue. 57 | 58 | Returns and removes the next message from the queue. 59 | If the queue is empty, returns an empty array. 60 | 61 | @return array The next message or an empty array if none available 62 | 63 | ### isRunning 64 | 65 | Check if the transport is running. 66 | 67 | @return bool True if the transport is running, false otherwise 68 | 69 | -------------------------------------------------------------------------------- /docs/api/_HttpTransport.md: -------------------------------------------------------------------------------- 1 | # HttpTransport 2 | 3 | Namespace: `` 4 | 5 | HTTP server-based transport implementation for the MCP system. 6 | 7 | This transport creates an HTTP server that listens for incoming requests 8 | and forwards them to the MCP server. It supports: 9 | - HTTP/HTTPS communication 10 | - Request/response handling 11 | - Message queueing 12 | - Multiple client connections 13 | 14 | @package LaravelMCP\MCP\Transport 15 | 16 | ## Methods 17 | 18 | ### __construct 19 | 20 | Create a new HTTP transport instance. 21 | 22 | Initializes the HTTP server with the provided MCP server instance 23 | and configuration. The server is configured to: 24 | - Listen on the specified host and port 25 | - Handle incoming HTTP requests 26 | - Forward requests to the MCP server 27 | 28 | @param MCPServerInterface $server The MCP server instance 29 | @param array $config Configuration options: 30 | - host: string - The host to listen on (default: 127.0.0.1) 31 | - port: int - The port to listen on (default: 8080) 32 | 33 | ### start 34 | 35 | Start the transport. 36 | 37 | Starts the HTTP server, begins listening for connections, 38 | and runs the event loop. 39 | 40 | ### stop 41 | 42 | Stop the transport. 43 | 44 | Stops the HTTP server, closes all connections, 45 | and stops the event loop. 46 | 47 | ### send 48 | 49 | Send data to connected clients. 50 | 51 | Adds the data to the message queue for processing. 52 | The data will be sent to clients on their next request. 53 | 54 | @param array $data The data to send 55 | 56 | ### receive 57 | 58 | Receive data from the message queue. 59 | 60 | Returns and removes the next message from the queue. 61 | If the queue is empty, returns an empty array. 62 | 63 | @return array The next message or an empty array if none available 64 | 65 | ### isRunning 66 | 67 | Check if the transport is running. 68 | 69 | @return bool True if the transport is running, false otherwise 70 | 71 | ### handleRequest 72 | 73 | Handle an incoming HTTP request. 74 | 75 | Processes the request and generates an appropriate response. 76 | The request is forwarded to the MCP server for processing, 77 | and the result is returned as a JSON response. 78 | 79 | @param ServerRequestInterface $request The incoming HTTP request 80 | @return ResponseInterface The HTTP response 81 | 82 | ### processMessage 83 | 84 | Process a message through the MCP server. 85 | 86 | Internal method that forwards a message to the MCP server 87 | for processing and returns the result. 88 | 89 | @param array $data The message data to process 90 | @return array The processing result 91 | 92 | -------------------------------------------------------------------------------- /docs/api/_Implementation.md: -------------------------------------------------------------------------------- 1 | # Implementation 2 | 3 | Namespace: `` 4 | 5 | Base class for MCP system implementations. 6 | 7 | This class provides a foundation for implementing various components 8 | in the MCP system. It includes common functionality and utilities 9 | that can be shared across different implementations. 10 | 11 | The class supports: 12 | - Serialization to array format 13 | - Creation from array data 14 | - Common implementation patterns 15 | 16 | @package LaravelMCP\MCP 17 | 18 | ## Methods 19 | 20 | ### __construct 21 | 22 | Create a new implementation instance. 23 | 24 | @param string $name The name of the implementation 25 | @param string $version The version identifier of the implementation 26 | 27 | ### getName 28 | 29 | Get the implementation's name. 30 | 31 | Returns the name that identifies this implementation. 32 | This is typically used for registration and lookup purposes. 33 | 34 | @return string The implementation name 35 | 36 | ### getVersion 37 | 38 | Get the implementation's version. 39 | 40 | Returns the version identifier of this implementation. 41 | This can be used for version checking and compatibility. 42 | 43 | @return string The version identifier 44 | 45 | ### toArray 46 | 47 | Convert the implementation to an array format. 48 | 49 | Creates an array containing the implementation's core properties. 50 | The base implementation includes: 51 | - name: The implementation name 52 | - version: The version identifier 53 | 54 | Child classes can override this method to include additional 55 | properties specific to their implementation. 56 | 57 | @return array The implementation data as a key-value array 58 | 59 | ### create 60 | 61 | Create a new instance from an array of data. 62 | 63 | Factory method that creates an implementation instance from 64 | an array of data. The array must contain: 65 | - name: The implementation name 66 | - version: The version identifier 67 | 68 | @param array $data The data to create the instance from 69 | @return static A new instance of the implementation 70 | @throws \InvalidArgumentException If required data is missing 71 | 72 | -------------------------------------------------------------------------------- /docs/api/_LoggingMessageNotification.md: -------------------------------------------------------------------------------- 1 | # LoggingMessageNotification 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### __construct 8 | 9 | ### getMethod 10 | 11 | ### getParams 12 | 13 | ### getType 14 | 15 | Get the type of the notification. 16 | 17 | @return string The notification type identifier 18 | 19 | ### getData 20 | 21 | Get the data associated with the notification. 22 | 23 | @return array The notification data 24 | 25 | -------------------------------------------------------------------------------- /docs/api/_MCP.md: -------------------------------------------------------------------------------- 1 | # MCP 2 | 3 | Namespace: `` 4 | 5 | @method static void addTool(string $name, callable $handler, ?string $description = null) 6 | @method static void addToolInterface(ToolInterface $tool) 7 | @method static void addResource(string $uri, mixed $content, ?string $mimeType = null, ?string $description = null) 8 | @method static void addResourceInterface(ResourceInterface $resource) 9 | @method static void addResourceTemplate(ResourceTemplateInterface $template) 10 | @method static void addPrompt(string $name, array $messages, ?string $description = null) 11 | @method static void addPromptInterface(PromptInterface $prompt) 12 | 13 | ## Methods 14 | 15 | ### getFacadeAccessor 16 | 17 | Get the registered name of the component. 18 | 19 | @return string 20 | 21 | -------------------------------------------------------------------------------- /docs/api/_MCPServer.md: -------------------------------------------------------------------------------- 1 | # MCPServer 2 | 3 | Namespace: `` 4 | 5 | The main MCP (Model-Controller-Prompt) server implementation. 6 | 7 | This class serves as the core of the MCP system, managing tools, resources, 8 | prompts, and handling communication through the transport layer. It provides 9 | a robust platform for building AI-powered applications with Laravel. 10 | 11 | The server supports: 12 | - Tool registration and execution 13 | - Resource management and templating 14 | - Prompt handling and processing 15 | - Progress tracking and logging 16 | - Model preference configuration 17 | 18 | @package LaravelMCP\MCP\Server 19 | 20 | ## Methods 21 | 22 | ### __construct 23 | 24 | Create a new MCP server instance. 25 | 26 | ### setTransport 27 | 28 | Set the transport layer for the server. 29 | 30 | @param TransportInterface $transport The transport to use 31 | 32 | ### getTransport 33 | 34 | Get the current transport layer. 35 | 36 | @return TransportInterface|null The current transport or null if not set 37 | 38 | ### initialize 39 | 40 | {@inheritdoc} 41 | 42 | ### registerTool 43 | 44 | {@inheritdoc} 45 | 46 | ### registerResource 47 | 48 | {@inheritdoc} 49 | 50 | ### getCapabilities 51 | 52 | {@inheritdoc} 53 | 54 | ### handleToolCall 55 | 56 | {@inheritdoc} 57 | 58 | ### handleResourceRequest 59 | 60 | {@inheritdoc} 61 | 62 | ### handlePromptRequest 63 | 64 | {@inheritdoc} 65 | 66 | ### getTools 67 | 68 | {@inheritdoc} 69 | 70 | ### getResources 71 | 72 | {@inheritdoc} 73 | 74 | ### getResourceTemplates 75 | 76 | {@inheritdoc} 77 | 78 | ### getPrompts 79 | 80 | {@inheritdoc} 81 | 82 | ### getRoots 83 | 84 | {@inheritdoc} 85 | 86 | ### addTool 87 | 88 | Add a tool to the server. 89 | 90 | @param string $name The unique identifier for the tool 91 | @param callable $handler The function that implements the tool's logic 92 | @param string|null $description Optional description of the tool's purpose 93 | 94 | ### addResource 95 | 96 | Add a resource to the server. 97 | 98 | @param string $uri The URI identifier for the resource 99 | @param mixed $content The resource content 100 | @param string|null $mimeType Optional MIME type of the resource 101 | @param string|null $description Optional description of the resource 102 | @throws \RuntimeException If a resource with the given URI already exists 103 | 104 | ### addResourceTemplate 105 | 106 | Add a resource template to the server. 107 | 108 | @param string $uri The URI for the resource template 109 | @param ResourceTemplateInterface $template The resource template to add 110 | @throws RuntimeException If a resource with the given URI already exists 111 | 112 | ### addPrompt 113 | 114 | {@inheritdoc} 115 | 116 | ### addRoot 117 | 118 | {@inheritdoc} 119 | 120 | ### handleCompletion 121 | 122 | {@inheritdoc} 123 | 124 | ### sendProgress 125 | 126 | {@inheritdoc} 127 | 128 | ### sendLog 129 | 130 | {@inheritdoc} 131 | 132 | ### getModelPreferences 133 | 134 | {@inheritdoc} 135 | 136 | ### setModelPreferences 137 | 138 | {@inheritdoc} 139 | 140 | ### start 141 | 142 | {@inheritdoc} 143 | 144 | ### stop 145 | 146 | {@inheritdoc} 147 | 148 | ### addToolInterface 149 | 150 | {@inheritdoc} 151 | 152 | ### addResourceInterface 153 | 154 | {@inheritdoc} 155 | 156 | ### addPromptInterface 157 | 158 | {@inheritdoc} 159 | 160 | ### getResource 161 | 162 | Get a registered resource by URI. 163 | 164 | @param string $uri The URI of the resource 165 | @return ResourceInterface|null The resource or null if not found 166 | 167 | ### getPrompt 168 | 169 | Get a registered prompt by name. 170 | 171 | @param string $name The name of the prompt 172 | @return PromptInterface|null The prompt or null if not found 173 | 174 | ### getHandler 175 | 176 | Get the handler for a prompt. 177 | 178 | @param string $name The name of the prompt 179 | @return callable|null The handler or null if not found 180 | 181 | ### registerPrompt 182 | 183 | Register a new prompt with the server. 184 | 185 | @param string $name The name of the prompt 186 | @param callable $handler The handler function for the prompt 187 | @param array $arguments Optional arguments for the prompt 188 | @return void 189 | 190 | ### hasResource 191 | 192 | Check if a resource exists with the given URI. 193 | 194 | @param string $uri The URI to check 195 | @return bool True if the resource exists, false otherwise 196 | 197 | ### removeResource 198 | 199 | Remove a resource with the given URI. 200 | 201 | @param string $uri The URI of the resource to remove 202 | @throws RuntimeException If the resource does not exist 203 | 204 | -------------------------------------------------------------------------------- /docs/api/_MCPServerCommand.md: -------------------------------------------------------------------------------- 1 | # MCPServerCommand 2 | 3 | Namespace: `` 4 | 5 | Artisan command for managing the MCP server. 6 | 7 | This command provides a CLI interface for starting, stopping, and managing 8 | the MCP server within a Laravel application. It handles server initialization, 9 | transport setup, and event loop management. 10 | 11 | Usage: 12 | ```bash 13 | # Start with default settings (HTTP transport) 14 | php artisan mcp:serve 15 | 16 | # Start with custom transport and host 17 | php artisan mcp:serve --transport=websocket --host=0.0.0.0 18 | 19 | # Start with custom port 20 | php artisan mcp:serve --port=9000 21 | ``` 22 | 23 | Features: 24 | - Multiple transport options (HTTP, WebSocket, stdio) 25 | - Configurable host and port bindings 26 | - Signal handling for graceful shutdown 27 | - Event loop integration 28 | - Error handling and reporting 29 | 30 | @package LaravelMCP\MCP\Commands 31 | 32 | ## Methods 33 | 34 | ### __construct 35 | 36 | Create a new command instance. 37 | 38 | Initializes the command with its dependencies: 39 | - MCP server for handling requests 40 | - Transport factory for creating communication layers 41 | - Event loop for asynchronous operations 42 | 43 | @param MCPServerInterface $server The MCP server instance 44 | @param TransportFactory $transportFactory Factory for creating transports 45 | @param LoopInterface $loop The event loop instance 46 | 47 | ### handle 48 | 49 | Execute the console command. 50 | 51 | This method: 52 | 1. Validates command options 53 | 2. Creates and configures the transport 54 | 3. Initializes the server 55 | 4. Sets up signal handlers (if available) 56 | 5. Starts the event loop 57 | 58 | Signal handling (POSIX systems only): 59 | - SIGINT (Ctrl+C): Graceful shutdown 60 | - SIGTERM: Graceful shutdown 61 | 62 | Error handling: 63 | - Invalid transport type 64 | - Invalid host address 65 | - Invalid port number 66 | - Server initialization failures 67 | 68 | @return int 0 on success, 1 on failure 69 | 70 | -------------------------------------------------------------------------------- /docs/api/_MCPServiceProvider.md: -------------------------------------------------------------------------------- 1 | # MCPServiceProvider 2 | 3 | Namespace: `` 4 | 5 | Service provider for the MCP system in Laravel. 6 | 7 | This provider is responsible for registering the MCP system's services, 8 | commands, and bindings with the Laravel service container. It handles 9 | the initialization and configuration of the MCP system within a Laravel 10 | application. 11 | 12 | Services registered: 13 | - MCPServerInterface -> FastMCP (singleton) 14 | - TransportFactory (singleton) 15 | - LoopInterface -> React EventLoop (singleton) 16 | - MCPServerCommand (singleton) 17 | 18 | Configuration: 19 | - Publishes config/mcp.php to the application's config directory 20 | - Configuration can be customized through the published config file 21 | 22 | Commands: 23 | - mcp:server: Starts the MCP server with the configured transport 24 | 25 | @package LaravelMCP\MCP 26 | 27 | ## Methods 28 | 29 | ### register 30 | 31 | Register any application services. 32 | 33 | This method binds the MCP system's core services to the container: 34 | 1. MCPServerInterface -> FastMCP implementation 35 | 2. TransportFactory for creating transport instances 36 | 3. React EventLoop for handling async operations 37 | 4. MCPServerCommand for CLI interaction 38 | 39 | All services are registered as singletons to ensure consistent 40 | state across the application. 41 | 42 | ### boot 43 | 44 | Bootstrap any application services. 45 | 46 | This method is called after all other service providers have been 47 | registered. It performs the following tasks: 48 | 1. Publishes the MCP configuration file to config/mcp.php 49 | 2. Registers the mcp:server command for CLI usage 50 | 51 | These operations only run when the application is executed from 52 | the command line (php artisan). 53 | 54 | -------------------------------------------------------------------------------- /docs/api/_ModelPreferences.md: -------------------------------------------------------------------------------- 1 | # ModelPreferences 2 | 3 | Namespace: `` 4 | 5 | Configuration class for model sampling preferences in the MCP system. 6 | 7 | This class encapsulates various parameters that control how language models 8 | generate responses. It allows fine-tuning of the sampling process to achieve 9 | different types of outputs, from deterministic to highly creative. 10 | 11 | Preferences can control: 12 | - Temperature (randomness) 13 | - Top-p sampling 14 | - Maximum tokens 15 | - Stop sequences 16 | - Frequency penalties 17 | - Presence penalties 18 | 19 | @package LaravelMCP\MCP\Sampling 20 | 21 | ## Methods 22 | 23 | ### __construct 24 | 25 | Create a new model preferences instance. 26 | 27 | @param float|null $temperature Controls randomness in generation (0.0 to 2.0) 28 | @param float|null $top_p Controls diversity via nucleus sampling (0.0 to 1.0) 29 | @param int|null $max_tokens Maximum tokens to generate, null for no limit 30 | @param array|null $stop Sequences that will stop generation 31 | @param float|null $frequency_penalty Penalty for frequent tokens (0.0 to 2.0) 32 | @param float|null $presence_penalty Penalty for token presence (0.0 to 2.0) 33 | @param float|null $cost_priority Priority for cost optimization (0.0 to 1.0) 34 | @param float|null $intelligence_priority Priority for intelligence optimization (0.0 to 1.0) 35 | @param float|null $speed_priority Priority for speed optimization (0.0 to 1.0) 36 | @param array|null $hints Hints for the model 37 | 38 | ### getTemperature 39 | 40 | Get the sampling temperature. 41 | 42 | Higher values make the output more random, while lower values 43 | make it more deterministic. 44 | 45 | @return float The temperature value (0.0 to 2.0) 46 | 47 | ### getTopP 48 | 49 | Get the nucleus sampling threshold. 50 | 51 | Controls diversity via nucleus sampling. A value of 1.0 considers 52 | all tokens, while lower values restrict to more likely tokens. 53 | 54 | @return float The top-p value (0.0 to 1.0) 55 | 56 | ### getMaxTokens 57 | 58 | Get the maximum number of tokens to generate. 59 | 60 | @return int|null The maximum tokens, or null for no limit 61 | 62 | ### getStop 63 | 64 | Get the stop sequences. 65 | 66 | These sequences will cause the model to stop generating 67 | when encountered. 68 | 69 | @return array The stop sequences 70 | 71 | ### getFrequencyPenalty 72 | 73 | Get the frequency penalty. 74 | 75 | Higher values reduce the likelihood of the model repeating 76 | the same tokens frequently. 77 | 78 | @return float The frequency penalty (0.0 to 2.0) 79 | 80 | ### getPresencePenalty 81 | 82 | Get the presence penalty. 83 | 84 | Higher values reduce the likelihood of the model repeating 85 | any token that has appeared in the text so far. 86 | 87 | @return float The presence penalty (0.0 to 2.0) 88 | 89 | ### getHints 90 | 91 | Get the hints for the model. 92 | 93 | @return array The hints for the model 94 | 95 | ### setHints 96 | 97 | Set the hints for the model. 98 | 99 | @param array $hints The new hints for the model 100 | 101 | ### getCostPriority 102 | 103 | Get the cost priority. 104 | 105 | @return float The cost priority (0.0 to 1.0) 106 | 107 | ### getIntelligencePriority 108 | 109 | Get the intelligence priority. 110 | 111 | @return float The intelligence priority (0.0 to 1.0) 112 | 113 | ### getSpeedPriority 114 | 115 | Get the speed priority. 116 | 117 | @return float The speed priority (0.0 to 1.0) 118 | 119 | ### toArray 120 | 121 | Convert the preferences to an array format. 122 | 123 | @return array The preferences as a key-value array 124 | 125 | ### create 126 | 127 | Create a new instance from an array of data. 128 | 129 | @param array $values The values to create the instance from 130 | @return static A new ModelPreferences instance 131 | 132 | -------------------------------------------------------------------------------- /docs/api/_PaginatedRequest.md: -------------------------------------------------------------------------------- 1 | # PaginatedRequest 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### __construct 8 | 9 | Create a new paginated request instance. 10 | 11 | ### getType 12 | 13 | Get the type of the request. 14 | 15 | ### getArguments 16 | 17 | Get the arguments associated with the request. 18 | 19 | ### getCursor 20 | 21 | Get the cursor. 22 | 23 | ### getMethod 24 | 25 | Get the request method name. 26 | 27 | ### getParams 28 | 29 | Get the request parameters. 30 | 31 | ### create 32 | 33 | Create a new instance from an array. 34 | 35 | -------------------------------------------------------------------------------- /docs/api/_PaginatedResult.md: -------------------------------------------------------------------------------- 1 | # PaginatedResult 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### __construct 8 | 9 | Create a new paginated result instance. 10 | 11 | ### getNextCursor 12 | 13 | Get the next cursor. 14 | 15 | ### toArray 16 | 17 | Convert the result to an array. 18 | 19 | ### create 20 | 21 | Create a new instance from an array. 22 | 23 | -------------------------------------------------------------------------------- /docs/api/_ProgressNotification.md: -------------------------------------------------------------------------------- 1 | # ProgressNotification 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### __construct 8 | 9 | ### getType 10 | 11 | ### getData 12 | 13 | ### getMethod 14 | 15 | ### getParams 16 | 17 | ### create 18 | 19 | -------------------------------------------------------------------------------- /docs/api/_Prompt.md: -------------------------------------------------------------------------------- 1 | # Prompt 2 | 3 | Namespace: `` 4 | 5 | Implementation of a prompt in the MCP system. 6 | 7 | A prompt represents an interactive element that can be presented to users 8 | or processed by the system. Each prompt has a unique name, a handler that 9 | processes requests, and a set of messages that define its content. 10 | 11 | Prompts can be used to: 12 | - Gather user input 13 | - Display system notifications 14 | - Process structured messages 15 | - Implement interactive workflows 16 | 17 | @package LaravelMCP\MCP\Server 18 | 19 | ## Methods 20 | 21 | ### __construct 22 | 23 | Create a new prompt instance. 24 | 25 | @param string $name The unique identifier for the prompt 26 | @param callable $handler The function that processes prompt requests 27 | @param string|null $description Optional description of the prompt 28 | 29 | ### getName 30 | 31 | {@inheritdoc} 32 | 33 | ### getMessages 34 | 35 | {@inheritdoc} 36 | 37 | ### getDescription 38 | 39 | {@inheritdoc} 40 | 41 | ### setDefaultArguments 42 | 43 | Set the default arguments for the prompt. 44 | 45 | @param array $arguments The default arguments 46 | 47 | ### getDefaultArguments 48 | 49 | Get the default arguments for the prompt. 50 | 51 | @return array The default arguments 52 | 53 | ### handle 54 | 55 | Handle a prompt request. 56 | 57 | @param array $arguments The arguments for the request 58 | @return array The response data 59 | 60 | ### getArguments 61 | 62 | {@inheritdoc} 63 | 64 | ### setMessages 65 | 66 | Set the messages for this prompt. 67 | 68 | @param array $messages The messages that make up the prompt's content 69 | 70 | ### getHandler 71 | 72 | Get the handler function for this prompt. 73 | 74 | @return callable The handler function 75 | 76 | -------------------------------------------------------------------------------- /docs/api/_PromptsCapability.md: -------------------------------------------------------------------------------- 1 | # PromptsCapability 2 | 3 | Namespace: `` 4 | 5 | Represents the prompts capability for server-side functionality. 6 | 7 | This class manages information about server-side prompt capabilities, 8 | including whether prompt handling is enabled and what prompts are 9 | available on the server. 10 | 11 | @package LaravelMCP\MCP\Capabilities\ServerCapabilities 12 | 13 | ## Methods 14 | 15 | ### __construct 16 | 17 | Create a new prompts capability instance. 18 | 19 | @param bool $enabled Whether prompt handling is enabled on the server 20 | @param array $prompts List of available server prompts 21 | 22 | ### isEnabled 23 | 24 | Check if prompt handling is enabled on the server. 25 | 26 | @return bool True if prompt handling is enabled, false otherwise 27 | 28 | ### getPrompts 29 | 30 | Get the list of available server prompts. 31 | 32 | @return array List of configured server prompts 33 | 34 | ### toArray 35 | 36 | Convert the capability to an array format. 37 | 38 | @return array The capability data as a key-value array 39 | 40 | ### create 41 | 42 | Create a new instance from an array of data. 43 | 44 | @param array $data The data to create the instance from 45 | @return static A new instance of the capability 46 | 47 | -------------------------------------------------------------------------------- /docs/api/_Resource.md: -------------------------------------------------------------------------------- 1 | # Resource 2 | 3 | Namespace: `` 4 | 5 | Implementation of a resource in the MCP system. 6 | 7 | A resource represents a piece of content that can be accessed through the 8 | MCP server. Resources can be static files, dynamic content, or data that 9 | is generated on demand. Each resource has a unique URI, content handler, 10 | and optional metadata like MIME type and description. 11 | 12 | Resources can be used to: 13 | - Serve static files 14 | - Generate dynamic content 15 | - Provide access to data stores 16 | - Implement API endpoints 17 | 18 | @package LaravelMCP\MCP\Server 19 | 20 | ## Methods 21 | 22 | ### __construct 23 | 24 | Create a new resource instance. 25 | 26 | @param string $uri The unique URI identifier for the resource 27 | @param callable $handler The function that provides the resource's content 28 | @param string|null $mimeType Optional MIME type of the content 29 | @param string|null $description Optional description of the resource 30 | 31 | ### getUri 32 | 33 | Get the resource's URI. 34 | 35 | The URI uniquely identifies this resource within the MCP server. 36 | It is used for routing requests and accessing the resource. 37 | 38 | @return string The resource's URI 39 | 40 | ### getContent 41 | 42 | Get the resource's content. 43 | 44 | Retrieves the content by invoking the resource's handler function. 45 | The content can be any type that the handler returns. 46 | 47 | @return mixed The resource's content 48 | 49 | ### getMimeType 50 | 51 | Get the resource's MIME type. 52 | 53 | The MIME type indicates the format of the resource's content. 54 | This is useful for HTTP responses and content negotiation. 55 | 56 | @return string|null The MIME type, or null if not specified 57 | 58 | ### getDescription 59 | 60 | Get the resource's description. 61 | 62 | The description provides information about the resource's purpose, 63 | usage, and any special considerations. 64 | 65 | @return string|null The description, or null if not specified 66 | 67 | ### handle 68 | 69 | Handle a request to this resource. 70 | 71 | This is the main entry point for accessing the resource's content. 72 | It invokes the handler function and returns its result. 73 | Unlike getContent(), this method is intended for request handling 74 | and may include additional processing in the future. 75 | 76 | @return mixed The result of handling the request 77 | 78 | ### getName 79 | 80 | Get the resource's name. 81 | 82 | The name is derived from the resource's URI and uniquely identifies 83 | the resource within the MCP server. 84 | 85 | @return string The resource's name (same as its URI) 86 | 87 | -------------------------------------------------------------------------------- /docs/api/_ResourceTemplate.md: -------------------------------------------------------------------------------- 1 | # ResourceTemplate 2 | 3 | Namespace: `` 4 | 5 | Implementation of a resource template in the MCP system. 6 | 7 | A resource template provides a way to generate dynamic resources based on 8 | predefined patterns. Templates can be used to create resources with similar 9 | characteristics but different content, or to generate resources based on 10 | user input or system state. 11 | 12 | Resource templates can be used to: 13 | - Generate dynamic resources 14 | - Create consistent resource structures 15 | - Implement resource factories 16 | - Handle parameterized resource creation 17 | 18 | @package LaravelMCP\MCP\Server 19 | 20 | ## Methods 21 | 22 | ### __construct 23 | 24 | Create a new resource template instance. 25 | 26 | @param string $name The unique identifier for the template 27 | @param string $uri The URI for generated resources 28 | @param array $parameters Optional parameters for the template 29 | @param string|null $mimeType Optional MIME type for generated resources 30 | @param string|null $description Optional description of the template 31 | @param array $annotations Optional annotations for the template 32 | 33 | ### getName 34 | 35 | Get the template's name. 36 | 37 | @return string The template name 38 | 39 | ### getUri 40 | 41 | Get the template's URI pattern. 42 | 43 | @return string The URI pattern 44 | 45 | ### getMimeType 46 | 47 | Get the template's MIME type. 48 | 49 | @return string|null The MIME type 50 | 51 | ### getDescription 52 | 53 | Get the template's description. 54 | 55 | @return string|null The description 56 | 57 | ### getAnnotations 58 | 59 | Get the template's annotations. 60 | 61 | @return array The annotations 62 | 63 | ### render 64 | 65 | Render the template with the given parameters. 66 | 67 | This method combines the provided parameters with the template's default parameters 68 | and uses them to render the URI pattern. The provided parameters take precedence 69 | over the template's default parameters. 70 | 71 | Example: 72 | Template URI: "/users/{id}/posts/{post_id}" 73 | Template parameters: ["id" => "default"] 74 | Provided parameters: ["post_id" => "123"] 75 | Result: "/users/default/posts/123" 76 | 77 | @param array $parameters Additional parameters to use for rendering 78 | @return string The rendered URI with all parameters replaced 79 | 80 | ### getUriTemplate 81 | 82 | Get the URI template pattern. 83 | 84 | Returns the raw URI pattern with parameter placeholders. 85 | This is useful when you need to inspect or manipulate the pattern 86 | before rendering. 87 | 88 | Example: 89 | If the URI is "/users/{id}/posts/{post_id}", 90 | this method returns that exact string without any parameter substitution. 91 | 92 | @return string The URI template pattern 93 | 94 | ### expandUri 95 | 96 | Expand the URI template with the given parameters. 97 | 98 | Similar to render(), but specifically for URI expansion. This method 99 | replaces parameters in the format "{param}" with their values. 100 | Unlike render(), this method: 101 | - Only uses the provided parameters (ignores template defaults) 102 | - Specifically handles URI parameter expansion 103 | - Maintains URI encoding 104 | 105 | Example: 106 | Template: "/users/{id}/posts/{post_id}" 107 | Parameters: ["id" => "123", "post_id" => "456"] 108 | Result: "/users/123/posts/456" 109 | 110 | @param array $parameters The parameters to expand with 111 | @return string The expanded URI 112 | 113 | ### getTemplate 114 | 115 | Get the template pattern. 116 | 117 | @return array The template pattern 118 | 119 | ### createResource 120 | 121 | Create a new resource from this template. 122 | 123 | Generates a new resource instance using this template's configuration 124 | and the provided arguments. The process involves: 125 | 1. Expanding the URI using the provided arguments 126 | 2. Generating the content using the template's logic 127 | 3. Creating a new Resource instance with the expanded URI and content 128 | 129 | The created resource inherits: 130 | - MIME type from the template 131 | - Description from the template 132 | - Annotations from the template 133 | 134 | @param array $arguments Arguments used to generate the resource 135 | @return ResourceInterface The created resource 136 | 137 | ### generateContent 138 | 139 | Generate content for a new resource. 140 | 141 | Internal method used by createResource() to generate the content 142 | for a new resource based on the template's configuration and 143 | the provided arguments. 144 | 145 | @param array $arguments Arguments used to generate the content 146 | @return mixed The generated content 147 | 148 | -------------------------------------------------------------------------------- /docs/api/_ResourcesCapability.md: -------------------------------------------------------------------------------- 1 | # ResourcesCapability 2 | 3 | Namespace: `` 4 | 5 | Represents the resources capability for server-side functionality. 6 | 7 | This class manages information about server-side resource capabilities, 8 | including whether resource handling is enabled and what resources are 9 | available on the server. 10 | 11 | @package LaravelMCP\MCP\Capabilities\ServerCapabilities 12 | 13 | ## Methods 14 | 15 | ### __construct 16 | 17 | Create a new resources capability instance. 18 | 19 | @param bool $enabled Whether resource handling is enabled on the server 20 | @param array $resources List of available server resources 21 | 22 | ### isEnabled 23 | 24 | Check if resource handling is enabled on the server. 25 | 26 | @return bool True if resource handling is enabled, false otherwise 27 | 28 | ### getResources 29 | 30 | Get the list of available server resources. 31 | 32 | @return array List of configured server resources 33 | 34 | ### toArray 35 | 36 | Convert the capability to an array format. 37 | 38 | @return array The capability data as a key-value array 39 | 40 | ### create 41 | 42 | Create a new instance from an array of data. 43 | 44 | @param array $data The data to create the instance from 45 | @return static A new instance of the capability 46 | 47 | -------------------------------------------------------------------------------- /docs/api/_Root.md: -------------------------------------------------------------------------------- 1 | # Root 2 | 3 | Namespace: `` 4 | 5 | Represents a root directory in the MCP system. 6 | 7 | A root defines a base directory path that can be used as a reference point 8 | for resolving relative paths and managing file system operations. Roots 9 | help organize and manage file system access in a structured way. 10 | 11 | Roots can be used to: 12 | - Define workspace boundaries 13 | - Resolve relative paths 14 | - Manage file system access 15 | - Organize project structure 16 | 17 | @package LaravelMCP\MCP 18 | 19 | ## Methods 20 | 21 | ### __construct 22 | 23 | Create a new root instance. 24 | 25 | @param string $uri The URI of the root directory 26 | @param string|null $name Optional name of the root 27 | @throws \InvalidArgumentException If the URI is invalid 28 | 29 | ### getUri 30 | 31 | Get the URI of the root directory. 32 | 33 | Returns the full URI of the root directory, including the 'file://' prefix. 34 | This URI can be used for file system operations and path resolution. 35 | 36 | @return string The complete URI of the root directory 37 | 38 | ### getName 39 | 40 | Get the name of the root. 41 | 42 | Returns the optional name assigned to this root directory. 43 | The name can be used for identification and organization purposes. 44 | 45 | @return string|null The root's name, or null if not set 46 | 47 | ### getPath 48 | 49 | Get the filesystem path of the root directory. 50 | 51 | Converts the URI to a filesystem path by removing the 'file://' prefix. 52 | This path can be used directly with filesystem operations. 53 | 54 | @return string The filesystem path 55 | 56 | ### toArray 57 | 58 | Convert the root to an array representation. 59 | 60 | Creates an array containing the root's properties for serialization 61 | or data transfer. The array includes: 62 | - uri: The complete URI of the root directory 63 | - name: The root's name (if set) 64 | 65 | @return array The array representation of the root 66 | 67 | ### create 68 | 69 | Create a new root instance from an array. 70 | 71 | Factory method that creates a root instance from an array of data. 72 | The array should contain: 73 | - uri: The URI of the root directory (required) 74 | - name: The name of the root (optional) 75 | 76 | @param array $data The data to create the root from 77 | @return static A new root instance 78 | @throws \InvalidArgumentException If required data is missing or invalid 79 | 80 | ### getDescription 81 | 82 | Get the description of the root. 83 | 84 | This method is part of a common interface pattern but currently 85 | returns null as root descriptions are not implemented. 86 | 87 | @return string|null Always returns null 88 | 89 | ### resolve 90 | 91 | Resolve a relative path against this root. 92 | 93 | Combines the root's path with a relative path to create a complete 94 | filesystem path. This method: 95 | 1. Removes the 'file://' prefix from the root URI 96 | 2. Combines it with the relative path 97 | 3. Normalizes directory separators 98 | 4. Ensures proper path separation 99 | 100 | Example: 101 | Root URI: 'file:///var/www' 102 | Relative path: 'app/config.php' 103 | Result: '/var/www/app/config.php' 104 | 105 | @param string $relativePath The relative path to resolve 106 | @return string The complete filesystem path 107 | 108 | -------------------------------------------------------------------------------- /docs/api/_ServerCapabilities.md: -------------------------------------------------------------------------------- 1 | # ServerCapabilities 2 | 3 | Namespace: `` 4 | 5 | Represents the capabilities of an MCP server. 6 | 7 | This class manages information about the various capabilities and features 8 | supported by an MCP server instance. It includes experimental features, 9 | logging configuration, and support for prompts, resources, and tools. 10 | 11 | Capability Categories: 12 | - Experimental: Beta or in-development features 13 | - Logging: Log levels, formats, and destinations 14 | - Prompts: Interactive message handling 15 | - Resources: Content and file management 16 | - Tools: Command execution and processing 17 | 18 | Configuration Format: 19 | ```php 20 | [ 21 | 'experimental' => [ 22 | 'feature_name' => true|false, 23 | // Other experimental flags 24 | ], 25 | 'logging' => { 26 | 'level' => 'debug|info|warning|error', 27 | 'format' => 'json|text', 28 | 'destination' => 'file|stdout' 29 | }, 30 | 'prompts' => [ 31 | // Prompt configuration 32 | ], 33 | 'resources' => [ 34 | // Resource configuration 35 | ], 36 | 'tools' => [ 37 | // Tool configuration 38 | ] 39 | ] 40 | ``` 41 | 42 | @package LaravelMCP\MCP\Capabilities 43 | 44 | ## Methods 45 | 46 | ### __construct 47 | 48 | Create a new server capabilities instance. 49 | 50 | Initializes a capabilities configuration with optional components. 51 | Each component can be null if the capability is not supported or 52 | not configured. 53 | 54 | Example: 55 | ```php 56 | $capabilities = new ServerCapabilities( 57 | experimental: ['new_feature' => true], 58 | logging: (object)['level' => 'debug'], 59 | prompts: new PromptsCapability(), 60 | resources: new ResourcesCapability(), 61 | tools: new ToolsCapability() 62 | ); 63 | ``` 64 | 65 | @param array|null $experimental Experimental features configuration 66 | @param object|null $logging Logging configuration 67 | @param PromptsCapability|null $prompts Prompts capability configuration 68 | @param ResourcesCapability|null $resources Resources capability configuration 69 | @param ToolsCapability|null $tools Tools capability configuration 70 | 71 | ### getExperimental 72 | 73 | Get the experimental features configuration. 74 | 75 | Returns the configuration for experimental or beta features. 76 | These features may not be stable and could change in future releases. 77 | 78 | @return array|null The experimental features configuration 79 | 80 | ### getLogging 81 | 82 | Get the logging configuration. 83 | 84 | Returns the configuration for log handling, including: 85 | - Log levels (debug, info, warning, error) 86 | - Output format (JSON, text) 87 | - Destination (file, stdout) 88 | 89 | @return object|null The logging configuration 90 | 91 | ### getPrompts 92 | 93 | Get the prompts capability configuration. 94 | 95 | Returns the configuration for handling interactive prompts, 96 | including message formats, validation rules, and handlers. 97 | 98 | @return PromptsCapability|null The prompts capability 99 | 100 | ### getResources 101 | 102 | Get the resources capability configuration. 103 | 104 | Returns the configuration for managing resources, including: 105 | - File handling 106 | - Content types 107 | - Access control 108 | - URI patterns 109 | 110 | @return ResourcesCapability|null The resources capability 111 | 112 | ### getTools 113 | 114 | Get the tools capability configuration. 115 | 116 | Returns the configuration for available tools, including: 117 | - Command handlers 118 | - Parameter validation 119 | - Execution rules 120 | - Security settings 121 | 122 | @return ToolsCapability|null The tools capability 123 | 124 | ### toArray 125 | 126 | Convert the capabilities to an array format. 127 | 128 | Transforms the capabilities configuration into a structured array 129 | that can be serialized or transmitted. Only includes non-null 130 | capabilities in the output. 131 | 132 | Example output: 133 | ```php 134 | [ 135 | 'experimental' => ['feature' => true], 136 | 'logging' => ['level' => 'debug'], 137 | 'prompts' => [...], 138 | 'resources' => [...], 139 | 'tools' => [...] 140 | ] 141 | ``` 142 | 143 | @return array The capabilities data as a key-value array 144 | 145 | ### create 146 | 147 | Create a new instance from an array of data. 148 | 149 | Factory method that constructs a ServerCapabilities instance from 150 | a configuration array. This is useful for deserializing stored 151 | configurations or processing API responses. 152 | 153 | Example: 154 | ```php 155 | $capabilities = ServerCapabilities::create([ 156 | 'experimental' => ['feature' => true], 157 | 'logging' => ['level' => 'debug'], 158 | 'prompts' => [...], 159 | 'resources' => [...], 160 | 'tools' => [...] 161 | ]); 162 | ``` 163 | 164 | @param array $data The data to create the instance from 165 | @return static A new instance of the capabilities 166 | 167 | -------------------------------------------------------------------------------- /docs/api/_StdioTransport.md: -------------------------------------------------------------------------------- 1 | # StdioTransport 2 | 3 | Namespace: `` 4 | 5 | Standard I/O transport implementation for the MCP system. 6 | 7 | This transport provides communication between clients and the MCP server 8 | through standard input/output streams. It's particularly useful for 9 | command-line applications and testing. The transport uses React PHP's 10 | event loop for asynchronous I/O operations. 11 | 12 | Features: 13 | - Non-blocking I/O 14 | - JSON message encoding/decoding 15 | - Event-driven processing 16 | - Simple integration with CLI tools 17 | 18 | @package LaravelMCP\MCP\Transport 19 | 20 | ## Methods 21 | 22 | ### __construct 23 | 24 | Create a new standard I/O transport instance. 25 | 26 | @param MCPServerInterface $server The MCP server instance 27 | 28 | ### start 29 | 30 | Start the transport. 31 | 32 | Sets up non-blocking I/O streams and starts the event loop to 33 | process incoming messages from standard input. 34 | 35 | ### stop 36 | 37 | Stop the transport. 38 | 39 | Stops the event loop and marks the transport as not running. 40 | 41 | ### send 42 | 43 | Send a message through the transport. 44 | 45 | Encodes the message as JSON and writes it to standard output. 46 | 47 | @param array $data The message data to send 48 | @throws \RuntimeException If message encoding fails 49 | 50 | ### receive 51 | 52 | Receive a message from the transport. 53 | 54 | @return array The next message in the queue or an empty array if none 55 | 56 | ### isRunning 57 | 58 | Check if the transport is running. 59 | 60 | @return bool True if the transport is running, false otherwise 61 | 62 | ### onMessage 63 | 64 | Handle an incoming message. 65 | 66 | Processes the message by decoding it from JSON and passing it to 67 | the message handler. Sends the handler's response back. 68 | 69 | Error handling: 70 | - Invalid JSON: Returns {"error": "Invalid JSON"} 71 | - Processing error: Returns {"error": "error message"} 72 | 73 | @param string $msg The raw message to process 74 | 75 | ### processMessage 76 | 77 | Process a decoded message. 78 | 79 | Routes the message to the appropriate handler based on its type 80 | and returns the handler's response. 81 | 82 | Supported message types: 83 | - tool_call: Handles tool execution requests 84 | - resource_request: Handles resource access requests 85 | - prompt_request: Handles prompt generation requests 86 | 87 | Message format: 88 | { 89 | "type": string, // Message type (required) 90 | "name": string, // Tool/prompt name (optional) 91 | "arguments": object, // Parameters (optional) 92 | "uri": string // Resource URI (optional) 93 | } 94 | 95 | @param array $data The decoded message data 96 | @return array The handler's response 97 | @throws \RuntimeException If the message type is unknown 98 | 99 | -------------------------------------------------------------------------------- /docs/api/_Tool.md: -------------------------------------------------------------------------------- 1 | # Tool 2 | 3 | Namespace: `` 4 | 5 | Implementation of a tool in the MCP system. 6 | 7 | A tool represents a specific functionality that can be invoked by clients 8 | through the MCP server. Each tool has a unique name, a handler function 9 | that implements its logic, and optional configuration parameters. 10 | 11 | Tools can be used to: 12 | - Execute system commands 13 | - Manipulate files and resources 14 | - Process data 15 | - Integrate with external services 16 | 17 | @package LaravelMCP\MCP\Server 18 | 19 | ## Methods 20 | 21 | ### __construct 22 | 23 | Create a new tool instance. 24 | 25 | @param string $name The unique identifier for the tool 26 | @param callable $handler The function that implements the tool's logic 27 | @param string|null $description Optional description of the tool's purpose 28 | 29 | ### getName 30 | 31 | {@inheritdoc} 32 | 33 | ### getHandler 34 | 35 | {@inheritdoc} 36 | 37 | ### getDescription 38 | 39 | {@inheritdoc} 40 | 41 | ### getParameters 42 | 43 | {@inheritdoc} 44 | 45 | ### setParameters 46 | 47 | {@inheritdoc} 48 | 49 | ### handle 50 | 51 | Handle a request to execute this tool. 52 | 53 | Processes the provided arguments using the tool's handler function 54 | and returns the result. The handler's return value is automatically 55 | converted to an array if it isn't one already. 56 | 57 | @param array $arguments The arguments to pass to the handler 58 | @return array The result of executing the tool 59 | 60 | -------------------------------------------------------------------------------- /docs/api/_ToolsCapability.md: -------------------------------------------------------------------------------- 1 | # ToolsCapability 2 | 3 | Namespace: `` 4 | 5 | Represents the tools capability in the MCP system. 6 | 7 | This class manages information about changes to the available tools 8 | in the MCP system. It tracks whether the list of tools has been 9 | modified and provides methods to serialize and deserialize this state. 10 | 11 | Tools Capability Features: 12 | - Tool list change tracking 13 | - State serialization/deserialization 14 | - Change notification support 15 | 16 | Use Cases: 17 | - Detecting when tools are added or removed 18 | - Synchronizing tool lists between client and server 19 | - Managing tool state across sessions 20 | 21 | Example Usage: 22 | ```php 23 | // Create a capability instance 24 | $tools = new ToolsCapability(listChanged: true); 25 | 26 | // Check if tools have changed 27 | if ($tools->getListChanged()) { 28 | // Handle tool list changes 29 | } 30 | 31 | // Convert to array for storage/transmission 32 | $data = $tools->toArray(); 33 | ``` 34 | 35 | @package LaravelMCP\MCP\Capabilities 36 | 37 | ## Methods 38 | 39 | ### __construct 40 | 41 | Create a new tools capability instance. 42 | 43 | Initializes a tools capability tracker that monitors changes 44 | to the available tools in the MCP system. 45 | 46 | Example: 47 | ```php 48 | // Track changes to tool list 49 | $tools = new ToolsCapability(listChanged: true); 50 | 51 | // Initialize with unknown state 52 | $tools = new ToolsCapability(); 53 | ``` 54 | 55 | @param bool|null $listChanged Whether the list of tools has changed 56 | - true: Tools list has been modified 57 | - false: Tools list is unchanged 58 | - null: Change state is unknown 59 | 60 | ### getListChanged 61 | 62 | Get whether the list of tools has changed. 63 | 64 | Retrieves the current state of tool list modifications. 65 | This can be used to determine if the available tools 66 | have been updated since the last synchronization. 67 | 68 | Example: 69 | ```php 70 | if ($tools->getListChanged() === true) { 71 | // Tools have been added or removed 72 | // Trigger resynchronization 73 | } elseif ($tools->getListChanged() === false) { 74 | // No changes to tool list 75 | } else { 76 | // Change state is unknown 77 | } 78 | ``` 79 | 80 | @return bool|null True if the list has changed, false if not, null if unknown 81 | 82 | ### toArray 83 | 84 | Convert the capability to an array format. 85 | 86 | Transforms the tools capability state into a structured array 87 | suitable for storage or transmission. Only includes the listChanged 88 | property if it has been set to a non-null value. 89 | 90 | Example output: 91 | ```php 92 | [ 93 | 'listChanged' => true // Only included if set 94 | ] 95 | ``` 96 | 97 | @return array The capability data as a key-value array 98 | 99 | ### create 100 | 101 | Create a new instance from an array of data. 102 | 103 | Factory method that constructs a ToolsCapability instance 104 | from a configuration array. This is useful for deserializing 105 | stored configurations or processing API responses. 106 | 107 | Example: 108 | ```php 109 | $tools = ToolsCapability::create([ 110 | 'listChanged' => true 111 | ]); 112 | ``` 113 | 114 | @param array $data The data to create the instance from 115 | @return static A new instance of the capability 116 | 117 | -------------------------------------------------------------------------------- /docs/api/_TransportFactory.md: -------------------------------------------------------------------------------- 1 | # TransportFactory 2 | 3 | Namespace: `` 4 | 5 | Factory for creating transport instances in the MCP system. 6 | 7 | This factory is responsible for creating and configuring transport 8 | implementations based on the requested type. It supports multiple 9 | transport protocols and handles their initialization with the 10 | appropriate event loop. 11 | 12 | Supported transports: 13 | - HTTP 14 | - WebSocket 15 | - Standard I/O 16 | 17 | @package LaravelMCP\MCP\Transport 18 | 19 | ## Methods 20 | 21 | ### create 22 | 23 | Create a new transport instance. 24 | 25 | Creates and configures a transport implementation based on the 26 | specified type. The transport will be initialized with the 27 | provided server, event loop, and configuration. 28 | 29 | @param string $type The type of transport to create ('http', 'websocket', 'stdio') 30 | @param MCPServerInterface $server The MCP server instance 31 | @param LoopInterface $loop The event loop to use 32 | @param array $config Optional configuration parameters 33 | @return TransportInterface The configured transport instance 34 | @throws RuntimeException If the transport type is not supported 35 | 36 | -------------------------------------------------------------------------------- /docs/api/_WebSocketTransport.md: -------------------------------------------------------------------------------- 1 | # WebSocketTransport 2 | 3 | Namespace: `` 4 | 5 | WebSocket transport implementation for the MCP system. 6 | 7 | This transport provides WebSocket-based communication between clients and 8 | the MCP server. It sets up a WebSocket server that can handle real-time, 9 | bidirectional communication. The transport uses Ratchet and React PHP for 10 | asynchronous WebSocket operations. 11 | 12 | Features: 13 | - WebSocket protocol support 14 | - Real-time bidirectional communication 15 | - Message queueing 16 | - Client connection management 17 | - Asynchronous processing 18 | 19 | @package LaravelMCP\MCP\Transport 20 | 21 | ## Methods 22 | 23 | ### __construct 24 | 25 | Create a new WebSocket transport instance. 26 | 27 | @param LoopInterface $loop The event loop to use 28 | @param MCPServerInterface $server The MCP server instance 29 | @param array $config Optional configuration parameters 30 | 31 | ### getHost 32 | 33 | Get the server host address. 34 | 35 | @return string The host address 36 | 37 | ### getPort 38 | 39 | Get the server port number. 40 | 41 | @return int The port number 42 | 43 | ### start 44 | 45 | {@inheritdoc} 46 | 47 | ### stop 48 | 49 | {@inheritdoc} 50 | 51 | ### send 52 | 53 | Send data to all connected clients. 54 | 55 | @param array $data The data to send 56 | 57 | ### receive 58 | 59 | {@inheritdoc} 60 | 61 | ### isRunning 62 | 63 | {@inheritdoc} 64 | 65 | ### onOpen 66 | 67 | Handle a new WebSocket connection. 68 | 69 | @param ConnectionInterface $conn The connection instance 70 | 71 | ### onClose 72 | 73 | Handle a closed WebSocket connection. 74 | 75 | @param ConnectionInterface $conn The connection instance 76 | 77 | ### onError 78 | 79 | Handle a WebSocket connection error. 80 | 81 | @param ConnectionInterface $conn The connection instance 82 | @param \Exception $e The error that occurred 83 | 84 | ### onMessage 85 | 86 | Handle an incoming WebSocket message. 87 | 88 | @param ConnectionInterface $from The connection that sent the message 89 | @param string $msg The message content 90 | 91 | ### processMessage 92 | 93 | Process an incoming message from a client. 94 | 95 | This method handles the core message processing logic: 96 | 1. Validates the message structure 97 | 2. Extracts type, name, and arguments 98 | 3. Forwards the message to the MCP server 99 | 4. Returns the processed result 100 | 101 | Expected message format: 102 | { 103 | "type": string, // The message type (required) 104 | "name": string, // Resource name (optional) 105 | "arguments": object, // Message arguments (optional) 106 | "uri": string // Resource URI (optional) 107 | } 108 | 109 | @param array $data The message data to process 110 | @return array The processing result 111 | 112 | ### setMessageHandler 113 | 114 | Set a custom message handler function. 115 | 116 | The handler will be called for each incoming message before standard processing. 117 | It can be used to implement custom message handling logic or preprocessing. 118 | 119 | The handler function should have the following signature: 120 | function(array $message): ?array 121 | 122 | If the handler returns null, standard message processing will continue. 123 | If it returns an array, that array will be used as the response. 124 | 125 | @param callable $handler The message handler function 126 | 127 | ### getMessageHandler 128 | 129 | Get the current message handler function. 130 | 131 | @return callable|null The current message handler or null if none set 132 | 133 | -------------------------------------------------------------------------------- /docs/api/__.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | Namespace: `` 4 | 5 | ## Methods 6 | 7 | ### boot 8 | 9 | Bootstrap any application services. 10 | 11 | This method is called after all other service providers have been 12 | registered. It sets up console commands and performs any other 13 | required bootstrapping. 14 | 15 | -------------------------------------------------------------------------------- /docs/api/______________.md: -------------------------------------------------------------------------------- 1 | # 2 | 3 | 4 | Namespace: `` 5 | 6 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # API Documentation 2 | 3 | Welcome to the Laravel MCP SDK API documentation. 4 | 5 | ## Classes 6 | 7 | 8 | ### Global 9 | 10 | * [ClientCapabilities](api/_ClientCapabilities.md) 11 | * [CompletionRequest](api/_CompletionRequest.md) 12 | * [FastMCP](api/_FastMCP.md) 13 | * [HttpClientTransport](api/_HttpClientTransport.md) 14 | * [HttpTransport](api/_HttpTransport.md) 15 | * [Implementation](api/_Implementation.md) 16 | * [LoggingMessageNotification](api/_LoggingMessageNotification.md) 17 | * [MCP](api/_MCP.md) 18 | * [MCPClient](api/_MCPClient.md) 19 | * [MCPServer](api/_MCPServer.md) 20 | * [MCPServerCommand](api/_MCPServerCommand.md) 21 | * [MCPServiceProvider](api/_MCPServiceProvider.md) 22 | * [ModelPreferences](api/_ModelPreferences.md) 23 | * [PaginatedRequest](api/_PaginatedRequest.md) 24 | * [PaginatedResult](api/_PaginatedResult.md) 25 | * [ProgressNotification](api/_ProgressNotification.md) 26 | * [Prompt](api/_Prompt.md) 27 | * [PromptsCapability](api/_PromptsCapability.md) 28 | * [Resource](api/_Resource.md) 29 | * [ResourceTemplate](api/_ResourceTemplate.md) 30 | * [ResourcesCapability](api/_ResourcesCapability.md) 31 | * [Root](api/_Root.md) 32 | * [RootsCapability](api/_RootsCapability.md) 33 | * [ServerCapabilities](api/_ServerCapabilities.md) 34 | * [StdioTransport](api/_StdioTransport.md) 35 | * [Tool](api/_Tool.md) 36 | * [ToolsCapability](api/_ToolsCapability.md) 37 | * [TransportFactory](api/_TransportFactory.md) 38 | * [WebSocketTransport](api/_WebSocketTransport.md) 39 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | Laravel MCP SDK Documentation 2 | ========================== 3 | 4 | Welcome to the Laravel MCP SDK documentation. This documentation is generated from the PHPDoc comments in the source code. 5 | 6 | Installation 7 | ----------- 8 | 9 | You can install the package via composer: 10 | 11 | .. code-block:: bash 12 | 13 | composer require laravelmcp/mcp 14 | 15 | Basic Usage 16 | ---------- 17 | 18 | First, register the service provider in your ``config/app.php`` file: 19 | 20 | .. code-block:: php 21 | 22 | 'providers' => [ 23 | // ... 24 | LaravelMCP\MCP\MCPServiceProvider::class, 25 | ], 26 | 27 | Then, you can use the MCP facade: 28 | 29 | .. code-block:: php 30 | 31 | use LaravelMCP\MCP\Facades\MCP; 32 | 33 | // Create a new MCP client 34 | $client = MCP::client(); 35 | 36 | // Send a request 37 | $response = $client->sendRequest($request); 38 | 39 | Components 40 | --------- 41 | 42 | The SDK consists of several main components: 43 | 44 | 1. **Transport Layer** 45 | - HTTP Transport 46 | - WebSocket Transport 47 | - Standard I/O Transport 48 | 49 | 2. **Server Components** 50 | - MCP Server 51 | - Tools 52 | - Resources 53 | - Prompts 54 | 55 | 3. **Capabilities** 56 | - Server Capabilities 57 | - Client Capabilities 58 | - Resource Capabilities 59 | - Tool Capabilities 60 | 61 | For detailed API documentation, please refer to the generated API documentation. -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # MCP Examples 2 | 3 | This directory contains example implementations of the Laravel MCP package, demonstrating different transport methods and use cases. 4 | 5 | ## Prerequisites 6 | 7 | Before running the examples, make sure you have: 8 | 1. PHP 8.1 or higher installed 9 | 2. Composer dependencies installed (`composer install`) 10 | 3. Terminal access to run PHP scripts 11 | 12 | ## Examples Overview 13 | 14 | ### 1. HTTP Transport Example 15 | 16 | Basic request/response communication using HTTP transport. 17 | 18 | #### Server (`http_server.php`) 19 | - Implements a simple MCP server 20 | - Handles tool calls, resource requests, and prompts 21 | - Uses HTTP transport on port 8080 22 | 23 | To run: 24 | ```bash 25 | php http_server.php 26 | ``` 27 | 28 | #### Client (`http_client.php`) 29 | - Demonstrates making requests to the HTTP server 30 | - Shows error handling 31 | - Includes examples of all request types 32 | 33 | To run (in a separate terminal): 34 | ```bash 35 | php http_client.php 36 | ``` 37 | 38 | ### 2. WebSocket Transport Example 39 | 40 | Real-time bidirectional communication with progress updates and streaming. 41 | 42 | #### Server (`websocket_server.php`) 43 | - Implements a real-time MCP server 44 | - Demonstrates progress updates and streaming 45 | - Manages client connections 46 | - Simulates long-running tasks 47 | 48 | To run: 49 | ```bash 50 | php websocket_server.php 51 | ``` 52 | 53 | #### Client (`websocket_client.php`) 54 | - Connects to WebSocket server 55 | - Handles different message types 56 | - Shows progress and streaming updates 57 | - Includes error handling 58 | 59 | To run (in a separate terminal): 60 | ```bash 61 | php websocket_client.php 62 | ``` 63 | 64 | ### 3. CLI Tool Example (`cli_tool.php`) 65 | 66 | Interactive command-line interface using STDIO transport. 67 | 68 | Features: 69 | - Calculator tool with basic operations 70 | - Greeting tool with customizable name 71 | - File reading capability 72 | - Built-in help system 73 | 74 | To run: 75 | ```bash 76 | php cli_tool.php 77 | ``` 78 | 79 | Available commands: 80 | ```json 81 | # Get help 82 | {"type": "prompt_request", "name": "help"} 83 | 84 | # Greet someone 85 | {"type": "tool_call", "name": "greet", "arguments": {"name": "John"}} 86 | 87 | # Calculate 88 | {"type": "tool_call", "name": "calculate", "arguments": {"num1": 10, "num2": 5, "operation": "+"}} 89 | 90 | # Read a file 91 | {"type": "resource_request", "uri": "file://path/to/file.txt"} 92 | ``` 93 | 94 | ## Common Patterns 95 | 96 | All examples demonstrate: 97 | 1. Implementing the `MCPServerInterface` 98 | 2. Setting up appropriate transport 99 | 3. Handling different request types 100 | 4. Error handling 101 | 5. Response formatting 102 | 103 | ## Troubleshooting 104 | 105 | 1. **Port already in use** 106 | - Change the port number in the server configuration 107 | - Make sure no other service is using port 8080 108 | 109 | 2. **Connection refused** 110 | - Ensure the server is running 111 | - Check if the host and port match between client and server 112 | 113 | 3. **Permission issues with file reading** 114 | - Ensure PHP has read permissions for the files 115 | - Use absolute paths or relative paths from the script location -------------------------------------------------------------------------------- /examples/cli_tool.php: -------------------------------------------------------------------------------- 1 | 'success', 19 | 'message' => "Hello, {$name}!" 20 | ]; 21 | 22 | case 'calculate': 23 | $num1 = $arguments['num1'] ?? 0; 24 | $num2 = $arguments['num2'] ?? 0; 25 | $operation = $arguments['operation'] ?? '+'; 26 | 27 | $result = match ($operation) { 28 | '+' => $num1 + $num2, 29 | '-' => $num1 - $num2, 30 | '*' => $num1 * $num2, 31 | '/' => $num2 != 0 ? $num1 / $num2 : 'Cannot divide by zero', 32 | default => 'Unknown operation' 33 | }; 34 | 35 | return [ 36 | 'status' => 'success', 37 | 'result' => $result 38 | ]; 39 | 40 | default: 41 | return [ 42 | 'status' => 'error', 43 | 'message' => "Unknown tool: {$name}" 44 | ]; 45 | } 46 | } 47 | 48 | public function handleResourceRequest(string $uri): array 49 | { 50 | // Simple file reader 51 | if (str_starts_with($uri, 'file://')) { 52 | $path = substr($uri, 7); 53 | if (file_exists($path)) { 54 | return [ 55 | 'status' => 'success', 56 | 'content' => file_get_contents($path) 57 | ]; 58 | } 59 | } 60 | 61 | return [ 62 | 'status' => 'error', 63 | 'message' => "Cannot read resource: {$uri}" 64 | ]; 65 | } 66 | 67 | public function handlePromptRequest(string $name, array $arguments = []): array 68 | { 69 | switch ($name) { 70 | case 'help': 71 | return [ 72 | 'status' => 'success', 73 | 'content' => << 'error', 95 | 'message' => "Unknown prompt: {$name}" 96 | ]; 97 | } 98 | } 99 | } 100 | 101 | // Create server instance 102 | $server = new CLIToolServer(); 103 | 104 | // Create STDIO transport 105 | $transport = new StdioTransport($server); 106 | 107 | // Print usage instructions 108 | echo "MCP CLI Tool\n"; 109 | echo "Enter JSON commands, one per line. Type 'help' for usage instructions.\n"; 110 | echo "Example: {\"type\": \"prompt_request\", \"name\": \"help\"}\n\n"; 111 | 112 | // Start the server 113 | $transport->start(); 114 | -------------------------------------------------------------------------------- /examples/http_client.php: -------------------------------------------------------------------------------- 1 | createContext([ 13 | 'type' => 'tool_call', 14 | 'name' => 'example_tool', 15 | 'arguments' => ['arg1' => 'value1', 'arg2' => 'value2'] 16 | ]); 17 | echo "Tool Call Result:\n"; 18 | echo json_encode($result, JSON_PRETTY_PRINT) . "\n\n"; 19 | } catch (Exception $e) { 20 | echo "Error making tool call: " . $e->getMessage() . "\n"; 21 | } 22 | 23 | // Example 2: Resource Request 24 | try { 25 | $result = $client->createContext([ 26 | 'type' => 'resource_request', 27 | 'uri' => 'example://resource/123' 28 | ]); 29 | echo "Resource Request Result:\n"; 30 | echo json_encode($result, JSON_PRETTY_PRINT) . "\n\n"; 31 | } catch (Exception $e) { 32 | echo "Error making resource request: " . $e->getMessage() . "\n"; 33 | } 34 | 35 | // Example 3: Prompt Request 36 | try { 37 | $result = $client->createContext([ 38 | 'type' => 'prompt_request', 39 | 'name' => 'example_prompt', 40 | 'arguments' => ['context' => 'This is a test prompt'] 41 | ]); 42 | echo "Prompt Request Result:\n"; 43 | echo json_encode($result, JSON_PRETTY_PRINT) . "\n\n"; 44 | } catch (Exception $e) { 45 | echo "Error making prompt request: " . $e->getMessage() . "\n"; 46 | } 47 | -------------------------------------------------------------------------------- /examples/http_server.php: -------------------------------------------------------------------------------- 1 | 'success', 16 | 'tool' => $name, 17 | 'args' => $arguments, 18 | 'result' => "Executed tool {$name} with " . count($arguments) . " arguments" 19 | ]; 20 | } 21 | 22 | public function handleResourceRequest(string $uri): array 23 | { 24 | return [ 25 | 'status' => 'success', 26 | 'uri' => $uri, 27 | 'content' => "Resource content for {$uri}" 28 | ]; 29 | } 30 | 31 | public function handlePromptRequest(string $name, array $arguments = []): array 32 | { 33 | return [ 34 | 'status' => 'success', 35 | 'prompt' => $name, 36 | 'args' => $arguments, 37 | 'response' => "Generated response for prompt {$name}" 38 | ]; 39 | } 40 | } 41 | 42 | // Create server instance 43 | $server = new SimpleServer(); 44 | 45 | // Create HTTP transport 46 | $transport = new HttpTransport($server, [ 47 | 'host' => '127.0.0.1', 48 | 'port' => 8080 49 | ]); 50 | 51 | echo "Starting MCP HTTP server on http://127.0.0.1:8080\n"; 52 | echo "Press Ctrl+C to stop\n"; 53 | 54 | // Start the server 55 | $transport->start(); 56 | -------------------------------------------------------------------------------- /examples/websocket_client.php: -------------------------------------------------------------------------------- 1 | then(function(WebSocket $conn) { 10 | // Example 1: Tool Call with progress updates 11 | $conn->send(json_encode([ 12 | 'type' => 'tool_call', 13 | 'name' => 'long_running_tool', 14 | 'arguments' => ['param1' => 'value1'] 15 | ])); 16 | 17 | // Example 2: Resource Request 18 | $conn->send(json_encode([ 19 | 'type' => 'resource_request', 20 | 'uri' => 'example://resource/123' 21 | ])); 22 | 23 | // Example 3: Prompt Request with streaming response 24 | $conn->send(json_encode([ 25 | 'type' => 'prompt_request', 26 | 'name' => 'streaming_prompt', 27 | 'arguments' => ['context' => 'Generate a streaming response'] 28 | ])); 29 | 30 | // Handle incoming messages 31 | $conn->on('message', function($msg) { 32 | $data = json_decode($msg, true); 33 | 34 | switch ($data['status'] ?? '') { 35 | case 'progress': 36 | echo "Progress: Step {$data['step']}/{$data['total_steps']} - {$data['message']}\n"; 37 | break; 38 | 39 | case 'streaming': 40 | echo "Streaming token: {$data['token']}\n"; 41 | break; 42 | 43 | case 'success': 44 | echo "Success Response:\n"; 45 | echo json_encode($data, JSON_PRETTY_PRINT) . "\n\n"; 46 | break; 47 | 48 | default: 49 | echo "Received message:\n"; 50 | echo json_encode($data, JSON_PRETTY_PRINT) . "\n\n"; 51 | } 52 | }); 53 | 54 | }, function ($e) { 55 | echo "Could not connect: {$e->getMessage()}\n"; 56 | }); 57 | 58 | // Run the event loop 59 | $loop->run(); 60 | -------------------------------------------------------------------------------- /examples/websocket_server.php: -------------------------------------------------------------------------------- 1 | 'progress', 22 | 'tool' => $name, 23 | 'step' => $i, 24 | 'total_steps' => $steps, 25 | 'message' => "Processing step {$i} of {$steps}" 26 | ]; 27 | 28 | // Send progress to all connected clients 29 | foreach ($this->clients as $client) { 30 | $client->send(json_encode($progress)); 31 | } 32 | 33 | // Simulate work 34 | sleep(1); 35 | } 36 | 37 | return [ 38 | 'status' => 'success', 39 | 'tool' => $name, 40 | 'args' => $arguments, 41 | 'result' => "Completed tool {$name} execution" 42 | ]; 43 | } 44 | 45 | public function handleResourceRequest(string $uri): array 46 | { 47 | return [ 48 | 'status' => 'success', 49 | 'uri' => $uri, 50 | 'content' => "Real-time resource content for {$uri}" 51 | ]; 52 | } 53 | 54 | public function handlePromptRequest(string $name, array $arguments = []): array 55 | { 56 | // Simulate streaming response 57 | $words = explode(' ', 'This is a streaming response that comes word by word'); 58 | foreach ($words as $word) { 59 | $progress = [ 60 | 'status' => 'streaming', 61 | 'prompt' => $name, 62 | 'token' => $word 63 | ]; 64 | 65 | // Send each word to all connected clients 66 | foreach ($this->clients as $client) { 67 | $client->send(json_encode($progress)); 68 | } 69 | 70 | // Small delay between words 71 | usleep(500000); // 0.5 seconds 72 | } 73 | 74 | return [ 75 | 'status' => 'success', 76 | 'prompt' => $name, 77 | 'args' => $arguments, 78 | 'response' => "Completed streaming response" 79 | ]; 80 | } 81 | 82 | public function addClient($client): void 83 | { 84 | $this->clients[] = $client; 85 | } 86 | 87 | public function removeClient($client): void 88 | { 89 | $index = array_search($client, $this->clients); 90 | if ($index !== false) { 91 | unset($this->clients[$index]); 92 | } 93 | } 94 | } 95 | 96 | // Create server instance 97 | $server = new RealTimeServer(); 98 | 99 | // Create WebSocket transport 100 | $transport = new WebSocketTransport(Loop::get(), $server, [ 101 | 'host' => '127.0.0.1', 102 | 'port' => 8080 103 | ]); 104 | 105 | echo "Starting MCP WebSocket server on ws://127.0.0.1:8080\n"; 106 | echo "Press Ctrl+C to stop\n"; 107 | 108 | // Start the server 109 | $transport->start(); 110 | -------------------------------------------------------------------------------- /phpcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | The coding standard for Laravel MCP. 4 | 5 | src 6 | tests 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | tests/* 27 | 28 | -------------------------------------------------------------------------------- /phpdoc.dist.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | docs 10 | build/cache 11 | 12 | 13 | 14 | 15 | src 16 | 17 | LaravelMCP\MCP 18 | public 19 | protected 20 | private 21 | 22 | 23 | 24 | docs 25 | 26 | guide 27 | 28 | 29 |