lucaledger-mcp

v0.2.0
lucaledger-mcp Checked 11 hours ago Published 1 month ago

Model Context Protocol server for the LucaLedger public API.

LucaLedger MCP server A Model Context Protocol server that lets any MCP client (Claude Desktop, Claude Code, etc.) navigate and call the LucaLedger public API. Instead of exposing ~300 flat tools, it exposes a handful that reach the whole API and document themselves from the live OpenAPI spec, so it never drifts: | Tool | What it does | Needs a key? | |------|--------------|--------------| | lucaledger_whoami | The firm/key behind your API key + its scopes and limits | yes | | lucaledger_list_groups | The API's endpoint groups with counts | no | | lucaledger_search_endpoints | Find endpoints…

Summary extracted from the README.

LucaLedger MCP server

A Model Context Protocol server that lets any MCP client (Claude Desktop, Claude Code, etc.) navigate and call the LucaLedger public API.

Instead of exposing ~300 flat tools, it exposes a handful that reach the whole API and document themselves from the live OpenAPI spec, so it never drifts:

Tool What it does Needs a key?
lucaledger_whoami The firm/key behind your API key + its scopes and limits yes
lucaledger_list_groups The API's endpoint groups with counts no
lucaledger_search_endpoints Find endpoints by keyword / group / method no
lucaledger_describe_endpoint Full params, request body, and response for one endpoint no
lucaledger_read Run a GET endpoint (path params, query). Read-only: never changes data yes
lucaledger_write Run a POST / PUT / PATCH endpoint (body, idempotency, If-Match). Never deletes yes
lucaledger_call Legacy: call any endpoint by method. Prefer read / write yes

The usual flow is discover → describe → read or write: list or search for the endpoint, describe it to learn its inputs, then run it. Discovery works without a key because the API's OpenAPI document is public.

Every tool declares MCP tool annotations (a title plus readOnlyHint, destructiveHint, idempotentHint, openWorldHint). Clients that only allow read-only tools can still use the discovery tools and read. The hints are advisory: the API key's scopes remain the real permission check.

Setup

You need a LucaLedger API key (luca_sk_...), created in the app under Settings → Developer once API access is enabled for your firm.

Configuration

The server is configured entirely through environment variables. Each has a brand-neutral name and a LUCALEDGER_-prefixed alias (either works), so a white-label deployment need not mention LucaLedger anywhere:

Variable (alias) Required Default Notes
API_KEY (LUCALEDGER_API_KEY) for whoami/call – Your luca_sk_... key. Discovery tools work without it.
API_BASE (LUCALEDGER_API_BASE) no https://api.lucaledger.net Point at your API host (e.g. https://api.yourfirm.com for a white-label deployment).
API_ACCOUNT (LUCALEDGER_ACCOUNT) no – For partner keys: the managed-account id to act as.
API_VERSION (LUCALEDGER_API_VERSION) no – Overrides the key's pinned API version.
MCP_SERVER_NAME no lucaledger-mcp Display name of this server in the MCP client.
MCP_TOOL_PREFIX no lucaledger Prefix for the tool names (e.g. acmebooks → acmebooks_call).

Run it

cd mcp
npm install
npm run build

Then point your MCP client at mcp/dist/index.js. For Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "lucaledger": {
      "command": "node",
      "args": ["/absolute/path/to/mcp/dist/index.js"],
      "env": {
        "LUCALEDGER_API_KEY": "luca_sk_your_key_here"
      }
    }
  }
}

(Once this package is published to npm you can instead use "command": "npx", "args": ["-y", "lucaledger-mcp"].)

White-label deployments

The same server works for a reseller on their own domain and brand - point it at their API host and give the tools their name. Nothing here says "LucaLedger":

{
  "mcpServers": {
    "acmebooks": {
      "command": "node",
      "args": ["/absolute/path/to/mcp/dist/index.js"],
      "env": {
        "API_KEY": "luca_sk_your_key_here",
        "API_BASE": "https://api.acmebooks.com",
        "MCP_SERVER_NAME": "acmebooks-mcp",
        "MCP_TOOL_PREFIX": "acmebooks"
      }
    }
  }
}

The tools then appear as acmebooks_whoami, acmebooks_call, etc., and the API host is the reseller's own. The one identifier that stays shared is the npm package / command name itself (lucaledger-mcp); a reseller who needs even that branded can republish this package under their own name (a thin rename) - the code is already brand-neutral at runtime.

Example prompts

  • "Use lucaledger to show me what the API can do." → list_groups
  • "List this firm's clients." → search_endpoints "clients" → call clients.list
  • "Pull the profit-and-loss for entity ent_123 for 2025 (accrual)." → describe_endpoint reports.profitAndLoss → call with the path param + query.

Notes

  • Security: the API key is only ever sent in the Authorization header and is never included in tool output or error messages.
  • Key management (keys.*, partner key creation) is intentionally not callable with an API key - create keys in the app instead.
  • Rate-limit headers (X-RateLimit-*, Retry-After) are surfaced on every call result so the client can pace itself. call also supports idempotency_key (safe retries) and if_match (optimistic concurrency).

Development

npm run typecheck   # tsc
npm test            # node:test unit tests (no network)