Skip to content

MCP Mode

Repl can expose your entire command graph as an MCP server, making every command available as an MCP tool to any compatible AI agent — Claude, Cursor, Copilot, and others.

  1. Add the package

    Terminal window
    dotnet add package Repl.Mcp
  2. Register the MCP server

    using Repl;
    using Repl.Mcp;
    var app = ReplApp.Create().UseDefaultInteractive();
    // ... your commands ...
    app.UseMcpServer(); // one line
    return app.Run(args);
  3. Configure your agent

    {
    "mcpServers": {
    "myapp": {
    "command": "myapp",
    "args": ["mcp", "serve"]
    }
    }
    }

That’s it — every Map(...) call is now an MCP tool.

Repl translates your command graph to MCP concepts automatically:

Repl conceptMCP concept
app.Map("list", handler)Tool list
Return valueTool result
[Description] attributeTool description
Results.Error(...)Tool error
.AsResource()Resource
.AsPrompt()Prompt

MCP Apps are host-rendered UI surfaces for capable clients (e.g., Claude). Register an HTML-returning command as an App resource:

app.Map("dashboard", (IContactStore contacts) => BuildHtml(contacts))
.WithDescription("Open the contacts dashboard")
.AsMcpAppResource();

The client renders the HTML in a webview panel — your command logic, surfaced as interactive UI.

Control how the agent sees your commands:

app.Map("delete {id:int}", (int id) => Delete(id))
.Destructive()
.WithDescription("Delete a record permanently.");

Some commands should be available to humans in REPL mode but hidden from agents:

app.Map("debug reset", Reset)
.AutomationHidden();