> ## Documentation Index
> Fetch the complete documentation index at: https://docs.uselim.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Agent Integration

> How AI agents interact with lim through MCP, Claude Code skills, and REST API.

# AI Agent Integration

lim is designed from the ground up for AI agents. While it has a CLI and web interface for humans, the primary consumers of lim's API are AI agents that autonomously handle bookkeeping.

## The Vision

Today, a human bookkeeper:

1. Downloads bank statements
2. Looks at each transaction
3. Decides the correct account classification
4. Types the journal entry into accounting software
5. Repeats 200-500 times per month

With lim, an AI agent:

1. Receives bank transactions automatically
2. Classifies each transaction using the judgment engine
3. Creates journal entries via MCP tools or REST API
4. Learns from corrections to improve over time
5. Handles 95%+ of transactions without human input

**The goal: bookkeeping that runs itself.** Humans review exceptions and make strategic decisions. The AI handles everything else.

## Three Integration Paths

<CardGroup cols={3}>
  <Card title="MCP Server" icon="plug" href="/agents/mcp-server">
    Native Model Context Protocol server. Any MCP-compatible AI agent can read financial data and
    create entries.
  </Card>

  <Card title="Claude Code Skills" icon="terminal" href="/agents/claude-code-skills">
    Register all 29 lim command groups as Claude Code skills for natural terminal-based accounting.
  </Card>

  <Card title="REST API" icon="code" href="/api/overview">
    Full REST API for custom integrations, webhooks, and programmatic access.
  </Card>
</CardGroup>

## How Agents Interact with lim

### Reading Financial Data

Agents need context to make decisions. lim provides read access to:

| Data              | MCP Resource                             | REST Endpoint                                 |
| ----------------- | ---------------------------------------- | --------------------------------------------- |
| Trial balance     | `lim://company/{id}/trial-balance`       | `GET /v1/companies/:id/reports/trial-balance` |
| Chart of accounts | `lim://company/{id}/accounts`            | `GET /v1/companies/:id/accounts`              |
| Journal entries   | `lim://company/{id}/journal-entries`     | `GET /v1/companies/:id/journal-entries`       |
| Bank transactions | `lim://company/{id}/bank-transactions`   | `GET /v1/companies/:id/bank-transactions`     |
| Active alerts     | `lim://company/{id}/alerts`              | `GET /v1/companies/:id/alert-rules/evaluate`  |
| Cash runway       | `lim://company/{id}/cash-runway`         | `GET /v1/companies/:id/dashboard`             |
| Scenario diff     | `lim://company/{id}/scenario/{sid}/diff` | `GET /v1/companies/:id/scenarios/:sid/diff`   |

### Creating Entries

Agents create journal entries through:

| Action                 | MCP Tool                 | REST Endpoint                                    |
| ---------------------- | ------------------------ | ------------------------------------------------ |
| Create journal entry   | `create_journal_entry`   | `POST /v1/companies/:id/journal-entries`         |
| Match bank transaction | `match_bank_transaction` | `POST /v1/companies/:id/nl-journal`              |
| Generate scenario      | `generate_scenario`      | `POST /v1/companies/:id/scenarios/:sid/generate` |
| Apply scenario         | `apply_scenario`         | `POST /v1/companies/:id/scenarios/:sid/apply`    |

### The Agent Workflow

A typical AI agent session looks like this:

```
Agent: Read trial balance to understand current state
       → MCP Resource: trial-balance

Agent: Read unmatched bank transactions
       → MCP Resource: bank-transactions

Agent: For each unmatched transaction:
       → MCP Tool: match_bank_transaction
       → If high confidence: auto-post
       → If low confidence: flag for human review

Agent: Check alerts
       → MCP Resource: alerts
       → If cash runway < 3 months: notify CFO

Agent: Generate scenario
       → "What if we delay hiring for 2 months?"
       → MCP Tool: generate_scenario
       → MCP Resource: scenario/{id}/diff
```

## Security Model

AI agents authenticate the same way as human users:

* **OAuth tokens** via WorkOS for interactive agents (Claude Code)
* **API keys** for automated agents (cron jobs, webhooks)

All actions are audit-logged with:

* `created_by_type: "agent"` or `"user"`
* The specific agent/user ID
* Timestamp and source event

<Warning>
  AI agents can create journal entries but cannot close fiscal periods, delete companies, or modify
  authentication settings. These actions require human authorization.
</Warning>

## Getting Started

The fastest way to start is with the MCP server:

```bash theme={null}
npx @lim-labs/lim mcp add
```

This registers lim as an MCP server in your Claude Code configuration. From there, Claude can read your financial data and create journal entries through natural conversation.

See the [MCP Server guide](/agents/mcp-server) for detailed setup instructions.
