
This guide takes you from zero to your first ledger read. You'll need a running
Tally instance on Windows and a AutoTally workspace.

## 1. Connect a bridge

A **bridge** is the small service that runs next to Tally and speaks its XML
protocol. Create one from the **Bridges** page in your workspace, then run it on the
machine where Tally lives:

```bash
tallyapi bridge run --token tapi_brg_XXXX
```

The bridge binds to `127.0.0.1` and connects out to the cloud — you never open an
inbound port.

## 2. Issue an API key

From **API keys**, mint a key scoped to what your agent needs:

```json
{
  "name": "Production — MCP Server",
  "scopes": ["read:ledgers", "read:vouchers", "write:vouchers"]
}
```

## 3. Make a call

Point the client at the bridge and read a ledger balance:

```ts
import { TallyApiClient } from "@tallyapi/client";

const client = new TallyApiClient({ apiKey: process.env.AUTOTALLY_KEY });
const balance = await client.getLedgerBalance("Sundry Debtors — Acme");

console.log(balance.closingBalance); // 139240
```

## 4. Wire it to an agent

The MCP server exposes the same operations as tools. Add it to your assistant and
ask, in plain language:

> Post a sales voucher for Acme — ₹1,39,240 including 18% GST.

The agent validates the ledgers, shows you a dry run, and only commits on approval.

> [!TIP]
> Every write is a dry run until you pass `commit: true`. Read
> [Write safety](/docs/concepts/write-safety) before you post to production.
