Most articles about AI in business stop at demos: chatbots answering questions, summarizing emails, writing marketing copy. Those are useful, but they don't touch the hard part — connecting AI to the systems actually running the business: accounting software, e-invoicing, inventory management, ERP.
This article is about how we do that — not theory, but lessons from a system running in production daily, serving real businesses in Vietnam.
The problem: AI can't talk to Vietnamese business software
Accounting software, e-invoicing platforms, and ERP systems in Vietnam share common traits: complex web interfaces, APIs not designed for third-party integration (if APIs exist at all), and multi-layered authentication. When a business wants AI to check inventory, review receivables, or draft an invoice — there's no simple path.
Commercial AI assistants (ChatGPT, Claude, Gemini) are powerful at language processing, data analysis, and code generation. But they can't connect to a business's internal systems on their own. You need a middleware layer — a "bridge" — so AI can read and write data in the software already in use.
The solution: MCP — a standard protocol for AI-to-system interaction
Model Context Protocol (MCP) is an open protocol developed by Anthropic that lets AI assistants call "tools" to interact with external systems. Instead of copy-pasting data into AI, you give AI direct — controlled — access to real data.
We built an MCP server infrastructure connecting to three types of software common in Vietnamese businesses:
- ERP (business management) — query orders, inventory, receivables, financial reports. AI can query data directly instead of navigating through the ERP interface.
- E-invoicing — look up issued invoices, check status, create drafts. Supports multiple invoice types: VAT, sales, POS receipts, electronic tickets.
- Accounting software — browse customer directories, vendors, inventory items, accounting vouchers. AI can aggregate numbers across modules without opening each screen.
Architecture: one server, multiple services
Rather than building a separate MCP server for each software, we designed a multi-service architecture: a single HTTP server serving multiple MCP services, each mounted at its own path.
This architecture enables:
- Deploy once, serve multiple systems. No need to run multiple processes or manage separate servers.
- Centralized authentication. Users log in once, access all services they're authorized for.
- Easy extensibility. Adding a new service means writing a module and mounting it at a new path.
The tech stack is minimal: Bun (TypeScript runtime), exactly two external dependencies (@modelcontextprotocol/sdk and zod), SQLite for audit trails and session storage. No heavy HTTP framework, no ORM, no Redis — as simple as possible for a service that needs to run reliably 24/7.
Real-world challenges
Software without public APIs
Many Vietnamese business applications don't offer official third-party APIs. The web interface is the only way to interact. We solve this by analyzing the HTTP protocol the webapp uses internally, then reproducing those requests server-side.
This requires:
- Network traffic analysis to understand internal APIs
- Complex authentication handling (cookies, CSRF tokens, custom headers)
- A Chrome Extension to capture login sessions from the browser
- Automatic session storage and rotation
Not ideal, but pragmatic. When software isn't designed for integration, this is the only way for AI to access the data.
Sensitive data and access control
Accounting data, invoices, customer information — all sensitive. AI can't be given unrestricted access.
Every tool call is logged: who called it, which tool, what parameters, how long it took, any errors. Administrators can review the complete history of AI interactions with the system.
Authentication uses the user's real credentials — no shared "admin key." AI can only access data that the user themselves can access on the source system.
Session expiration
Webapp sessions typically expire after a few hours. The system automatically detects expired sessions (HTTP 401 or redirects) and notifies the user to re-login via the extension. There's no automatic renewal — this is a technical limitation of working with webapps that don't have refresh tokens.
Real-world results
The system is running in production, serving real businesses:
- Natural language inventory queries. "Which products have the highest stock?" — AI queries the ERP and answers directly, with sorting and pagination.
- Customer receivables check. "How much does customer A owe?" — AI looks it up from accounting software, aggregating across vouchers.
- Draft invoice creation. AI can create draft invoices based on ERP data — but always requires human confirmation before official issuance.
- Cross-system reports. Instead of opening 5 different screens, AI aggregates data from multiple sources into one clean report.
Lessons learned
Start read-only
Don't give AI write access immediately. Start with lookups — read inventory, view invoices, check receivables. Once you trust the system, expand to creating drafts and updating data. E-invoicing is the perfect example: AI can create drafts, but official issuance always requires human confirmation.
Audit trails aren't optional
When AI interacts with financial data, every action must be logged. Not just for debugging — because when something goes wrong, you need to know exactly what AI did, when, and with what data.
Minimal dependencies
Production systems need stability. Fewer dependencies mean fewer failure points. The entire server uses just two external libraries — everything else is runtime built-ins. No "dependency hell" when you need to update.
Vietnamese software needs a different approach
You can't apply Western software integration patterns (clean REST APIs, OAuth, webhooks). Vietnamese software often has complex internal APIs, multi-layered auth, and limited documentation. Accept that reality and build solutions that fit — even if they're not "elegant" by textbook standards.
What's next
MCP is evolving fast — more software will support the protocol natively. But for Vietnamese business software, the integration path still needs someone who understands both sides: AI platforms and business systems. ERPFit is in that position — and we continue expanding the number of systems AI can interact with.
If your business uses accounting software, ERP, or e-invoicing and wants AI to access real data — this is the kind of integration we build every day.