fusion-stack / mcp
Fusion Stack MCP bridge: expose selected API endpoints as MCP tools through the full API pipeline.
Requires
- php: ^8.4
- fusion-stack/laravel: v0.1.1
- laravel/mcp: ^1.3
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
fusion-stack/mcp
Serve your Fusion Stack API to AI agents as MCP tools.
Documentation · GitHub · MIT license
This is a read-only split of
fusion-stack/framework. Open issues and pull requests there.
Optional MCP server for APIs built with Fusion Stack, on top of laravel/mcp. It exposes the endpoints you choose as MCP tools.
composer require fusion-stack/mcp
#[Endpoint('List orders', 'Returns orders for the authenticated account, newest first.')] #[McpTool(name: 'list_orders')] public function index(OrderQuery $query) { ... } #[Endpoint('Cancel an order')] #[McpTool(destructive: true)] public function cancel(Order $order) { ... }
- Opt in per endpoint. Nothing is exposed without
#[McpTool]. Endpoints that are not GET must setdestructive:truefor changes such as cancelling or deleting,falsefor ones that only add. Clients see read-only and destructive hints, so they can ask for confirmation. - Written once. Each tool's description and input schema come from the endpoint's OpenAPI operation: its
#[Endpoint],#[Describe], form request rules, includes, fields, filters and sorts. Query parameters nest, sofilter[status][in]isfilter.status.in; the request body isbody. - The full pipeline. A tool call is an API request through the HTTP kernel with the caller's
Authorizationheader, so API keys, scopes, rate limits, idempotency and error codes apply unchanged. Mutating calls get a newIdempotency-Key. - Token friendly. JSON:API responses are flattened to plain objects with included resources nested, and the next page is a cursor to pass back as
page. Errors are short messages with their code and the request ID. - Reference data as resources. Mark a GET endpoint without path parameters
#[McpResource]to expose it as a read-only resource, such as order statuses or a product catalogue, that clients load once. Its URI defaults toapi://and the path (api://v1/order-statuses). Reading it is an API request like a tool call, so the same keys and scopes apply, and the body comes back flattened, as JSON. - Audited. Each tool call and resource read is logged with its request ID, client and status.
Configure it with api.mcp (publish with php artisan vendor:publish --tag=fusion-stack-mcp-config): the path (default /mcp), middleware to authenticate the MCP connection, the API version tools speak (default the latest) and the log_channel.
php artisan api:mcp:list shows the tools and resources with their scopes and safety. In tests, use the InteractsWithMcp trait:
$this->callMcpTool('list_orders', ['include' => ['customer']], token: $key) ->assertOk() ->assertStructuredContentPath('data.0.customer.name', 'Ada'); $this->readMcpResource('api://v1/order-statuses')->assertOk()->assertSee('shipped');