No description
Find a file
Ean Schuessler 46e8d9edcb Fix action execution - resolve screen path and traverse default subscreens
Critical fixes:
- Set resolvedScreenDef after successful literal path resolution (was falling back to webroot)
- Traverse default subscreens when looking up transitions (matching action discovery logic)
- Build full path including subscreens for framework transition execution

New features:
- moqui_batch_operations tool for multi-step workflows
- Enhanced validation error handling with field-level details
- ARIA mode now includes value, ref, description, describedby attributes

Documentation:
- Added render modes table and examples to AGENTS.md
- Updated README with MARIA format explanation
- Added MCP_SERVICE_DOCS wiki space with service parameter docs
2026-01-20 20:20:48 -06:00
.gradle Update screen paths from dot to slash notation 2026-01-13 15:10:30 -06:00
.settings Fix static dropdown options and remove terse mode 2026-01-19 15:46:51 -06:00
data Fix action execution - resolve screen path and traverse default subscreens 2026-01-20 20:20:48 -06:00
entity Implement clean Moqui-centric MCP v2.0 using built-in JSON-RPC 2025-11-13 19:49:57 -06:00
screen Fix action execution - resolve screen path and traverse default subscreens 2026-01-20 20:20:48 -06:00
service Fix action execution - resolve screen path and traverse default subscreens 2026-01-20 20:20:48 -06:00
src Add compact/ARIA render modes, fix framework transitions 2026-01-19 20:29:33 -06:00
test Convert McpTestSuite to Spock with @Shared ExecutionContext and update test infrastructure 2025-11-28 20:55:29 -06:00
.gitignore Add .gitignore and remove compiled artifacts from version control 2025-11-19 17:43:44 -06:00
AGENTS.md Update screen paths from dot to slash notation 2026-01-13 15:10:30 -06:00
ai-screen-theme-outline.md Ergonomic improvements for LLM discovery: tiered discovery tools, semantic naming, and recursive screen resolution 2025-12-18 17:37:44 -06:00
build.gradle Migrate to Jakarta EE Servlet 6.0 2026-01-02 14:02:15 -06:00
component.xml Add support for pulling Wiki docs into screen render 2026-01-05 13:57:13 -06:00
jina-youtube-howto.md Ergonomic improvements for LLM discovery: tiered discovery tools, semantic naming, and recursive screen resolution 2025-12-18 17:37:44 -06:00
MoquiConf.xml Add UI narrative for LLM action guidance and unify render modes 2026-01-09 21:12:43 -06:00
opencode.json Ergonomic improvements for LLM discovery: tiered discovery tools, semantic naming, and recursive screen resolution 2025-12-18 17:37:44 -06:00
README.md Fix action execution - resolve screen path and traverse default subscreens 2026-01-20 20:20:48 -06:00

Moqui MCP: AI Agents in the Enterprise

Give AI agents real jobs in real business systems.

Moqui MCP Demo

What This Is

Moqui MCP connects AI agents to Moqui Framework, an open-source ERP platform. Through MCP (Model Context Protocol), agents can browse screens, fill forms, execute transactions, and query data - the same operations humans perform through the web interface.

This isn't a chatbot bolted onto an ERP. It's AI with direct access to business operations.

What Agents Can Do

  • Browse the complete application hierarchy - catalog, orders, parties, accounting
  • Search products, customers, inventory with full query capabilities
  • Create orders, invoices, shipments, parties, products
  • Update prices, quantities, statuses, relationships
  • Execute workflows spanning multiple screens and services

All operations respect Moqui's security model. Agents see only what their user account permits.

Why Moqui?

ERP systems are the operational backbone of business. They contain:

  • Real data: Actual inventory levels, customer records, financial transactions
  • Real processes: Order-to-cash, procure-to-pay, hire-to-retire workflows
  • Real constraints: Business rules, approval chains, compliance requirements

Moqui provides all of this as open-source software with a uniquely AI-friendly architecture:

  • Declarative screens: XML definitions with rich semantic metadata
  • Service-oriented: Clean separation between UI and business logic
  • Artifact security: Fine-grained permissions on every screen, service, and entity
  • Extensible: Add AI-specific screens and services without forking

The MARIA Format

Enterprise screens are built for humans with visual context. AI agents need structured semantics. We solved this with MARIA (MCP Accessible Rich Internet Applications) - a JSON format based on W3C accessibility standards.

MARIA transforms Moqui screens into accessibility trees that LLMs naturally understand:

{
  "role": "document",
  "name": "FindParty",
  "children": [
    {
      "role": "form",
      "name": "CreatePersonForm", 
      "children": [
        {"role": "textbox", "name": "First Name", "required": true},
        {"role": "textbox", "name": "Last Name", "required": true},
        {"role": "combobox", "name": "Role", "options": 140},
        {"role": "button", "name": "createPerson"}
      ]
    },
    {
      "role": "grid",
      "name": "PartyListForm",
      "rowcount": 47,
      "columns": ["ID", "Name", "Username", "Role"],
      "children": [
        {"role": "row", "name": "John Sales"},
        {"role": "row", "name": "Jane Accountant"}
      ],
      "moreRows": 45
    }
  ]
}

