-
Notifications
You must be signed in to change notification settings - Fork 26
Permalink
Choose a base ref
{{ refName }}
default
Choose a head ref
{{ refName }}
default
Comparing changes
Choose two branches to see what’s changed or to start a new pull request.
If you need to, you can also or
learn more about diff comparisons.
Open a pull request
Create a new pull request by comparing changes across two branches. If you need to, you can also .
Learn more about diff comparisons here.
base repository: php-mcp/laravel
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: c84322f
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
...
head repository: michabbb/php-mcp-laravel
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 60a2abb
Could not load branches
Nothing to show
Loading
Could not load tags
Nothing to show
{{ refName }}
default
Loading
- 3 commits
- 3 files changed
- 3 contributors
Commits on Jun 9, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 6c7e399 - Browse repository at this point
Copy the full SHA 6c7e399View commit details -
Fix clientId parameter inconsistency in SSE endpoint
- Changed route parameter from 'clientId' to 'client_id' in McpController line 104 - This fixes the inconsistency where the Laravel controller expects 'client_id' but the SSE endpoint was generating URLs with 'clientId' - Ensures consistency with OAuth standards and MCP client expectations
micha committedJun 9, 2025 Configuration menu - View commit details
-
Copy full SHA for 1dbac58 - Browse repository at this point
Copy the full SHA 1dbac58View commit details
Commits on Jun 10, 2025
-
Fix MCP HTTP transport for PHP-FPM/Apache: Auto-register clients + OA…
…uth compliance ## Critical Transport Architecture Fix This commit resolves two fundamental issues that prevented MCP HTTP transport from working correctly with traditional PHP servers (PHP-FPM, Apache) while maintaining compatibility with long-running processes (ReactPHP). ### 🔧 Problem 1: Client Registration Lost Between Requests **Root Cause:** Each HTTP request in PHP-FPM/Apache runs in a separate PHP process, causing: - SSE stream (GET /sse) creates LaravelHttpTransport instance #1 - POST requests (/message) create LaravelHttpTransport instance #2 - Client registered in instance #1 is not available in instance #2 - Result: "Client not actively managed by this transport" errors **Solution:** Auto-registration in `LaravelHttpTransport::sendToClientAsync()`: - Automatically emit `client_connected` event for unknown clients - Ensures clients are active before processing messages - Maintains backward compatibility with ReactPHP (no-op for already active clients) ### 🔧 Problem 2: OAuth Standard Compliance **Root Cause:** Original package used non-standard parameter naming that violates OAuth spec: - Used: `clientId` (camelCase) - OAuth Standard: `client_id` (snake_case) - Real MCP clients (Claude Desktop) send `client_id` parameter **Solution:** - Updated SSE endpoint to accept `client_id` query parameter - Consistent `client_id` usage in all log messages - Maintains fallback to session ID if no `client_id` provided ### 🔧 Problem 3: Service Provider Architecture **Root Cause:** Multiple controller instantiations called `server->listen()` repeatedly, causing: - Event handlers registered multiple times - Transport state inconsistencies - Memory leaks and performance issues **Solution:** - Moved `server->listen()` to McpServiceProvider singleton registration - Removed redundant `server->listen()` calls from controller constructor - Proper logger injection in service provider ## 🧪 Tested Scenarios ✅ **PHP-FPM/Apache (Separate Processes)** - Each request gets clean transport instance - Auto-registration ensures client connectivity - No shared state issues ✅ **ReactPHP (Long-Running Process)** - Existing clients remain active - Auto-registration is no-op for active clients - No performance impact ✅ **Claude Desktop Integration** - Recognizes all MCP tools correctly - Proper `client_id` parameter handling - SSE stream maintains connection ## 🔍 Technical Details **Modified Files:** - `src/Transports/LaravelHttpTransport.php`: Auto-registration logic - `src/Http/Controllers/McpController.php`: OAuth compliance + service provider cleanup - `src/McpServiceProvider.php`: Centralized transport initialization **Key Changes:** 1. Auto-registration in `sendToClientAsync()` when client not found 2. SSE endpoint accepts `client_id` query parameter 3. Service provider handles transport listening lifecycle 4. Consistent `client_id` logging throughout ## 🚀 Impact **Before:** MCP HTTP transport only worked with ReactPHP **After:** Works with all PHP server configurations **Deployment:** Zero breaking changes - existing code continues to work **Performance:** Minimal overhead (~1 isset() check per message) This fix enables MCP HTTP transport to work reliably in production PHP environments while maintaining the existing API and functionality. Fixes issues with: - Traditional PHP-FPM deployments - Apache mod_php configurations - Docker containers with nginx+php-fpm - Shared hosting environments - Any setup where each HTTP request runs in separate PHP process Co-authored-by: Claude (Anthropic) <[email protected]>
micha and Claude (Anthropic) committedJun 10, 2025 Configuration menu - View commit details
-
Copy full SHA for 60a2abb - Browse repository at this point
Copy the full SHA 60a2abbView commit details
Loading
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff c84322f...60a2abb