Tom Shaw builds a Laravel MCP server over real sales data
Tom Shaw's hands-on tutorial walks through building a read-only Laravel MCP server that answers natural-language questions over a sales database and connects it to Claude Desktop.
Score breakdown
The tutorial demonstrates a concrete path for connecting a Laravel application's live data to an AI model via MCP, replacing the need for a developer-facing REST API with a self-describing, agent-native interface that Claude can query directly at runtime.
- 01The tutorial builds a read-only Laravel MCP server that answers natural-language questions over a `classicmodels` sales database (customers, orders, products, payments).
- 02The server exposes a streamable-HTTP endpoint at `/mcp/assistant` and registers tools, resources, and prompts.
- 03MCP servers are self-describing at runtime — the model discovers capabilities by querying the server directly, unlike REST APIs that rely on external documentation.
Tom Shaw's tutorial on Dev.to walks through building a read-only Laravel MCP server that can answer natural-language questions — such as "who were our top five customers last quarter?" — over a live sales database. The sample dataset is based on the well-known `classicmodels` schema (a scale-model car retailer), though the article notes the same patterns apply to any Laravel application's data. The server exposes a streamable-HTTP endpoint at `/mcp/assistant` and registers three kinds of capability: tools (actions), resources (data), and prompts (templates).
A key conceptual thread in the tutorial is the contrast between REST APIs and MCP servers.
A key conceptual thread in the tutorial is the contrast between REST APIs and MCP servers. REST APIs are designed for developers who read external docs and hard-code endpoints; MCP servers are designed for AI models that discover available capabilities at runtime by querying the server directly. The article presents this as a fundamental shift that drives every other architectural difference between the two paradigms.
The tutorial devotes significant attention to local testing with the MCP Inspector, which connects to the running Laravel app over HTTP through the real route. Shaw recommends a methodical inspection workflow: listing tools to verify readable names and descriptions, reading the schema resource, calling curated tools with valid and invalid inputs to exercise validation and error messages, testing raw-SQL guardrails (including write-attempt rejection and table allowlisting), and invoking prompts. The `throttle:mcp` rate limiter is configured to allow 60 requests/min for authenticated users or 20/min by IP, keeping the endpoint accessible in local development without a token. Authentication via an `auth` or `auth:sanctum` guard is deferred until after the server is verified to work. The source text is truncated before the tutorial's later sections on securing the server for production.
Key facts
- 01The tutorial builds a read-only Laravel MCP server that answers natural-language questions over a `classicmodels` sales database (customers, orders, products, payments).
- 02The server exposes a streamable-HTTP endpoint at `/mcp/assistant` and registers tools, resources, and prompts.
- 03MCP servers are self-describing at runtime — the model discovers capabilities by querying the server directly, unlike REST APIs that rely on external documentation.
- 04Local testing uses the MCP Inspector, launched via `php artisan mcp:inspector mcp/assistant`, which connects over HTTP through the real route.
- 05A `throttle:mcp` rate limiter allows 60 requests/min for authenticated users or 20/min by IP for unauthenticated connections.
- 06Authentication via `auth` or `auth:sanctum` is intentionally deferred until after the server is verified, because it would reject the Inspector's unauthenticated connection.
- 07Raw-SQL guardrail testing includes verifying that write attempts (e.g. DELETE) are rejected and that a table allowlist blocks access to forbidden tables.
Topics
Summary and scoring are generated automatically from the original article. We always link back to the publisher and never republish images or paywalled content. Last processed Jun 11, 2026 · 08:34 UTC. How this works →