Skip to content

feat: Upgrade to php-mcp/server ^3.x with enhanced session management and streamable transport #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 26, 2025

Conversation

CodeWithKyrian
Copy link
Contributor

Changes

  • Upgrade dependency: Updated php-mcp/server from ^2.x to ^3.x
  • Enhanced session management: Implemented Laravel-native session handlers (file, database, cache)
  • Streamable transport: Added support for new streamable HTTP transport with resumability
  • Transport refactoring: Renamed and reorganized transport classes for consistency
  • Configuration updates: Simplified capabilities config and added completion provider support
  • Session lifecycle: Added proper session deletion and expiration handling for SSE streams
  • Documentation: Updated README with latest features, capabilities, and migration guide

Fixes

  • Fixed SSE stream handling when sessions are deleted or expired
  • Replaced deprecated methods throughout test suite
  • Improved transport naming consistency

Breaking Changes

  • Requires php-mcp/server ^3.0
  • Updated configuration structure for capabilities
  • Transport class names have changed for consistency

Migration

See the updated README for migration guide from v2.x to v3.x, including configuration changes and new session management options.

…handling

- Updated `php-mcp/server` dependency to version `^3.0` in composer.json.
- Refactored HTTP transport handling by removing the old `McpController` and introducing `SseTransportController` and `StreamableTransportController`.
- Enhanced configuration options in `mcp.php` for dedicated and integrated HTTP transports, including support for JSON responses and event stores.
- Updated routing to use a new web.php file for handling transport routes.
- Improved session management and logging configurations in the MCP setup.
- Adjusted command outputs for clarity when starting the MCP server.
- Added a lottery configuration for session garbage collection in `mcp.php`.
- Updated `LaravelHttpTransport` to include session garbage collection on message requests.
- Refactored `LaravelStreamableHttpTransport` to streamline message handling and improve context management.
- Adjusted command output formatting for better readability when starting the MCP server.
- Add FileSessionHandler with directory auto-creation and proper gc()
- Add DatabaseSessionHandler with base64 encoding and session tracking
- Update McpServiceProvider to construct handlers directly instead of using server builder
- Add session configuration options for file path and database settings
- Include database migration for mcp_sessions table
- Support all Laravel session drivers: array, file, cache, database, redis, memcached, dynamodb
- Refactored tests to replace deprecated methods with updated ones for retrieving tools, resources, and prompts.
- Enhanced assertions in tests to align with the new schema structure for registered elements.
- Updated command tests to reflect changes in the MCP registry and output messages for better clarity.
- Updated the capabilities structure in `mcp.php` to streamline the configuration by removing nested arrays for tools, resources, prompts, and logging.
- Enhanced the `McpServiceProvider` to reflect the new configuration structure, ensuring compatibility with the updated capabilities.
- Added support for completions and clarified the experimental capabilities in the configuration.
@CodeWithKyrian CodeWithKyrian merged commit 8c52394 into main Jun 26, 2025
8 checks passed
@CodeWithKyrian CodeWithKyrian deleted the feature/protocol-2025-03-26 branch June 26, 2025 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant