MCP Server
Configure and connect the FlexRate Model Context Protocol (MCP) server to inspect rate sheets and run pricing scenarios from an AI client.
FlexRate ships a Model Context Protocol (MCP) server (built on
laravel/mcp) that lets an AI client inspect rate sheets, program matrices, LLPA
adjustments, and run live pricing scenarios as tools.
What it exposes
The server is Flex Rates Server (App\Mcp\Servers\FlexRateServer),
registered in routes/ai.php as the local handle flex-rate:
// routes/ai.php
Mcp::local('flex-rate', FlexRateServer::class);It registers six tools:
| Tool | Purpose |
|---|---|
list_lenders | Discover available lender slugs to scope or disambiguate. |
list_programs | Find a program slug (optionally filtered by lender). |
get_rate_ladder | The base price-by-rate table for a program. |
get_llpa_adjustments | Every LLPA category, band, and adjustment that can modify a price. |
get_program_matrix | LTV grid, eligibility rules, and overlays for a program. |
run_pricer_quote | Run a full scenario and see how the layers compose into a final price (with an adjuster log per offer). |
Recommended debugging flow
When debugging why a price moved unexpectedly:
list_programsto find the program slug (use thelenderarg only to scope).get_rate_ladderfor the base price-by-rate table.get_llpa_adjustmentsto see every adjustment that can modify the price.get_program_matrixfor the LTV grid, eligibility rules, and overlays.run_pricer_quotewith a full scenario to see the composed final price.
Run the server locally
From the FlexRateAPI project root:
php artisan mcp:start flex-rateThis starts the local (stdio) MCP server. Most clients launch this command for you via their MCP config rather than you running it by hand.
Connect from an MCP client
Point your client at the artisan command. A typical config entry:
{
"mcpServers": {
"flex-rate": {
"command": "php",
"args": ["artisan", "mcp:start", "flex-rate"],
"cwd": "/absolute/path/to/FlexRateAPI"
}
}
}- Claude Desktop — add the block above to
claude_desktop_config.json. - VS Code (MCP) — add an equivalent server entry in your MCP settings, using
the same
command,args, andcwd.
Local-first
flex-rate is registered as a local server, so it
runs against your local FlexRateAPI environment and the most-recently seeded
rate sheet. Make sure the project is installed and the database is seeded
(php artisan rates:daily) before connecting.