AI Agents to MCP / API
If you want to expose your AI agent as an MCP server, you can use the official Laravel MCP package.
The recommended approach is to wrap the MCP layer around the core message-processing logic located at: App\Services\AiChat\DefaultMessageProcessing.php
This allows you to reuse the same business logic for both the internal chat UI and external MCP consumers.
Alternatively, you can expose the AI agent as a standard HTTP API.
For authentication and access control:
- Use Laravel Sanctum to issue OAuth-style API tokens for your users
- Associate API usage with users and meter billing via Stripe (built-in)