FlexPoint Docs
Engineering

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:

ToolPurpose
list_lendersDiscover available lender slugs to scope or disambiguate.
list_programsFind a program slug (optionally filtered by lender).
get_rate_ladderThe base price-by-rate table for a program.
get_llpa_adjustmentsEvery LLPA category, band, and adjustment that can modify a price.
get_program_matrixLTV grid, eligibility rules, and overlays for a program.
run_pricer_quoteRun a full scenario and see how the layers compose into a final price (with an adjuster log per offer).

When debugging why a price moved unexpectedly:

  1. list_programs to find the program slug (use the lender arg only to scope).
  2. get_rate_ladder for the base price-by-rate table.
  3. get_llpa_adjustments to see every adjustment that can modify the price.
  4. get_program_matrix for the LTV grid, eligibility rules, and overlays.
  5. run_pricer_quote with a full scenario to see the composed final price.

Run the server locally

From the FlexRateAPI project root:

php artisan mcp:start flex-rate

This 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, and cwd.

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.

On this page