Skip to main content
Glama
lokesh-sparrow

PNPC-MCP-Tally-Prime

PNPC-MCP-Tally-Prime

一个模型上下文协议(MCP)服务器,让Claude能够通过TallyPrime内置的XML/HTTP网关读取和写入数据。

vaijaaaaa/Tally-MCP-Server (ISC许可)分叉,用于PNPC内部使用。原始作者的声明请参见 LICENSE

工作原理

Claude Desktop  <--stdio-->   ┐
                               ├─ this MCP server  <--HTTP/XML-->  TallyPrime (localhost:9000)
Remote MCP client <--HTTP-->  ┘

在本地,Claude Desktop将此服务器作为stdio进程启动。在远程,它也可以作为HTTP服务器运行。无论哪种方式,工具调用都会被转换为Tally的XML请求格式,发送到Tally的HTTP网关,并以清理后的JSON格式返回。此外,还有一个可选的本地SQL缓存(PGLite),用于对固定报告工具之外的数据进行临时查询。

前提条件

  • Node.js 18+

  • 已安装并运行TallyPrime,且已打开一家公司

  • 已启用Tally的HTTP网关: F1(帮助)> 设置 > 连接 > 客户端/服务器配置,并将 TallyPrime作为 设置为 两者服务器,端口为 9000(默认)。

设置

npm install
npm run build

配置Claude Desktop

选项A — 扩展(推荐): 打包为 .dxt 并一键安装。请参见 docs/EXTENSION_PACKAGING.md

选项B — 手动配置: 编辑你的Claude Desktop配置文件:

  • Windows:%APPDATA%\Claude\claude_desktop_config.json

  • macOS:~/Library/Application Support/Claude/claude_desktop_config.json

添加:

{
  "mcpServers": {
    "pnpc-tally": {
      "command": "C:\\Users\\Lokesh\\node20\\node.exe",
      "args": ["C:\\Users\\Lokesh\\PNPC-MCP-Tally-Prime\\dist\\index.js"],
      "env": {
        "TALLY_URL": "http://localhost:9000"
      }
    }
  }
}

重启Claude Desktop。你应该会看到一个锤子/工具图标,表示 pnpc-tally 服务器已连接。

可用工具

共17个工具 — 读取(分类账、库存、分组、凭证类型、成本中心、日记账、分类账凭证、公司信息、损益表、资产负债表、试算平衡表、库存汇总、应收/应付票据),写入(创建分类账、分组、库存项目、凭证),以及SQL缓存(sync_to_sqlquery_sql)。包含参数的完整参考:docs/TOOLS.md

日期使用 DD-MM-YYYY 格式,与Tally的惯例一致。

远程运行(HTTP)

TALLY_MCP_TOKEN=<secret> npm run start:http

请参见 docs/HTTP_DEPLOYMENT.md

文档

项目结构

src/
  tally.ts        Tally HTTP client: sends XML, handles connection/timeout errors
  clean.ts        Normalizes Tally's raw XML->JSON into predictable JSON
  templates.ts     Renders the Nunjucks XML templates in templates/
  db.ts             PGLite SQL cache: sync_to_sql / query_sql
  tools.ts        MCP tool definitions + XML request builders
  server.ts       Shared MCP Server construction (used by both entry points)
  index.ts        stdio entry point (local Claude Desktop)
  http-server.ts   HTTP entry point (remote clients)
templates/
  *.xml.njk       Nunjucks templates for each Tally XML request shape
manifest.json      Claude Desktop Extension (.dxt) manifest

环境变量

变量

默认值

用途

TALLY_URL

http://localhost:9000

Tally的HTTP网关地址

PORT

3939

npm run start:http 使用的端口

TALLY_MCP_TOKEN

(未设置)

如果设置,HTTP服务器的 /mcp 端点需要此Bearer令牌

故障排除

  • "无法连接到TallyPrime" — Tally未运行,或HTTP网关未在端口9000上启用。

  • "Tally返回空响应" — Tally正在运行,但未打开任何公司。

  • create_ledger / create_voucher 失败并报错 — 检查父分组/分类账名称是否与Tally中的名称完全匹配(名称区分大小写,必须完全匹配)。

路线图 / 尚未支持

  • 编辑或删除现有的凭证/分类账/主数据

  • 库存凭证(库存日记账、制造日记账等)

  • GST特定报告(GSTR-1、GSTR-3B)

  • 多公司支持(目前始终以当前打开的公司为目标)

-
license - not tested
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • MCP server for Gainium — manage trading bots, deals, and balances via AI assistants

  • Hosted MCP server for Mini Accountant: invoices, expenses, customers, analytics, tax estimates.

  • MCP Server for agents to onboard, pay, and provision services autonomously with InFlow

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lokesh-sparrow/PNPC-MCP-Tally-Prime'

If you have feedback or need assistance with the MCP directory API, please join our Discord server