Search by

Fusion Stack MCP bridge: expose selected API endpoints as MCP tools through the full API pipeline.

v0.1.1 2026-12-01 13:18 UTC

This package is auto-updated.

Last update: 2026-12-01 14:19:12 UTC


README

Fusion Stack

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 set destructive: true for changes such as cancelling or deleting, false for 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, so filter[status][in] is filter.status.in; the request body is body.
  • The full pipeline. A tool call is an API request through the HTTP kernel with the caller's Authorization header, so API keys, scopes, rate limits, idempotency and error codes apply unchanged. Mutating calls get a new Idempotency-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 to api:// 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');