Skip to content

Commit cccd81e

Browse files
ZvonimirZvonimir
authored andcommitted
add epcis docs
1 parent 9de0a74 commit cccd81e

3 files changed

Lines changed: 36 additions & 12 deletions

File tree

docs/build-a-dkg-node-ai-agent/plugins/epcis-plugin.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,26 @@ It provides both HTTP endpoints and MCP tools for:
77
- capturing EPCIS documents
88
- checking capture status
99
- querying events with filters
10-
- retrieving published assets by UAL
10+
- tracking an item journey with full traceability
1111

1212
## Source
1313

1414
- Plugin code: `packages/plugin-epcis/src/index.ts`
1515
- Query service: `packages/plugin-epcis/src/services/epcisQueryService.ts`
1616
- Integration guide: `packages/plugin-epcis/docs/EPCIS-Integration-Guide.md`
1717

18+
## Runtime state in this repository
19+
20+
- The current main server setup in `apps/agent/src/server/index.ts` does **not** register `@dkg/plugin-epcis` by default.
21+
- This means `/epcis/*` routes and EPCIS MCP tools are unavailable in the default runtime until the plugin is mounted.
22+
- `epcis.read` and `epcis.write` are still declared OAuth scopes, but they only take effect for EPCIS once the plugin and HTTP scope guards are enabled.
23+
1824
## Quick Start
1925

20-
1. Ensure publisher plugin and epcis plugin is enabled in server plugin registration:
21-
- `apps/agent/src/server/index.ts` should include `dkgPublisherPlugin` in the `plugins` array.
26+
1. Enable EPCIS + publisher plugins in server plugin registration (this is not enabled by default in this repo):
2227
- `apps/agent/src/server/index.ts` should include `epcisPlugin` in the `plugins` array.
28+
- `apps/agent/src/server/index.ts` should include `dkgPublisherPlugin` in the `plugins` array.
29+
- If you want route-level EPCIS scope enforcement, apply `applyEpcisHttpScopeGuards(api, authorized)` in the auth middleware plugin.
2330
2. Run publisher plugin setup:
2431
- `cd packages/plugin-dkg-publisher && npm run setup`
2532
- This initializes publisher configuration (including `.env.publisher`) for the publisher flow.
@@ -56,13 +63,15 @@ Implementation note: EPCIS MCP tool handlers are guarded with `withRequiredMcpSc
5663
- `GET /epcis/events`
5764
Queries EPCIS events with filtering and pagination.
5865

59-
- `GET /epcis/asset/*ual`
60-
Retrieves an EPCIS asset by UAL.
66+
- `GET /epcis/events/track`
67+
Tracks a single EPC across all event types using full traceability.
6168

6269
### MCP Tools
6370

6471
- `epcis-query`
6572
- `epcis-track-item`
73+
- `epcis-capture`
74+
- `epcis-capture-status`
6675

6776
## Configuration
6877

@@ -148,6 +157,7 @@ curl "http://localhost:9200/epcis/events?epc=urn:epc:id:sgtin:4012345.011111.100
148157
- `POST /epcis/capture` validates the EPCIS document structure before publishing.
149158
- `GET /epcis/capture/:captureID` expects numeric capture IDs from publisher responses.
150159
- `GET /epcis/events` rejects invalid pagination and empty-string filter parameters.
160+
- `GET /epcis/events/track` requires a non-empty `epc` query parameter.
151161

152162
## Troubleshooting
153163

docs/getting-started/security.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ Follow the prompts:
8787

8888
Examples:
8989

90-
- `epcis.read` → EPCIS event read routes only (no MCP)
91-
- `epcis.write` → EPCIS capture and capture-status routes only (no MCP)
92-
- `mcp epcis.read` → EPCIS read MCP tools over `/mcp`
93-
- `mcp epcis.write` → EPCIS capture/capture-status MCP tools over `/mcp`
90+
- `epcis.read` → EPCIS read scope (effective when EPCIS plugin is enabled)
91+
- `epcis.write` → EPCIS write scope (effective when EPCIS plugin is enabled)
92+
- `mcp epcis.read` → EPCIS read MCP tools over `/mcp` (when EPCIS plugin is enabled)
93+
- `mcp epcis.write` → EPCIS capture/capture-status MCP tools over `/mcp` (when EPCIS plugin is enabled)
9494

9595
**When to use tokens**
9696

@@ -112,14 +112,20 @@ DKG Node OAuth Tokens are standard **Bearer tokens**. Include them in the `Autho
112112

113113
Access in the DKG Node is **scope-based**:
114114

115-
- By default:
115+
- By default in the current `apps/agent/src/server/index.ts` runtime:
116116
- `/mcp` → requires `mcp` scope
117117
- `/llm` → requires `llm` scope
118118
- `/blob` → requires `blob` scope
119-
- `GET /epcis/events`, `GET /epcis/events/track` → require `epcis.read`
120-
- `POST /epcis/capture`, `GET /epcis/capture/:captureID` → require `epcis.write`
119+
- `/change-password` and `/profile` → require authentication (empty scope list)
121120
- Only users or tokens with those scopes can access the corresponding routes.
122121

122+
EPCIS scopes (`epcis.read`, `epcis.write`) are included in OAuth configuration, but EPCIS routes/tools are available only after the EPCIS plugin is mounted.
123+
124+
When EPCIS is enabled and HTTP guards are applied, this mapping is used:
125+
126+
- `GET /epcis/events`, `GET /epcis/events/track``epcis.read`
127+
- `POST /epcis/capture`, `GET /epcis/capture/:captureID``epcis.write`
128+
123129
For EPCIS MCP tools (transported through `/mcp`), `/mcp` still requires `mcp`, and tools additionally require:
124130

125131
- `epcis-query`, `epcis-track-item``epcis.read`

packages/plugin-epcis/docs/EPCIS-Integration-Guide.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ This integration bridges **GS1 EPCIS 2.0** (Electronic Product Code Information
3434
- **Publish** them as tamper-proof Knowledge Assets on the DKG
3535
- **Query** events using semantic filters across the distributed network
3636

37+
### Runtime status in this repository
38+
39+
The current default server setup in `apps/agent/src/server/index.ts` does **not** register `@dkg/plugin-epcis` by default.
40+
This guide documents EPCIS behavior **when the EPCIS plugin is mounted** (and, for HTTP scope enforcement, when EPCIS scope guards are applied).
41+
3742
### Why Use DKG for EPCIS?
3843

3944
| Traditional EPCIS | EPCIS + DKG |
@@ -558,6 +563,9 @@ urn:epc:id:gdti:{CompanyPrefix}.{DocumentType}.{SerialNumber}
558563

559564
## 10. API Reference
560565

566+
> The HTTP routes below are available when `@dkg/plugin-epcis` is registered on the server.
567+
> In this repository's current default runtime, EPCIS routes are not mounted until you enable the plugin.
568+
561569
### Authorization and required scopes
562570

563571
All EPCIS HTTP routes require a Bearer token in the `Authorization` header:

0 commit comments

Comments
 (0)