TallyPrime MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TallyPrime MCP Server What are my outstanding receivables as of today?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TallyPrime MCP Server
Talk to your TallyPrime accounting data using plain English — powered by Claude AI.
What is this?
If you've ever used TallyPrime, you know the drill — open the app, navigate through menus, set date ranges, find the right report, and read through dense numbers. It works, but it's not exactly conversational.
This project changes that.
TallyPrime MCP Server connects TallyPrime to Claude (Anthropic's AI assistant) using a protocol called MCP (Model Context Protocol). Once set up, you can simply ask Claude things like:
"What are my outstanding receivables as of today?"
"Create a sales invoice for ABC Traders for ₹50,000 with 18% GST"
"Show me the P&L for FY 2025-26"
"Which company is currently open in Tally?"
And Claude will fetch the answer directly from your TallyPrime data — no menu navigation needed.
Related MCP server: Tally Prime MCP Server
Why do we need this?
TallyPrime is powerful, but it was designed for accountants who know exactly where every report lives. For everyone else — business owners, managers, founders — it can feel like a maze.
Here are the real problems this project solves:
Getting information is slow. To check outstanding receivables you need to open Tally, navigate to the right report, set the date, wait for it to load, and read through rows of numbers. With this project, you just ask. Claude fetches it in seconds.
You need to know Tally's language. Tally has its own terminology — voucher types, ledger groups, TDL reports. Most people just want answers, not a lesson in accounting software navigation.
Tally has no modern API. Unlike modern software, TallyPrime doesn't have a REST API or webhook system. It communicates over an old XML protocol called TDL. This project handles all of that complexity so you never have to think about it.
AI cannot access desktop software. Claude is a cloud-based AI — it has no way to open TallyPrime or read your data directly. This MCP server acts as the secure bridge between them.
Creating entries is repetitive. Typing the same kind of voucher every day — same ledgers, same format — is tedious. With this project you can describe the transaction in plain English and Claude creates it in Tally.
In short: this project removes the friction between your brain and your accounting data.
How it works
TallyPrime has a built-in Gateway Server that accepts XML requests on port 9000. This project acts as the bridge — it translates Claude's tool calls into the XML that TallyPrime understands, sends them, parses the response, and returns clean readable text back to Claude.
Architecture
┌─────────────────────────────────────────┐
│ You │
│ (ask in plain English) │
└──────────────────┬──────────────────────┘
│
┌───────────┴───────────┐
│ │
┌──────▼───────┐ ┌───────▼──────┐
│ Claude │ │ Claude.ai │
│ Desktop │ │ (web/cloud) │
│ (stdio mode) │ │ (SSE mode) │
└──────┬───────┘ └───────┬──────┘
│ MCP Protocol │
└───────────┬───────────┘
│
┌──────────────────▼──────────────────────┐
│ TallyPrime MCP Server │
│ │
│ ┌────────────┐ ┌─────────────────┐ │
│ │ server.py │ │ server_http.py │ │
│ │ (stdio) │ │ (HTTP/SSE) │ │
│ └─────┬──────┘ └────────┬────────┘ │
│ └─────────┬─────────┘ │
│ │ │
│ ┌───────────▼──────────────┐ │
│ │ 17 MCP Tools │ │
│ │ Company · Ledgers · │ │
│ │ Vouchers · Reports │ │
│ └───────────┬──────────────┘ │
│ │ │
│ ┌──────────────┴──────────────┐ │
│ │ │ │
│ ┌─▼────────────┐ ┌─────────────▼──┐ │
│ │tally_client │ │ xml_builder │ │
│ │ (HTTP calls) │ │ (TDL XML) │ │
│ └──────────────┘ └────────────────┘ │
└──────────────────┬──────────────────────┘
│ XML over HTTP (port 9000)
[Cloudflare Tunnel for cloud mode]
│
┌──────────────────▼──────────────────────┐
│ TallyPrime Gateway Server │
│ (your Windows machine) │
└──────────────────┬──────────────────────┘
│
┌──────────────────▼──────────────────────┐
│ Your accounting data │
└─────────────────────────────────────────┘Local mode (Claude Desktop): Everything runs on your machine. Claude Desktop launches the MCP server as a subprocess and communicates over stdio. Your Tally data never leaves your computer.
Cloud mode (Claude.ai): The MCP server runs on a cloud host. A Cloudflare Tunnel exposes your local TallyPrime to the internet securely so the cloud server can reach it.
Architecture Components Explained
Here is what each piece in the architecture diagram actually does and why it exists.
You
The starting point. You type a plain English question or instruction in Claude Desktop or Claude.ai. You don't need to know anything about XML, TDL, or how TallyPrime works internally.
Claude Desktop
Anthropic's official desktop app for Windows and Mac. It supports MCP servers — meaning it can launch local tools and connect to them. In this project, Claude Desktop reads claude_desktop_config.json and automatically starts the tallyprime-mcp server every time it opens. Communication happens over stdio (stdin/stdout) — completely local, no internet required.
Claude.ai (web)
The browser version of Claude at claude.ai. It can also connect to MCP servers, but only ones hosted on the internet. This is why the cloud mode requires a running HTTP server and a Cloudflare Tunnel.
server.py (stdio mode)
The entry point for Claude Desktop. When Claude Desktop launches tallyprime-mcp, this file is what runs. It uses FastMCP's stdio transport to read tool calls from Claude and send responses back. Think of it as the local receptionist — it receives Claude's requests and routes them to the right tool.
server_http.py (HTTP/SSE mode)
The entry point for Claude.ai cloud. It runs a lightweight web server using uvicorn and starlette, exposing three endpoints — /health, /sse, and /messages. Claude.ai connects via SSE (Server-Sent Events) — a persistent HTTP connection that stays open while Claude is working.
17 MCP Tools
Each tool is a Python function that Claude can call by name. Claude reads the tool's description and decides on its own when to use it and what parameters to pass. The tools are organized into four files — company.py, ledgers.py, vouchers.py, and reports.py. Every tool catches errors gracefully and returns a clean text response to Claude.
tally_client.py
The async HTTP client that actually talks to TallyPrime. It sends XML requests to http://localhost:9000, reads the response, and parses it into Python dictionaries. It also handles all the error scenarios — connection failures, timeouts, malformed XML, and TallyPrime error responses.
xml_builder.py
A library of functions that build TDL (Tally Definition Language) XML strings. TallyPrime only understands XML in a very specific format — this file knows all those formats so the rest of the code doesn't have to. Every Tally operation (get ledgers, create voucher, fetch report) has its own XML builder function here.
Cloudflare Tunnel
Only needed for cloud mode. TallyPrime runs on your local Windows machine behind a firewall — the internet can't reach it directly. Cloudflare Tunnel creates a secure outbound connection from your machine to Cloudflare's network, giving you a public URL (like https://xyz.trycloudflare.com) that forwards traffic to your local port 9000. Free to use, no account required for temporary tunnels.
TallyPrime Gateway Server
TallyPrime's built-in server that listens on port 9000. You enable it via F12 → Advanced Configuration → Enable ODBC Server. It accepts XML requests and responds with XML data from your active company. This is the only part of the architecture that Tally itself provides — everything else in this repo is built around it.
Your accounting data
The ledgers, vouchers, and reports stored in TallyPrime's database on your machine. This is what everything in this project is ultimately trying to make accessible through natural language.
The 17 MCP Tools
This project registers 17 tools that Claude can call. Each tool is a Python function with a name, description, and input parameters. Claude reads the descriptions and decides on its own which tool to use based on what you ask.
Company (1 tool)
Tool | What it does |
| Returns the name of the company currently open in TallyPrime |
Ledgers & Groups (4 tools)
Tool | What it does |
| Lists all ledgers with their parent group and closing balance |
| Gets details and voucher history for a specific ledger by name |
| Lists all account groups with their parent hierarchy |
| Creates a new ledger under a specified group with optional opening balance |
Vouchers (6 tools)
Tool | What it does |
| Fetches vouchers from the Day Book for a date range, with optional type filter |
| Creates a sales invoice with party, sales ledger, amount, and optional GST |
| Creates a purchase invoice with supplier, purchase ledger, amount, and optional GST |
| Creates a payment entry (money going out) from a bank/cash ledger |
| Creates a receipt entry (money coming in) into a bank/cash ledger |
| Creates a journal entry with a debit ledger and credit ledger |
Reports (6 tools)
Tool | What it does |
| Returns the trial balance for a given date range |
| Returns the balance sheet as of a specific date |
| Returns the profit and loss statement for a date range |
| Returns the stock/inventory summary as of a specific date |
| Returns all vouchers across all types for a date range |
| Returns bills receivable — money owed to you — as of a date |
Example prompts for each category
Company:
"Which company is currently open in Tally?"
Ledgers:
"Show me all ledgers"
"Get details for ABC Traders ledger"
"Create a ledger called XYZ Suppliers under Sundry Creditors"
Vouchers:
"Show all sales vouchers for April 2025"
"Create a sales invoice for ABC Traders for ₹50,000 + 18% GST dated today"
"Record a payment of ₹15,000 from HDFC Bank to Office Rent"
"Pass a journal entry: debit Depreciation, credit Machinery, ₹10,000"
Reports:
"Get the P&L for FY 2025-26"
"Show balance sheet as of 31 March 2026"
"What are my outstanding receivables as of today?"
"Show day book for last week"What can it do?
Company
What you ask | What happens |
"Which company is open in Tally?" | Returns the active company name |
Ledgers & Groups
What you ask | What happens |
"Show me all ledgers" | Lists all ledgers with group and closing balance |
"Get details for ledger ABC Traders" | Returns voucher history for that ledger |
"Show all account groups" | Lists all groups with parent hierarchy |
"Create a new ledger called XYZ under Sundry Debtors" | Creates the ledger in Tally |
Vouchers
What you ask | What happens |
"Show sales vouchers for April 2025" | Returns all sales entries for that period |
"Create a sales invoice for ABC Traders, ₹50,000 + 18% GST" | Creates the voucher in Tally |
"Record a purchase from Supplier X for ₹30,000" | Creates a purchase voucher |
"Record a payment of ₹10,000 from HDFC Bank to Office Rent" | Creates a payment voucher |
"Record receipt of ₹25,000 from customer DEF into SBI account" | Creates a receipt voucher |
"Pass a journal entry: debit Repairs, credit Bank, ₹5,000" | Creates a journal voucher |
Reports
What you ask | What happens |
"Get trial balance for Q1 2025" | Returns trial balance for the period |
"Show balance sheet as of 31 March 2026" | Returns balance sheet |
"Get P&L for FY 2025-26" | Returns profit and loss statement |
"Show stock summary as of today" | Returns inventory summary |
"Get day book for last week" | Returns all vouchers for that period |
"What are my outstanding receivables?" | Returns bills receivable report |
Project Structure
tallyprime-mcp/
├── src/
│ └── tallyprime_mcp/
│ ├── config.py # Reads settings from .env file
│ ├── server.py # Runs in Claude Desktop (stdio mode)
│ ├── server_http.py # Runs in cloud for Claude.ai (HTTP/SSE mode)
│ ├── tally_client.py # Talks to TallyPrime via XML over HTTP
│ ├── xml_builder.py # Builds the XML requests TallyPrime understands
│ └── tools/
│ ├── company.py # get_active_company
│ ├── ledgers.py # ledger and group tools
│ ├── vouchers.py # voucher read and create tools
│ └── reports.py # financial report tools
├── .env.example # Template for your configuration
├── .gitignore # Keeps .env and cache out of git
├── Dockerfile # For cloud deployment
├── pyproject.toml # Package config and dependencies
└── README.md # This fileRequirements
Python 3.11 or higher (tested on Python 3.14)
TallyPrime 3.x or later running on Windows
Claude Desktop (for local use) or a cloud server (for Claude.ai)
Installation
Step 1 — Clone the repo
git clone https://github.com/svharivinod/tallyprime-mcp
cd tallyprime-mcpStep 2 — Install dependencies
pip install -e .This installs everything: mcp, httpx, uvicorn, starlette, python-dotenv.
Step 3 — Create your .env file
copy .env.example .env # Windows
cp .env.example .env # Mac/LinuxOpen .env and set your Tally URL:
TALLY_URL=http://localhost:9000
TALLY_TIMEOUT=30TallyPrime Setup
TallyPrime needs its Gateway Server switched on before this project can talk to it.
Open TallyPrime
Press F12 → click Advanced Configuration
Set Enable ODBC Server → Yes
Confirm Port is 9000
Press Enter to save
To verify it's working, run:
python -c "import httpx; r = httpx.get('http://localhost:9000'); print(r.text)"You should see: <RESPONSE>TallyPrime Server is Running</RESPONSE>
Connecting to Claude Desktop
Claude Desktop is Anthropic's desktop app that supports MCP servers. Download it from: https://claude.ai/download
Step 1 — Find or create the config file
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonMac:
~/Library/Application Support/Claude/claude_desktop_config.json
Step 2 — Add this configuration
{
"mcpServers": {
"tallyprime": {
"command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Programs\\Python\\Python314\\Scripts\\tallyprime-mcp.exe",
"env": {
"TALLY_URL": "http://localhost:9000"
}
}
}
}To find the exact path of tallyprime-mcp.exe on your machine, run:
where.exe tallyprime-mcpStep 3 — Restart Claude Desktop
Fully quit Claude Desktop (right-click system tray → Quit) and reopen it.
Step 4 — Verify
Click the + button in the chat input → Connectors → you should see tallyprime listed with a blue toggle.
Connecting to Claude.ai (Cloud Mode)
For Claude.ai to reach TallyPrime (which runs locally on Windows), you need to:
Expose TallyPrime via a tunnel
Run this server in HTTP/SSE mode
Connect Claude.ai to your server URL
Step 1 — Create a tunnel with Cloudflare
Install cloudflared from: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/
Then run on your Windows machine:
cloudflared tunnel --url http://localhost:9000You'll get a URL like https://random-name.trycloudflare.com. Copy it.
Step 2 — Update your .env
TALLY_URL=https://random-name.trycloudflare.com
MCP_API_KEY=your-strong-random-secret
MCP_PORT=8000Step 3 — Start the HTTP server
tallyprime-mcp-httpStep 4 — Connect Claude.ai
Go to Claude.ai → Settings → Integrations → Add MCP Server:
URL: https://your-server-domain.com/sse
Token: your-strong-random-secretEnvironment Variables
Variable | Default | Description |
|
| TallyPrime Gateway URL |
|
| Request timeout in seconds |
|
| HTTP server bind host (cloud mode) |
|
| HTTP server port (cloud mode) |
| (empty) | Bearer token to protect cloud endpoint. Leave blank to disable auth. |
Date Format
All dates use YYYYMMDD format. Examples:
Human date | YYYYMMDD format |
1 April 2025 |
|
31 March 2026 |
|
15 August 2025 |
|
Known Issues and How We Solved Them
Building this wasn't completely straightforward. Here's what we ran into and how we fixed it — so you know what to do if you hit the same things.
TallyPrime returns invalid XML characters
Tally's XML responses sometimes contain control characters that Python's XML parser rejects. We solved this by cleaning the response with a regex before parsing:
clean = re.sub(r'[\x00-\x08\x0b\x0c\x0e-\x1f]', '', xml_text)"List of Companies" report doesn't exist in TallyPrime
The List of Companies report name returns an error in TallyPrime. Instead, we use the List of Accounts request which includes SVCURRENTCOMPANY in its response headers — and extract the company name from there using regex.
Python 3.14 asyncio compatibility
Python 3.14 removed asyncio.get_event_loop() in the main thread. We fixed this by letting FastMCP handle its own event loop instead of setting one up manually.
Claude Desktop needs full path to the executable
Claude Desktop doesn't always inherit Windows PATH. Using just "command": "tallyprime-mcp" sometimes fails. The fix is to use the full path:
C:\\Users\\username\\AppData\\Local\\Programs\\Python\\Python314\\Scripts\\tallyprime-mcp.exeRun where.exe tallyprime-mcp in PowerShell to find yours.
TallyClient context manager error
The MCP tools were failing with "Use TallyClient as an async context manager". We fixed send_xml() to create a temporary httpx client when called without a context manager, so tools work in both modes.
pip install -e . fails when Claude Desktop is running
Windows locks the .exe file when it's in use. The fix: kill Claude Desktop first with taskkill /F /IM "Claude.exe", then reinstall.
Cloud Deployment
Docker
docker build -t tallyprime-mcp .
docker run -d -p 8000:8000 \
-e TALLY_URL=https://your-tunnel.trycloudflare.com \
-e MCP_API_KEY=your-secret \
tallyprime-mcpRailway (easiest)
Push this repo to GitHub
Go to railway.app → New Project → Deploy from GitHub
Add environment variables:
TALLY_URL,MCP_API_KEYRailway auto-detects the Dockerfile and deploys
Security Notes
Never commit your
.envfile — it's already in.gitignoreAlways set a strong
MCP_API_KEYwhen running in cloud modeThe
.env.examplefile is safe to commit — it has no real valuesYour TallyPrime data never leaves your network in local/stdio mode
Tech Stack
Layer | Technology |
MCP framework |
|
HTTP client |
|
XML parsing |
|
Cloud server |
|
Config |
|
Packaging |
|
License
MIT — free to use, modify and distribute.
Available Tools
17 toolscreate_journal_voucherB
Create a journal voucher in TallyPrime (adjustment or contra entry).
Args: date: Voucher date YYYYMMDD. debit_ledger: Ledger to debit. credit_ledger: Ledger to credit. amount: Journal amount. narration: Optional description.
Inputs: date (required), debit_ledger (required), credit_ledger (required), amount (required), +1 more. Returns: result
create_ledgerA
Create a new ledger in TallyPrime.
Args: name: Name for the new ledger. group: Parent group (e.g. 'Sundry Debtors', 'Bank Accounts'). opening_balance: Opening balance. Positive=Debit, Negative=Credit. Default 0.
Inputs: name (required), group (required), opening_balance. Returns: result
create_payment_voucherA
Create a payment voucher in TallyPrime (money going out).
Args: date: Voucher date YYYYMMDD. bank_ledger: Bank or cash ledger to pay from. expense_ledger: Expense or party ledger to debit. amount: Payment amount. narration: Optional description or reference.
Inputs: date (required), bank_ledger (required), expense_ledger (required), amount (required), +1 more. Returns: result
create_purchase_voucherB
Create a purchase invoice in TallyPrime.
Args: date: Voucher date YYYYMMDD. party_ledger: Supplier ledger name. purchase_ledger: Purchase account ledger name. amount: Invoice amount excluding tax. narration: Optional description. tax_ledger: GST or tax ledger name (optional). tax_amount: Tax amount (optional, default 0).
Inputs: date (required), party_ledger (required), purchase_ledger (required), amount (required), +3 more. Returns: result
create_receipt_voucherA
Create a receipt voucher in TallyPrime (money coming in).
Args: date: Voucher date YYYYMMDD. bank_ledger: Bank or cash ledger receiving the payment. party_ledger: Customer ledger to credit. amount: Receipt amount. narration: Optional description or reference.
Inputs: date (required), bank_ledger (required), party_ledger (required), amount (required), +1 more. Returns: result
create_sales_voucherA
Create a sales invoice in TallyPrime.
Args: date: Voucher date YYYYMMDD. party_ledger: Customer ledger name (must exist in Tally). sales_ledger: Sales account ledger name. amount: Invoice amount excluding tax. narration: Optional description or invoice number. tax_ledger: GST or tax ledger name (optional). tax_amount: Tax amount (optional, default 0).
Inputs: date (required), party_ledger (required), sales_ledger (required), amount (required), +3 more. Returns: result
get_active_companyA
Get the currently active company open in TallyPrime.
Inputs: no named parameters. Returns: result
get_all_groupsA
Get all account groups defined in TallyPrime.
Inputs: no named parameters. Returns: result
get_all_ledgersA
Get all ledgers in TallyPrime with their group and closing balance.
Inputs: no named parameters. Returns: result
get_balance_sheetA
Get the Balance Sheet from TallyPrime as of a specific date.
Args: as_of_date: Date YYYYMMDD (e.g. '20250331').
Inputs: as_of_date (required). Returns: result
get_daybookA
Get the Day Book (all vouchers) from TallyPrime for a date range.
Args: from_date: Start date YYYYMMDD. to_date: End date YYYYMMDD.
Inputs: from_date (required), to_date (required). Returns: result
get_ledgerB
Get details and recent vouchers for a specific ledger.
Args: name: Exact ledger name as it appears in TallyPrime (case-sensitive).
Inputs: name (required). Returns: result
get_outstanding_receivablesA
Get outstanding receivables (money owed to you) from TallyPrime.
Args: as_of_date: Date YYYYMMDD. Defaults to today if not provided. party_name: Filter by a specific customer name (optional).
Inputs: as_of_date, party_name. Returns: result
get_profit_lossA
Get the Profit and Loss statement from TallyPrime.
Args: from_date: Start date YYYYMMDD (e.g. '20250401'). to_date: End date YYYYMMDD (e.g. '20260331').
Inputs: from_date (required), to_date (required). Returns: result
get_stock_summaryA
Get the Stock Summary (inventory) from TallyPrime as of a date.
Args: as_of_date: Date YYYYMMDD (e.g. '20260516').
Inputs: as_of_date (required). Returns: result
get_trial_balanceA
Get the Trial Balance from TallyPrime.
Args: from_date: Start date YYYYMMDD (e.g. '20250401'). to_date: End date YYYYMMDD (e.g. '20250930').
Inputs: from_date (required), to_date (required). Returns: result
get_vouchersA
Fetch vouchers from TallyPrime Day Book for a date range.
Args: from_date: Start date YYYYMMDD (e.g. '20250401'). to_date: End date YYYYMMDD (e.g. '20250430'). voucher_type: Filter — 'Sales', 'Purchase', 'Payment', 'Receipt', 'Journal'. Empty = all.
Inputs: from_date (required), to_date (required), voucher_type. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Each tool has a unique and clear purpose. Voucher creation tools are separated by type (journal, payment, purchase, receipt, sales), and query tools target distinct reports (balance sheet, profit/loss, trial balance, etc.). No overlaps or ambiguity.
All tools follow a consistent verb_noun pattern in snake_case (e.g., create_journal_voucher, get_balance_sheet). No mixing of styles or irregular naming.
17 tools is appropriate for an accounting server covering voucher creation, ledger management, and financial reports. The number is well-scoped without being overwhelming or too sparse.
The set covers core CRUD operations for vouchers and ledgers, and provides essential financial reports. However, it lacks update/delete operations for vouchers and ledgers, and misses some advanced features like GST filing.
Maintenance
Related MCP Connectors
AI for Tally Prime and Tally ERP 9. Hosted MCP server to ask your accounts in any language.
QuickBooks Online in Claude and ChatGPT: 221 tools, full ledger, multi-company, Canada + US, FR/EN.
Connect Claude to Dutch accounting software: e-Boekhouden invoices, contacts and ledgers.
Connect Claude or Cursor to books, invoices, bills, payroll, and sealed closes.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects Tally Prime ERP data to AI assistants via MCP, enabling natural language queries for financial reports, stock summaries, and ledger balances.26 npmMIT
- AlicenseNot gradedqualityBmaintenanceBridges Tally Prime ERP with AI assistants, enabling querying financial reports, managing masters, creating vouchers, and analyzing GST data through natural language.26 npmAGPL 3.0
- AlicenseNot gradedqualityDmaintenanceAn MCP server that connects Claude to TallyPrime, allowing natural language queries for reading ledgers, trial balances, and daybooks, and creating vouchers with a dry-run and confirmation safety model.68 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables LLMs like Claude and ChatGPT to access and interact with Tally Prime ERP data through MCP, including financial reports, ledgers, trial balance, balance sheet, profit and loss, and stock summary.26 npmAGPL 3.0