# @leumas/mcp

The MCP runtime — auto-loads mcp-servers/, lists tools (GET /mcp), and executes them (POST /tool). Mounted by leumas-api; the distribution surface for Studio.


The MCP runtime: auto-loads `mcp-servers/`, lists tools (`GET /mcp`), executes them (`POST /tool`).
Mounted by `leumas-api`; the surface Studio uses to browse/price/distribute MCP servers.

**Absorbs (DRY-consolidated from):** `opensource/mcp-server-library` (loader + executeTool + gateway) +
`leumas-cursor-agent-mvp` MCP library.

## Usage (in leumas-api)

```js
import { loadServers, createMcpRouter } from '@leumas/mcp';
import { requirePassNode } from '@leumas/auth';

const servers = await loadServers(new URL('./mcp-servers', import.meta.url).pathname);
app.use('/mcp', createMcpRouter({ servers, gate: requirePassNode() })); // gate = price/meter
```

`mcp-servers/<name>/server.json` + `tools/<tool>.js` (default export = `run(args)`). Author or compile
servers with `@leumas/mcp-kit`. Each tool can carry a `price`; the `gate` middleware meters it.


---
Source: shared/engines/mcp/README.md
Canonical: https://docs.leumas.tech/p/engines/mcp
