- Can I use symfony/mcp-bundle directly in Laravel, or is it strictly for Symfony?
- This bundle is designed for Symfony, but Laravel can adopt it partially by wrapping MCP SDK services in Laravel’s service container (e.g., via `AppServiceProvider`). Use Symfony’s HttpKernel or custom adapters to bridge the gap, though full integration requires abstracting Symfony-specific dependencies.
- What Laravel versions support MCP integration via this bundle?
- Laravel compatibility depends on your Symfony component adoption (e.g., `symfony/http-foundation`). Aim for Laravel 8+ (PHP 8.0+) for best compatibility with Symfony 6.x/7.x. Test thoroughly, as MCP SDK stability may vary across PHP versions.
- How do I route MCP endpoints in Laravel if this is a Symfony bundle?
- Extend Laravel’s `RouteServiceProvider` to map MCP HTTP routes (e.g., `/mcp/tools`) to controllers or middleware. Use Laravel’s middleware pipeline to intercept MCP-compatible requests, transforming them into Symfony-style routes via custom logic or the Symfony Bridge.
- What’s the performance impact of using MCP over direct API calls (e.g., OpenAI REST) in Laravel?
- MCP adds HTTP/STDIO transport overhead, but caching MCP responses (e.g., via Laravel’s cache system) or batching requests can mitigate latency. Benchmark against direct API calls—MCP’s value lies in multi-model orchestration, not raw speed for single-model use cases.
- Does this bundle support non-MCP models (e.g., direct REST calls to proprietary APIs)?
- No, this bundle is MCP-specific. For hybrid setups, create a facade or decorator pattern in Laravel to route requests to MCP-compatible models *or* bypass MCP for non-compliant APIs. Example: `if ($model->isMcpCompatible()) { return $mcpClient->call(...); } else { return $this->fallbackApiCall(); }`
- How do I handle MCP API keys/secrets in Laravel’s environment?
- Store MCP credentials in Laravel’s `.env` (e.g., `MCP_API_KEY`) and inject them into your MCP client service. Use Laravel’s `config()` helper or bind the key to a service container alias. Avoid hardcoding; leverage Symfony’s `ParameterBag` via a custom wrapper if needed.
- What’s the fallback strategy if MCP endpoints fail (e.g., rate limits, downtime)?
- Implement Laravel middleware or a decorator around the MCP client to handle retries (e.g., `retry:3` with exponential backoff) and circuit breakers (e.g., `spatie/laravel-circuitbreaker`). Cache failed responses temporarily or route to a backup model via a feature flag.
- Are there alternatives to symfony/mcp-bundle for Laravel?
- For Laravel, consider direct MCP SDK integration (`mcp/sdk`) wrapped in a service, or packages like `spatie/ai` for LLM orchestration. If you need Symfony’s ecosystem, evaluate `symfony/ux-live-component` for reactive AI UIs or build a custom bridge. No Laravel-native MCP bundle exists yet.
- How do I test MCP integration in Laravel without a real MCP server?
- Use the MCP SDK’s mock server mode or a local Docker container (e.g., `modelcontextprotocol/mcp-server`). For unit tests, mock the `McpClient` interface and stub responses. Example: `McpClient::shouldReceive('call')->andReturn(['response' => 'test']);` in PHPUnit.
- What’s the maintenance status of this bundle, and where should I report issues?
- This is an **experimental** bundle maintained by Symfony’s AI team. Report issues or submit PRs via the [Symfony AI repository](https://github.com/symfony/ai), not this read-only split. Check the [Symfony AI docs](https://symfony.com/doc/current/ai/) for updates on MCP support.