@enclz/mcp
v0.1.0
Published
Model Context Protocol server for the Enclz agent API. Exposes 5 tools (transfer, swap, deposit, withdraw, simulate) and 3 resources (enclz://balance, enclz://limits, enclz://history) over stdio. Compatible with Claude Desktop, Cursor, Claude Code, and an
Maintainers
Readme
@enclz/mcp
Model Context Protocol server for the Enclz agent API. Exposes 5 tools (
transfer,swap,deposit,withdraw,simulate) and 3 resources (enclz://balance,enclz://limits,enclz://history) over stdio. Works with Claude Desktop, Cursor, Claude Code, and any MCP SDK client.
Install
npx @enclz/mcpConfiguration
| Var | Required | Description |
|---|---|---|
| ENCLZ_API_KEY | yes | Agent API key minted by POST /api/v1/register. Surfaced once at registration; store it in a secrets manager. |
| ENCLZ_API_URL | yes | Base URL of the Enclz agent API (e.g. https://enclz.com or http://localhost:3001 for local dev). |
The server exits with code 1 if either is missing.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"enclz": {
"command": "npx",
"args": ["-y", "@enclz/mcp"],
"env": {
"ENCLZ_API_KEY": "enclz_your_api_key",
"ENCLZ_API_URL": "https://enclz.com"
}
}
}
}Cursor
Add to ~/.cursor/mcp.json (or .cursor/mcp.json in the project root):
{
"mcpServers": {
"enclz": {
"command": "npx",
"args": ["-y", "@enclz/mcp"],
"env": {
"ENCLZ_API_KEY": "enclz_your_api_key",
"ENCLZ_API_URL": "https://enclz.com"
}
}
}
}Claude Code
claude mcp add enclz -- npx -y @enclz/mcp
# then set ENCLZ_API_KEY / ENCLZ_API_URL via your shell or .claude/mcp.jsonWhat you get
Tools — actions the agent invokes
| Tool | Wraps | Purpose |
|---|---|---|
| transfer | POST /api/v1/transfer | Send tokens to an allow-listed recipient. |
| swap | POST /api/v1/swap | Swap one token for another with a min-out guarantee. |
| deposit | POST /api/v1/deposit | Deposit into an allow-listed lending venue. |
| withdraw | POST /api/v1/withdraw | Withdraw from an allow-listed lending venue. |
| simulate | POST /api/v1/intents/simulate | Dry-run a transfer without committing. |
Tool names are bare (transfer, not enclz_transfer); MCP clients namespace by server name. Input schemas come verbatim from openapi.json — see SKILL.md for per-tool guidance.
Resources — auto-attached to context
| URI | Wraps | Use case |
|---|---|---|
| enclz://balance | GET /api/v1/balance | Vault balances + remaining headroom. |
| enclz://limits | GET /api/v1/limits | Active spend limits and counters. |
| enclz://history | GET /api/v1/history | Recent confirmed-intent activity. |
Compliant MCP hosts pull resources every turn so the model has up-to-date balance / limits / history without burning a tool call.
Idempotency
Mutating tools accept an idempotency_key argument; if present, it is forwarded as the Idempotency-Key request header. Reuse the same key on retry — generating a new key submits a duplicate operation. Cache window: 24 hours.
The MCP layer does not auto-mint keys — that would silently defeat the contract on retry.
Errors
Tool errors come back with isError: true and a JSON body of { error: <code>, message: <prose> }. Codes are business-level (whitelist_violation, daily_limit_exceeded, idempotency_in_progress, etc); see the full list in SKILL.md. Internal stack traces and vendor-specific terminology never leak through the MCP layer.
Local development
From the repo root:
npm install # install workspace deps
npm run openapi:generate # write openapi.json from Fastify routes
cd mcp
npm run build # prebuild syncs schemas; tsc emits dist/
ENCLZ_API_KEY=... ENCLZ_API_URL=http://localhost:3001 node dist/index.jsSmoke-test without a host using the MCP inspector:
npx @modelcontextprotocol/inspector node dist/index.jsLayout
mcp/
package.json # @enclz/mcp, bin: enclz-mcp
tsconfig.json # NodeNext / ES2022 / strict
index.ts # stdio bootstrap + handler dispatch
tools.ts # 5 tool wrappers (transfer, swap, deposit, withdraw, simulate)
resources.ts # 3 resource wrappers (balance, limits, history)
client.ts # Bearer-auth fetch wrapper, idempotency header
scripts/
sync-schemas.mjs # prebuild step: derives schemas from ../openapi.json
generated/
schemas.ts # auto-derived; do not hand-edit
README.md