Two weeks ago, I built an AI-agent in Telegram for a client — with a set of predefined operations. It worked well. Last Friday, I rewrote it as a regular button-based bot to optimize the budget. On Sunday, I realized that was a mistake. On Monday, I connected the agent to the ERPJS MCP server — and got something I didn’t expect.
This post is about a specific dialog that happened after that switch. Real client, real data, real questions. And an unexpected turn that I never programmed.
Context: a small business with 1000+ invoices
The client is a small B2B distributor. They’ve been on ERPJS for a while. All sales are in the system: 1000+ invoices for 2025, several currencies, FIFO cost basis on every line item.
Previously, the owner had a typical choice: spend hours clicking in the ERP UI, or ask me to build a custom report. Now he just types in Telegram, like writing to a colleague.
Round 1: the owner’s request
Owner: Which day of the week is the most profitable?
Agent: I have enough data — 1000 invoices from 2025. Summing revenue (fBaseSum4 in EUR) by day of week…
🏆 Most profitable day — Monday (~13,413 EUR for 2025)
Thursday and Tuesday are close (~12,156 and ~11,847 EUR respectively).
⚠️ Saturday barely works (~1,067 EUR), Sunday — only sporadic invoices.
💡 Data for 2025, 1000 confirmed invoices.
Notice the format of the answer. The agent on its own:
- Understood that “most profitable” needs to be measured in a single currency — and chose EUR as the base
- Grouped by day of week (note: dayofweek isn’t a field in the system; the agent calculated it)
- Spotted an anomaly (Saturday barely works) and commented
- Honestly stated the limits (only 2025, only confirmed invoices)
None of this query was programmed. There’s no “profit by day of week” report in the system — and there won’t be. The agent figured it out itself.
Round 2: clarification
Owner: Is this revenue or profit?
Agent: This is revenue (sum of invoices, fSum4 = Total per invoice).
Profit (gross) is revenue minus cost of goods sold. For that you’d need a GP (Gross Profit) report. Want me to look?
This is the most important moment of the dialog. The agent acknowledged the limits of its previous answer, not pretending to have answered the full question. This is the difference between an AI-assistant and an AI-analyst: an assistant gives an answer, an analyst recognizes when an answer is incomplete.
Round 3: the user teaches the agent
Owner: Do invoices update inventory in your setup? If so, the FIFO cost is in the invoice rows.
Agent: That’s what I needed! In the matrix there’s:
fFIFO— FIFO cost per unitfFIFORowVal— FIFO cost per rowfRowGP— gross profit per rowSo the data for profit calculation is there. Want me to compute GP by day of week?
The owner explained the system architecture in one sentence. The agent found the relevant fields in the schema in a second and proposed the next step. This is collaborative work, not “I ask, you answer”. The agent absorbed the new knowledge and applied it immediately.
More on FIFO and financial accounting — in our financial accounting post.
Round 4: the final answer with the anomaly
Owner: Yes, you have GP per line and per invoice. Compute for April 2026.
Agent: Excellent — the report returned detailed data. Summing revenue (fBaseSum4) and GP (debet) by day of week…
Day Revenue EUR GP EUR Margin % Monday ~2,200 ~510 ~23% Tuesday ~1,100 ~240 ~22% Wednesday ~1,900 ~490 ~26% Thursday ~1,700 ~390 ~23% Friday ~1,500 ~360 ~24% Sunday ~8,900 ~1,650 ~19% 🏆 Most profitable day in April 2026 — Sunday (~1,650 EUR GP)
⚠️ But this is almost entirely one invoice from 06/04 — a plotter for 6,678 EUR (margin only 17%). Without it, the leader is Monday (~510 EUR GP, ~23% margin).
💡 Wednesday has the best margin (~26%) — small retail sales without big discounts.
This is the moment I realized what happened. The agent:
- Found an anomaly in the data — one invoice distorted the entire statistic
- Recalculated without the anomaly — and gave a second, more honest conclusion
- Surfaced an extra insight — about margin by day, which the owner never asked for
- Switched timeframe without confusion — round 1 was the full 2025 (~13K EUR/Monday), here it’s April 2026 (~2K EUR/Monday). The agent understands “for April 2026” as a new context, not “continue with the same data”.
The owner asked “what’s the most profitable day”, and got an analytical reconnaissance: here’s the nominal answer, here’s where it comes from, here’s why it’s not entirely true, and here’s something else interesting we found.
Why this isn’t “ChatGPT with API”
Many people have heard about “AI-assistants” that hook GPT to an API and answer questions. This isn’t that. The difference is in three things:
1. The agent acknowledges its limits. A classic “GPT with API” gives the first plausible answer. Our agent volunteered: “this is revenue, not profit. Want to compute profit?”. This isn’t trained behavior — it’s a consequence of having access to the system’s structure, not just to a textual description of it.
2. The agent absorbs new knowledge. The owner explained FIFO in the matrix. The agent didn’t “forget” it 2 minutes later — it found the relevant fields in the schema and used them. It’s not magic, it’s architecture: MCP gives the agent access to register schemas, so a natural-language explanation instantly becomes an executable plan.
3. The agent finds things you didn’t ask about. Anomalies, margins, trends — none of these were in the question. The agent realized “Sunday 8,900 EUR” looked suspicious, checked, found a single big invoice, and gave a second version of the answer. This is analyst behavior — reporting not “what you wanted to hear”, but “what the data actually says”.
How it works: MCP in one paragraph
MCP (Model Context Protocol) is the standard through which AI agents access external systems. Instead of pre-programming a set of “tools” like “check stock” or “compute sales” — we expose direct access to the system to the agent through an MCP server. The agent itself decides what’s needed to answer the request. No additional programming for each new question.
The honest part: this is a prototype
I built this MCP server in one weekend. It’s field-tested on one client. This isn’t reference architecture, it’s a manifesto of intent.
What’s still needed:
- Write operations through MCP — currently only reads (data retrieval). Creating invoices, postings, transfers — next on the list.
- Multi-tenant isolation — works now, but needs testing across more clients.
- Audit trail — all MCP calls are logged, but the format needs consolidation.
I’m publishing this case publicly so we don’t have to wait for the “perfect product”. If you’re an ERPJS user and want to try your own agent — get in touch.
What this means for ERPJS clients
ERPJS is already a system with open business logic for small business. Now an open MCP server is added. This means:
- Your agent — your choice. Claude, GPT, Gemini, custom — any that supports MCP.
- Your communication channel — your choice. Telegram, WhatsApp, Slack, web chat, voice bot.
- Your scenario — your choice. Analytics, operations, monitoring, reporting — all through the same MCP access.
You’re not locked in to a single AI vendor or a single interface form. ERPJS supplies data and operations, you supply the language.
Frequently asked questions
Does this work only with ERPJS, or with any ERP?
The MCP server is built specifically for ERPJS — it knows the register schema, document formats, and module relationships. For another ERP, you’d need its own MCP server tailored to its architecture. So this is a tool for ERPJS clients, not a universal solution.
How much does an AI agent cost?
The ERPJS MCP server itself is open source, free. The cost is only the AI model tokens you choose (Claude, GPT, others). For a typical SMB with a few dozen requests a day, that’s 5-30 USD per month.
Does the agent see all the company’s data?
No. The agent sees only what its connected user can see. ERPJS has a full permission system, MCP fully respects it. Every MCP call is logged from a specific user — there’s an audit trail.
Can the agent break my system?
The MCP server is read-only right now. Creating/editing documents is a separate module under development, with extra confirmations. So the agent can give a wrong answer, but it can’t accidentally create an invoice or change data.
How long does implementation take?
If you’re already an ERPJS client, connecting MCP to your agent (e.g. Telegram bot or Claude Desktop) takes 30 minutes. It’s not a “project”, it’s “turning on a feature”.
What if my business has specific queries the agent won’t understand?
That’s the strength of the MCP approach. You don’t pre-program specific queries. If the agent doesn’t understand — it first explores the system structure, then acts. The more unique queries you give it — the better it gets at your business.
Want your own AI agent working with your ERPJS system?
If you’re already an ERPJS client — get in touch, we’ll connect MCP to your agent in 30 minutes.
If you’re still evaluating ERPJS — try the free plan, MCP will be available out of the box.