Skip to content

The Carotene MCP Server ​

The Carotene CLI (carrot dev) is incredibly powerful for background compilation and CI/CD, but modern developers live inside their IDEs. You don't want to switch back and forth between a terminal and your editor just to see what the AI generated for your @(...) operator.

To solve this, Carotene natively implements the Model Context Protocol (MCP).

The Carotene CLI includes a built-in MCP Server that allows next-generation, AI-native IDEs (like Cursor, Windsurf, or VS Code with Copilot) to directly interact with the Carotene compiler, the architecture blueprints, and the Vapor Sandbox.

What is the Carotene MCP Server? ​

Normally, an AI in your code editor just reads the raw text of the file you have open and guesses what to write next. This leads to hallucinations—the AI might generate a SQL query for a table that doesn't exist, or import a library you haven't installed.

The Carotene MCP Server bridges this gap. It exposes specific Tools and Resources directly to your editor's AI, giving it a flawless, mathematically rigorous understanding of your entire system architecture.

Core MCP Tools Exposed to the AI ​

When you connect your IDE to the Carotene MCP Server, the AI gains access to three critical capabilities:

  1. read_architecture (Context Injection)

    The AI does not need to guess your database schema. When it looks at a .carrot file, the MCP server feeds it the exact, strongly-typed relationships defined in your model, store, and flow blocks across your entire workspace.

  2. resolve_operator (Targeted Generation)

    Instead of trying to rewrite your entire file, the IDE's AI knows how to target the exact @(...) Generative Operator. It uses this tool to scope its generation strictly to the "Code Hole" you created, leaving your deterministic rules untouched.

  3. execute_sandbox (Invisible Iteration)

    This is the killer feature. Before the IDE types a single line of code onto your screen, it can silently use this tool to pass its draft code to the 2ms Vapor Sandbox. The MCP server runs the code against your test assertions and returns the stack trace directly to the IDE's AI. The AI fixes its own bugs in the background and only shows you the final, mathematically proven code.


Setting Up the MCP Server ​

Because the MCP server is bundled directly inside the CLI binary you already installed, setup takes seconds.

You simply start the server via your terminal, or configure your AI-native editor to boot it automatically.

Example: Connecting to Cursor ​

If you are using Cursor, you can add Carotene as a persistent MCP server.

  1. Open Cursor Settings -> Features -> MCP.

  2. Click + Add New MCP Server.

  3. Name it Carotene.

  4. Set the type to command and the command to:

    bash
    carrot mcp --stdio

That's it. Cursor is now fully aware of the Carotene framework, the Zero-Trust execution model, and the Vapor Sandbox.


The Developer Experience (DX) ​

Once the MCP Server is connected, your IDE transforms from a text editor into a true Systems Architect workspace.

1. You write the Blueprint:

You define a new backend function and leave an operator:

dart
discount = @("Calculate a tiered volume discount based on the user's past 30 days of orders")

2. You write the Proof:

You drop a test block at the bottom of the file with your mock data and asserts.

3. You trigger the IDE AI:

You hit Cmd+K (or your editor's equivalent) and press Enter.

4. The Invisible Loop:

  • You will see the AI "thinking."
  • Behind the scenes, the editor uses the read_architecture tool to understand what an "order" is.
  • It writes a draft in TypeScript/Go.
  • It uses the execute_sandbox tool. It fails because it forgot a specific edge-case.
  • It rewrites the code and tests it again. It passes.

5. The Reveal:

The IDE instantly injects the correct, fully-tested business logic right into your src/ implementation stub, and your terminal shows a green build. You never had to debug a hallucination, and the AI never had to guess your database schema.