Documentation
Welcome to the iAgentMart developer documentation. This guide covers installation, API usage, service manifests, and the payment flow for integrating external AI agents.
iAgentMart is a self-hostable service marketplace and policy-controlled crypto payment gateway for external AI agents. It runs locally on your machine — your keys, your rules, your data.
Quick Start
Get iAgentMart running in under a minute:
macOS
tar -xzf iAgentMart-macOS.tar.gz && cd iagentmart-macos
./iAgentMart-macOS.command
Linux
tar -xzf iAgentMart-Linux.tar.gz && cd iagentmart-linux
./iAgentMart-Linux.sh
Windows (PowerShell)
Expand-Archive -Force iAgentMart-Windows.zip -DestinationPath iAgentMart-Windows
cd iAgentMart-Windows\iagentmart-windows
powershell -ExecutionPolicy Bypass -File .\iAgentMart-Windows.ps1
The launcher creates .env.local, initializes SQLite, and starts the server at http://127.0.0.1:3000.
While running, it also writes a token-free local discovery marker to ~/.iagentmart/discovery.json so AI tools can find the runtime without storing keys in shell history.
Installation Details
Download the latest packaged release for your platform. No Docker required for normal users.
Requirements
- Internet access on first run (for Node.js runtime download if needed)
- At least 4 GB RAM recommended for first-time setup
- Node.js 20.19.0+ (auto-downloaded if missing)
Optional Flags
./iAgentMart-macOS.command --port=3108 --hostname=127.0.0.1
./iAgentMart-Linux.sh --no-worker
./iAgentMart-Linux.sh --no-open
Local Data
.env.localstores local secrets and runtime configuration..iagentmart-runtime/stores the private Node.js runtime downloaded by the launcher when needed.plugins/stores installed local plugin packages and copied manifests.prisma/dev.dbis the local SQLite database for wallets, services, service calls, payments, ledger entries, and audit logs.
For source-code development, run npm install, npx prisma generate, DATABASE_URL="file:./dev.db" npm run db:init, then DATABASE_URL="file:./dev.db" IAGENTMART_ENABLE_MOCK_CHAIN_CONFIRMATION=true npm run dev.
Configuration
iAgentMart uses environment variables in .env.local (auto-generated on first run):
| Variable | Description |
|---|---|
ADMIN_TOKEN | Internal admin bearer token (auto-generated) |
WALLET_ENCRYPTION_KEY | Local wallet encryption key (auto-generated) |
CRYPTO_RPC_URLS | JSON map of chain RPC endpoints |
CRYPTO_REQUIRED_FINALITY | Finality requirement per chain |
CRYPTO_AUTO_PAYMENT_MAX_FEE_BASE_UNITS | Max gas fee per chain for auto-pay |
PAYMENT_WORKER_INTERVAL_MS | Payment worker polling interval |
IAGENTMART_ENABLE_MOCK_CHAIN_CONFIRMATION | Development-only mock confirmation switch |
IAGENTMART_MCP_REQUESTS_PER_MINUTE | MCP JSON-RPC request rate limit per Agent API key |
IAGENTMART_MCP_SERVICE_CALLS_PER_MINUTE | MCP service-call rate limit per Agent API key |
Production startup fails if ADMIN_TOKEN or WALLET_ENCRYPTION_KEY are missing/weak, or if mock chain confirmation is enabled.
Authentication
iAgentMart uses two authentication models:
Agent API Keys
External agents authenticate with Authorization: Bearer <agent_api_key>. Keys are generated once and stored as hashes.
curl -H "Authorization: Bearer am_your_key_here" \
http://127.0.0.1:3000/api/agent/v1/services/search
Admin Authentication
The local console uses a password set on first run. The internal ADMIN_TOKEN protects admin API routes.
Discovery & MCP
New local AI tools should discover iAgentMart before they receive an Agent API key:
cat ~/.iagentmart/discovery.json
curl http://localhost:3000/.well-known/iagentmart.json
curl http://localhost:3000/api/agent/v1
MCP-capable clients connect with the same Agent API key created from the local console's AI Connection flow.
curl http://localhost:3000/api/mcp \
-H "Authorization: Bearer <agent_api_key>" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
The MCP endpoint exposes search, get, call, order, payment, and dynamic iagentmart_service_* tools for installed active services. Calls still pass through wallet, budget, payment, download-risk, order-history, and audit checks.
Default MCP safety limits are 240 JSON-RPC requests per minute and 120 service calls per minute per Agent API key.
Local Runtime API Reference
REST API for the self-hosted iAgentMart runtime. These routes run in the local app/server, not in the public Cloudflare Pages website.
The hosted website currently exposes marketplace discovery, seller submission, ratings, and review endpoints under /api/services, /api/my/services, and /api/admin/services. Payment verification, service execution, wallet policy, and entitlement unlocks belong to the local runtime API described below.
Local runtime routes require Authorization: Bearer with an active agent API key.
Agent Status
Checks whether the agent connection is ready to discover, buy, and call services. The response includes agent, wallet, service, payment, marketplace, and next-action readiness state.
Search Services
Search active services. Supports q, category, chainId, assetId, limit, and cursor parameters.
Get Service Detail
Returns service details including paymentOptions[] with chain, asset, amount, and recipient info.
Marketplace Plugins
Search downloadable plugins in the configured marketplace. Free plugins install locally; paid or ambiguous matches return nextAction for local approval.
Call Service
Execute a service call. Requires Idempotency-Key header.
{
"input": { "prompt": "hello" },
"paymentOptionId": "opt_base_usdc_001"
}
Submit Payment Transaction
Verify Payment
Get Payment Status
Get Budget
Get Logs
Local Automation API
Localhost-only automation routes let desktop AI tools install or remove local plugins without carrying an Agent API key. They are rate-limited and never auto-pay; paid or ambiguous matches return a local approval URL.
{
"intent": "install",
"query": "image converter"
}
Supported intents include install, buy, delete, remove, and uninstall. Use marketplaceServiceId when search results are ambiguous.
Read-only local service metadata for installed active free services. These routes do not call seller URLs or download seller-provided content.
Admin API
Administrative endpoints for managing the local instance. Require admin bearer authorization.
Agent clients also support rotate-key, pause, activate, and revoke action endpoints.
/api/seller/services is currently a seller-facing alias for the admin-protected service listing model.
Local Payment API
Manage payments, submit transaction hashes, and verify on-chain confirmations in the self-hosted runtime. These endpoints are not implemented by the hosted website marketplace API.
{
"txId": "0xabc123...",
"chainId": "eip155:8453",
"assetId": "eip155:8453/erc20:0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"verifyNow": true
}
Wallet API
Create and manage local multi-address wallets. Wallet list/detail responses never return encrypted keystores; export is explicit.
Use /api/admin/wallet-security to set up and unlock the local wallet password before AI auto-payment can use signing wallets.
TypeScript SDK
The IAgentMartClient provides a type-safe interface for AI agents.
Basic Usage
import { discoverIAgentMart, IAgentMartClient } from "./iagentmart-client";
const discovery = await discoverIAgentMart({
baseUrl: "http://127.0.0.1:3000",
});
const client = new IAgentMartClient({
baseUrl: discovery.baseUrl || "http://127.0.0.1:3000",
apiKey: "am_your_key",
});
const status = await client.getStatus();
// Search services
const { services } = await client.searchServices();
// Auto-pay and call
const result = await client.callServiceAuto({
serviceId: services[0].id,
input: { prompt: "analyze this data" },
paymentPreference: { assetSymbol: "USDC" },
});
Admin Client
import { IAgentMartAdminClient } from "./iagentmart-client";
const admin = new IAgentMartAdminClient({
baseUrl: "http://127.0.0.1:3000",
adminToken: process.env.ADMIN_TOKEN,
});
const wallets = await admin.listWallets();
const payments = await admin.listPayments({ status: "submitted" });
Service Manifests
Services are defined by machine-readable JSON manifests. A manifest declares the service's identity, pricing, permissions, schemas, fulfillment contract, and entry point.
V1 Profile
New manifests should target the compact V1 profile. Older manifests without manifestVersion may still be treated as V1 by local runtimes, but explicit versions must match exactly.
{
"$schema": "https://iagentmart.com/schemas/iagentmart-manifest.v1.schema.json",
"manifestVersion": "iagentmart.manifest.v1"
}
Required Fields
- Recommended
$schemaandmanifestVersion=iagentmart.manifest.v1 name,displayName,version,author,categorypermissions[]— short declared capability identifiers and descriptions. Seller text is not a safety boundary.pricing.type(freeorper_call); free services use an emptyacceptedPaymentsarray, paid services include at least one completepricing.acceptedPayments[]quoteinputSchema,outputSchema— JSON Schema for validationfulfillment.type,fulfillment.requiredOutputFields[], and optionalfulfillment.sensitiveOutputentry.type(mockorhttp), optionalentry.method(GETorPOST),entry.urlfor HTTP services. Hosted services use HTTPS; local plugin runtimes may use localhost HTTP.- Optional
runtimemetadata for native local HTTP plugins:type,start,defaultPort,healthPath,endpointPath, andagentGuidePath
Accepted Payments
{
"acceptedPayments": [
{
"chainId": "eip155:8453",
"assetId": "eip155:8453/erc20:0x833589fCD...",
"assetSymbol": "USDC",
"assetDecimals": 6,
"amountBaseUnits": "1000000",
"recipientAddress": "0xYourAddress..."
}
]
}
Commercial services should prefer USDC or USDT payment options. Native tokens can serve as fallback for testing or chains without stablecoin support.
New agents should send paymentOptionId copied from paymentOptions[].id. selectedPayment is still accepted for compatibility, but mixing payment fields across options is rejected.
Local Runtime Payment Flow
The public website stores seller-declared payment options and redacts paid fulfillment URLs from public marketplace responses. The self-hosted runtime is responsible for creating payment requests, verifying chain activity, and unlocking paid service execution or downloads.
- Agent calls
POST /api/agent/v1/services/:id/callwithpaymentOptionId - Policy engine evaluates budget, derived permission gates, permissions, and wallet policy
- If a service URL appears to return a local file or attachment, iAgentMart returns
nextAction.type=confirm_service_url_downloadbefore the agent proceeds - If auto-pay is enabled and wallet is unlocked, payment is submitted automatically
- Otherwise, a
requires_paymentresponse returns payment instructions - Agent or user submits
txIdviaPOST /api/agent/v1/payments/:id/submit-tx - Payment worker verifies on-chain: payer, recipient, amount, asset, finality
- On confirmation: ledger entry created, service executed, result returned
Chain Configuration
Current open-source builds support EVM chains through eip155:* and Sui through sui:*. Solana support is temporarily disabled until its JavaScript SDK dependency risk is resolved or isolated.
Configure RPC endpoints and finality requirements via environment variables:
CRYPTO_RPC_URLS={"eip155:1":"https://eth-rpc.example","eip155:8453":"https://base-rpc.example","sui:mainnet":"https://sui-rpc.example"}
CRYPTO_REQUIRED_FINALITY={"eip155:1":"finalized","eip155:8453":"confirmed","sui:mainnet":"confirmed"}
Supported Chain Namespaces
| Namespace | Networks | Assets |
|---|---|---|
eip155 | Ethereum, Base, Polygon, BNB, Arbitrum, OP, Avalanche, Linea, Scroll | Native + ERC-20 |
sui | Sui Mainnet, Testnet | Native + Coin |
Security Model
- Private keys never leave the local machine; stored encrypted with scrypt-derived keys
- Agents cannot access private keys or bypass the policy engine
- Wallet must be unlocked by the user before AI auto-payment is allowed
- Local automation endpoints are localhost-only and rate-limited
- HTTP proxy enforces HTTPS-only, blocks private IPs, prevents DNS rebinding
- Service URLs that appear to return local downloads require explicit user confirmation
- Seller output is never trusted for payment authorization
- All idempotency enforced via unique constraints on txId and idempotency keys
Policy Engine
Every service call passes through local policy checks before payment or execution:
- Agent Client exists and is active
- Idempotency key check (replay if already processed)
- Service exists and is active
- Input matches the service's JSON Schema
- Runtime-derived permission gate is within the agent's
maxRiskLevel - Service not in
blockedServiceIds - Service in
allowedServiceIds(if set) - Category in
allowedCategories(if set) - Sensitive permission types are blocked in V1, regardless of seller-provided labels
- Free services can proceed without payment
- Paid service payment option matches
acceptedPayments - Selected payment chain has an active bound local wallet payer
- Chain/asset allowed for agent
- Per-transaction limit check
- Daily spend limit check
- Monthly spend limit check
- Wallet policy and auto-pay evaluation decide whether payment is manual or automatic
FAQ
Is iAgentMart a hosted service?
No. iAgentMart is fully self-hosted. It runs on your machine, uses your local SQLite database, and manages your own wallet keys.
Does it support fiat payments?
V1 is crypto-only. No credit cards, Stripe, PayPal, or bank transfers. USDC/USDT stablecoins are the recommended payment method.
Can agents access my private keys?
No. Agents interact through the policy engine and never have direct access to wallet keys. Keys are encrypted locally and require user-initiated unlock.
What happens if a service fails after payment?
The call is recorded as service_failed. Admins can retry the service execution without re-confirming payment. V1 does not provide automated refunds.
Can I use my own RPC endpoints?
Yes. Configure CRYPTO_RPC_URLS with your preferred RPC providers for each chain.