Indexer#
The Agent Registry Indexer is a service that subscribes to the Concordium chain, processes CIS-8004 smart-contract events, and stores them in a queryable database. It exposes a REST API that powers the discovery and search tools in the MCP service.
The Indexer is optional for deployments that only need on-chain reads and transaction building. It is required for the following MCP tools:
list_agentssearch_agentsrecent_registrationsrecent_transfersagent_history
Without an Indexer, those tools return an error. All other tools read directly from the chain and work without it.
Indexed events#
The Indexer processes the following CIS-8004 event types emitted by the Agent Registry contract:
Event |
Triggered by |
|---|---|
|
A new agent NFT is minted via the |
|
An agent is deactivated via the |
|
|
|
The agent NFT is transferred to a new owner. |
|
An operator is added or removed for an agent. |
Each indexed event records the block height, block hash, transaction hash, and the decoded event payload.
Running the Indexer#
Prerequisites#
Docker (recommended) or a compatible Rust runtime.
A reachable Concordium gRPC v2 endpoint for the target network.
A PostgreSQL database (version 14 or later).
Configuration#
The Indexer reads configuration from environment variables:
Variable |
Description |
|---|---|
|
Target network. One of |
|
gRPC v2 endpoint of a Concordium node. Default: public endpoint for the configured network. |
|
Index of the CIS-8004 contract to watch. Default: |
|
Subindex of the CIS-8004 contract. Default: |
|
PostgreSQL connection string (e.g. |
|
Port for the REST API. Default: |
|
Optional block height to start indexing from. Omit to start from the contract’s deployment block. |
Docker quick-start#
docker run -e INDEXER_NETWORK=mainnet \
-e INDEXER_DATABASE_URL=postgres://user:[email protected]:5432/agent_registry \
-p 4400:4400 \
concordium/agent-registry-indexer:latest
The Indexer begins streaming events from the chain on startup and catches up from the last indexed block on restart. It exposes the REST API on port 4400 once the initial sync is complete.
REST API#
The Indexer exposes a lightweight REST API consumed by the MCP service. The base URL is configurable; the default for local deployments is http://localhost:4400.
Endpoint |
Description |
|---|---|
|
List agents with optional |
|
Substring search across |
|
Full record for a single agent by token ID. |
|
Chronological list of all indexed events for an agent. |
|
Recent |
|
Recent |
|
Returns the Indexer’s current block height and lag behind the chain tip. |
Sync state#
The Indexer maintains a cursor of the last successfully processed block. On restart, it resumes from that cursor rather than re-indexing from the beginning. The network_status MCP tool surfaces the Indexer’s current block height and its lag (in blocks) behind the chain’s latest finalised block.
A lag of a few blocks is normal; a growing lag indicates the Indexer cannot keep up with the chain and may need more resources or a faster database connection.