The insight: AI agents are a new kind of accessibility-challenged user. They can't see pixels or interpret visual layout - they need structured semantics. This is exactly the problem ARIA solved for screen readers decades ago. But ARIA has no JSON serialization, and screen readers access accessibility trees via local OS APIs, not network protocols. MARIA fills this gap: the ARIA vocabulary, serialized as JSON, transported over MCP.

Because humans and agents interact through the same semantic model, they can explain actions to each other in the same terms. "I selected 'Shipped' from the Order Status dropdown" means the same thing whether a human or an agent did it - no translation layer needed.

Why Integrated MARIA Beats Browser Automation

Tools like Playwright MCP let agents control browsers by capturing screenshots and accessibility snapshots. This works, but it's the wrong abstraction for enterprise systems:

Aspect Playwright/Browser Integrated MARIA
Latency Screenshot → Vision model → Action Direct JSON-RPC round-trip
Token cost Images + DOM snapshots burn tokens Semantic-only payload
State access Limited to visible DOM Full server-side context
Security Browser session = full UI access Fine-grained artifact authorization
Reliability CSS changes break selectors Stable semantic contracts
Batch operations One click at a time Bulk actions in single call

MARIA delivers the accessibility tree directly from the source - no browser rendering, no vision model, no DOM scraping. The agent gets exactly the semantic structure it needs with none of the overhead.

Render Modes

Mode Output Use Case
aria MARIA accessibility tree Structured agent interaction
compact Condensed JSON summary Quick screen overview
mcp Full semantic state Complete metadata access
text Plain text Simple queries
html Standard HTML Debugging, human review

Example Session

Agent: moqui_browse_screens(path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct")

Server: {
  "summary": "20 products. Forms: NewProductForm. Actions: createProduct",
  "grids": {"ProductsForm": {"rowCount": 20, "columns": ["ID", "Name", "Type"]}},
  "actions": {"createProduct": {"service": "create#mantle.product.Product"}}
}

Agent: I need to create a new product with variants.
       moqui_browse_screens(
         path="PopCommerce/PopCommerceAdmin/Catalog/Product/FindProduct",
         action="createProduct",
         parameters={"productName": "Widget Pro", "productTypeEnumId": "PtVirtual"}
       )

Server: {
  "result": {"status": "executed", "productId": "100042"},
  "summary": "Product created. Navigate to EditProduct to add features."
}

Getting Started

# Clone with submodules
git clone --recursive https://github.com/moqui/moqui-mcp

# Build and load demo data  
./gradlew load

# Start server
./gradlew run

# MCP endpoint: http://localhost:8080/mcp

MCP Tools

Tool Purpose
moqui_browse_screens Navigate screens, execute actions, render content
moqui_search_screens Find screens by name
moqui_get_screen_details Get field metadata, dropdown options

Architecture

┌─────────────────┐     ┌──────────────────┐     ┌─────────────────┐
│   AI Agent      │────▶│   MCP Servlet    │────▶│  Moqui Screen   │
│                 │◀────│  (JSON-RPC 2.0)  │◀────│   Framework     │
└─────────────────┘     └──────────────────┘     └─────────────────┘
                                │
                        ┌───────┴───────┐
                        ▼               ▼
                ┌──────────────┐ ┌──────────────┐
                │    MARIA     │ │  Wiki Docs   │
                │  Transform   │ │  (Guidance)  │
                └──────────────┘ └──────────────┘
  • MCP Servlet: JSON-RPC 2.0 protocol, session management, authentication
  • Screen Framework: Moqui's rendering engine with MCP output mode
  • MARIA Transform: Converts semantic state to accessibility tree format
  • Wiki Docs: Screen-specific instructions with path inheritance

Use Cases

Autonomous Operations

  • Purchasing agents negotiating with supplier catalogs
  • Inventory agents reordering based on demand forecasts
  • Pricing agents adjusting margins in real-time

Assisted Workflows

  • Customer service agents with full order history access
  • Sales agents generating quotes from live pricing
  • Warehouse agents coordinating picks and shipments

Analysis & Reporting

  • Financial agents querying actuals vs. budgets
  • Operations agents identifying bottlenecks
  • Compliance agents auditing transaction trails

Security

Production deployments should:

  • Create dedicated service accounts for AI agents
  • Use Moqui artifact authorization to limit permissions
  • Enable comprehensive audit logging
  • Consider human-in-the-loop for sensitive operations
  • Start with read-only access, expand incrementally

Status

This is an active proof-of-concept. Working:

  • Screen browsing and discovery
  • Form submission and action execution
  • MARIA/compact/MCP render modes
  • Wiki documentation with inheritance
  • Artifact security integration

Roadmap:

  • Entity-level queries (beyond screen context)
  • Service direct invocation
  • Real-time notifications (ARIA live regions)
  • Multi-agent coordination patterns

Contributing

Contributions welcome:

  • Test coverage and edge cases
  • Additional ARIA role mappings
  • Performance optimization
  • Documentation and examples
  • Integration patterns for other MCP clients

License

Public domain under CC0 1.0 Universal plus Grant of Patent License, consistent with Moqui Framework.