How ondc-official/automation-mcp works
ondc-mcp is a stateless MCP server that acts as a mock ONDC participant. The main workflow is: an MCP client selects a build and creates a session, then drives a flow while a real participant sends signed network callbacks; the server records exchanges and returns outcomes. Separate browser forms and a session viewer support manual testing, while catalog, protocol knowledge, validation, feedback, and monitoring provide supporting capabilities. The README documents the tool→service→repository layering; sampled excerpts confirm selected session, flow, HTTP, and viewer wiring, but not every module’s internal calls.
Main entry points: capabilities.ts Capability registry · app.ts Fastify app · flow.service.ts Flow service · server.ts MCP server factory
Components 26
Server runtime
- stdio entrypoint
src/entrypoints/stdio.ts - HTTP entrypoint
src/entrypoints/http.ts - Fastify app
src/app.ts - MCP server factory
src/mcp/server.ts - Capability registry
src/mcp/capabilities.ts - Shared container
src/container.ts
Test workflow
- Build and flow catalog
src/modules/catalog/catalog.tool.ts - Session management
src/modules/session/session.tool.ts - Session service
src/modules/session/session.service.ts - Flow execution
src/modules/flow/flow.tool.ts - Flow service
src/modules/flow/flow.service.ts - Flow state engine
src/modules/flow/engine/to-engine-flow.ts - Exchange records
src/modules/record/record.tool.ts
Participant surfaces
- Inbound receiver
src/modules/transport/receiver.routes.ts - Signed sender
src/modules/transport/sender.service.ts - Hosted forms
src/modules/forms/forms.routes.ts
Protocol capabilities
- Protocol knowledge
src/modules/protocol/protocol.tool.ts - Payload validation
src/modules/validate/validate.tool.ts - Run feedback
src/modules/feedback/feedback.tool.ts
Operations
- Health probes
src/modules/health/health.routes.ts - Prometheus metrics
src/modules/metrics/metrics.routes.ts - Session viewer
src/modules/ui/ui.routes.ts - Cache store
src/lib/cache/cache-store.ts
Other components
- MCP client
- ONDC participant
- Operator / tester
Connections 29
- MCP client → stdio entrypoint: uses stdio
- MCP client → HTTP entrypoint: uses HTTP
- stdio entrypoint → MCP server factory: builds server
- HTTP entrypoint → Fastify app: starts app
- Fastify app → MCP server factory: serves MCP
- MCP server factory → Capability registry: registers tools
- Capability registry → Build and flow catalog: registers
- Capability registry → Session management: registers
- Capability registry → Flow execution: registers
- Capability registry → Exchange records: registers
- Capability registry → Protocol knowledge: registers
- Capability registry → Payload validation: registers
- Capability registry → Run feedback: registers
- Session management → Session service: calls
- Session service → Build and flow catalog: lists flows
- Flow execution → Flow service: calls
- Flow service → Flow state engine: builds engine flow
- ONDC participant → Inbound receiver: posts callbacks
- Inbound receiver → Flow service: handles inbound
- Flow service → Signed sender: sends requests
- ONDC participant → Hosted forms: opens or submits
- Operator / tester → Session viewer: views sessions
- Fastify app → Inbound receiver: registers routes
- Fastify app → Hosted forms: registers routes
- Fastify app → Health probes: registers routes
- Fastify app → Prometheus metrics: registers routes
- Fastify app → Session viewer: registers routes
- Session viewer → Cache store: reads records
- Shared container → Cache store: provides store