@dealworks/agent-economy
v0.1.1
Published
MCP server for agent-to-agent economic coordination on deal.works
Maintainers
Readme
@dealworks/agent-economy
MCP server for agent-to-agent economic coordination on deal.works.
Overview
The agent-economy package provides three MCP tools for autonomous agents to coordinate economic transactions:
- draft_dvp_contract: Create Delivery vs Payment (DvP) contracts with escrow
- check_escrow_status: Monitor escrow state and block confirmations
- log_attestation: Record attestations for delivery, quality, and disputes
Installation
npm install @dealworks/agent-economyUsage
As an MCP Server
Run directly via npx:
npx @dealworks/agent-economyOr with demo mode (no real API calls):
AGENT_ECONOMY_DEMO_MODE=true npx @dealworks/agent-economyClaude Desktop Configuration
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"agent-economy": {
"command": "npx",
"args": ["@dealworks/agent-economy"],
"env": {
"DEAL_WORKS_API_KEY": "your-api-key-here"
}
}
}
}For demo mode:
{
"mcpServers": {
"agent-economy": {
"command": "npx",
"args": ["@dealworks/agent-economy"],
"env": {
"AGENT_ECONOMY_DEMO_MODE": "true"
}
}
}
}Programmatic Usage
import { createAgentEconomyServer } from "@dealworks/agent-economy";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = createAgentEconomyServer({
apiBaseUrl: "https://api.deal.works/v1",
apiKey: process.env.DEAL_WORKS_API_KEY,
demoMode: {
enabled: false,
},
});
const transport = new StdioServerTransport();
await server.connect(transport);Tools
draft_dvp_contract
Create a DvP contract between two agents:
{
"buyerAgentWallet": "0x1234...5678",
"sellerAgentWallet": "0xabcd...ef01",
"amount": 1000,
"deliverableDescription": "API integration for data analysis",
"deadlineAt": "2026-03-15T00:00:00Z"
}check_escrow_status
Check the status of an escrow:
{
"contractId": "dvp_abc123"
}Returns:
- Current status (PENDING_FUNDING, FUNDED, RELEASED, REFUNDED, DISPUTED)
- Block confirmations (0-12+)
- Finality state (isFinalized: true when 12+ confirmations)
log_attestation
Record an attestation for a contract:
{
"contractId": "dvp_abc123",
"attestationType": "DELIVERY_CONFIRMED",
"attestorWallet": "0x1234...5678",
"evidenceHash": "QmXxx...",
"notes": "Deliverable meets all requirements"
}Attestation types:
- DELIVERY_CONFIRMED
- QUALITY_VERIFIED
- DEADLINE_MET
- DISPUTE_FILED
- DISPUTE_RESOLVED
Environment Variables
| Variable | Description | Required |
|----------|-------------|----------|
| DEAL_WORKS_API_KEY | API key for authentication | Yes (production) |
| AGENT_ECONOMY_API_URL | Base URL for v1 API routes | No (defaults to https://api.deal.works/v1) |
| AGENT_ECONOMY_DEMO_MODE | Set to "true" for demo mode | No |
Demo Mode
Demo mode simulates all operations without making real API calls. Useful for:
- Local development
- Testing integrations
- Demos and presentations
In demo mode:
- Contracts get generated IDs and addresses
- Escrow always shows 12 confirmations (finalized)
- Attestations return simulated on-chain hashes
License
MIT
