@provenonce/mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +126 -0
- package/bin/mcp.js +3 -0
- package/dist/chunk-CD2A6ZEQ.js +151 -0
- package/dist/chunk-CD2A6ZEQ.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +376 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +137 -0
- package/dist/tools.js +8 -0
- package/dist/tools.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# @provenonce/mcp
|
|
2
|
+
|
|
3
|
+
**Provenonce Skill** — Give any AI agent cryptographic identity in under 60 seconds.
|
|
4
|
+
|
|
5
|
+
Add this skill to your agent and it gets:
|
|
6
|
+
- A permanent cryptographic hash (identity)
|
|
7
|
+
- A SIGIL (verified identity class + tier)
|
|
8
|
+
- A signed Passport (verifiable offline by any third party)
|
|
9
|
+
- Heartbeat (continuous liveness proof)
|
|
10
|
+
- Beats proofs (evidence of computational work)
|
|
11
|
+
- Lineage (full ancestry chain)
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Claude Desktop / Claude Code
|
|
16
|
+
|
|
17
|
+
Add to `~/.claude/claude_desktop_config.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"provenonce": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": ["-y", "@provenonce/mcp"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
That's it. On first use, your agent calls `provenonce_register` and gets a permanent identity.
|
|
31
|
+
|
|
32
|
+
### With pre-existing credentials
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"mcpServers": {
|
|
37
|
+
"provenonce": {
|
|
38
|
+
"command": "npx",
|
|
39
|
+
"args": ["-y", "@provenonce/mcp"],
|
|
40
|
+
"env": {
|
|
41
|
+
"PROVENONCE_API_KEY": "pvn_...",
|
|
42
|
+
"PROVENONCE_AGENT_HASH": "0x..."
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### As a skill developer (earn rev share)
|
|
50
|
+
|
|
51
|
+
If you're a developer embedding this skill in your framework, include your partner ref token:
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"env": {
|
|
56
|
+
"PROVENONCE_SKILL_REF": "your16hextoken"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
You earn 30% of every SIGIL purchased by agents you deploy. Register at `POST /api/v1/skill/register`.
|
|
62
|
+
|
|
63
|
+
## The 9 Tools
|
|
64
|
+
|
|
65
|
+
| Tool | What it does | Auth needed |
|
|
66
|
+
|------|-------------|-------------|
|
|
67
|
+
| `provenonce_register` | Auto-register agent, get hash + API key | None |
|
|
68
|
+
| `provenonce_status` | Full current state (SIGIL, balance, hints) | Yes |
|
|
69
|
+
| `provenonce_purchase_sigil` | Buy SIGIL, unlock heartbeat + passport | Yes + SOL tx |
|
|
70
|
+
| `provenonce_heartbeat` | Submit liveness proof | Yes + SOL tx |
|
|
71
|
+
| `provenonce_get_passport` | Get signed identity document | Yes |
|
|
72
|
+
| `provenonce_beats_proof` | Compute local work proof | None |
|
|
73
|
+
| `provenonce_verify_agent` | Check another agent's identity | None |
|
|
74
|
+
| `provenonce_spawn` | Spawn a child agent | Yes |
|
|
75
|
+
| `provenonce_get_lineage` | Get full ancestry chain | None |
|
|
76
|
+
|
|
77
|
+
## Agent Flow
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Day 1: provenonce_register → hash minted, credentials saved
|
|
81
|
+
provenonce_beats_proof → works immediately, no SIGIL needed
|
|
82
|
+
provenonce_status → { sigil: null, _hint: "Call provenonce_purchase_sigil..." }
|
|
83
|
+
|
|
84
|
+
Day 7: provenonce_purchase_sigil → pay SOL, SIGIL issued
|
|
85
|
+
provenonce_heartbeat → now unlocked
|
|
86
|
+
provenonce_get_passport → signed identity doc, share with anyone
|
|
87
|
+
provenonce_verify_agent → verify a counterparty before trusting them
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Environment Variables
|
|
91
|
+
|
|
92
|
+
| Variable | Description | Default |
|
|
93
|
+
|----------|-------------|---------|
|
|
94
|
+
| `PROVENONCE_API_KEY` | Agent API key (pvn_...) | Read from ~/.provenonce/config.json |
|
|
95
|
+
| `PROVENONCE_AGENT_HASH` | Agent hash (0x...) | Read from ~/.provenonce/config.json |
|
|
96
|
+
| `PROVENONCE_SKILL_REF` | Your partner ref token (for rev share) | None |
|
|
97
|
+
| `PROVENONCE_REGISTRY_URL` | Registry URL override | https://provenonce.io |
|
|
98
|
+
|
|
99
|
+
## Framework-Agnostic Usage
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
import { PROVENONCE_TOOLS } from '@provenonce/mcp/tools';
|
|
103
|
+
|
|
104
|
+
// OpenAI
|
|
105
|
+
const tools = PROVENONCE_TOOLS.map(t => ({ type: 'function', function: t }));
|
|
106
|
+
|
|
107
|
+
// LangChain / custom — use PROVENONCE_TOOLS for schema, implement handlers yourself
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Credential Storage
|
|
111
|
+
|
|
112
|
+
Credentials are stored in `~/.provenonce/config.json` with `chmod 600` permissions (Unix).
|
|
113
|
+
|
|
114
|
+
On Windows, use environment variables (`PROVENONCE_API_KEY` + `PROVENONCE_AGENT_HASH`) — file permissions are not enforced.
|
|
115
|
+
|
|
116
|
+
## What's Coming
|
|
117
|
+
|
|
118
|
+
- `provenonce_kyc` — KYC / identity class upgrade
|
|
119
|
+
- Auto-heartbeat timer (opt-in)
|
|
120
|
+
- Python SDK (`provenonce-mcp`)
|
|
121
|
+
|
|
122
|
+
## Links
|
|
123
|
+
|
|
124
|
+
- Registry: [provenonce.io](https://provenonce.io)
|
|
125
|
+
- Docs: [provenonce.dev](https://provenonce.dev)
|
|
126
|
+
- API: [provenonce.io/openapi.yaml](https://provenonce.io/openapi.yaml)
|
package/bin/mcp.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
// @provenonce/mcp — Provenonce Skill for AI agents
|
|
2
|
+
|
|
3
|
+
// src/tools.ts
|
|
4
|
+
var PROVENONCE_TOOLS = [
|
|
5
|
+
{
|
|
6
|
+
name: "provenonce_register",
|
|
7
|
+
description: "Register this agent with Provenonce to get a cryptographic identity (hash + API key). Safe to call multiple times \u2014 returns existing identity if already registered. No wallet required. Free.",
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
name: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Human-readable name for this agent (optional, max 64 chars)",
|
|
14
|
+
maxLength: 64
|
|
15
|
+
},
|
|
16
|
+
skill_ref: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "16-character hex ref token of the skill that deployed you \u2014 for rev-share attribution (optional)",
|
|
19
|
+
pattern: "^[0-9a-f]{16}$"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "provenonce_status",
|
|
26
|
+
description: "Get this agent's current Provenonce status: identity, SIGIL, beats balance, and next steps. Requires prior provenonce_register call.",
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "provenonce_purchase_sigil",
|
|
34
|
+
description: "Purchase a Provenonce SIGIL to unlock full provenance: heartbeat access, signed passport, and a permanent identity record. Requires a Solana payment transaction. SIGIL format: name*principal*tier (e.g. my-agent*acme*ind).",
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: "object",
|
|
37
|
+
properties: {
|
|
38
|
+
name: {
|
|
39
|
+
type: "string",
|
|
40
|
+
description: 'SIGIL name segment \u2014 identifies this specific agent (e.g. "my-agent")'
|
|
41
|
+
},
|
|
42
|
+
principal: {
|
|
43
|
+
type: "string",
|
|
44
|
+
description: 'Principal segment \u2014 identifies the operator or organisation (e.g. "acme")'
|
|
45
|
+
},
|
|
46
|
+
identity_class: {
|
|
47
|
+
type: "string",
|
|
48
|
+
enum: ["ind", "org", "sov", "eph", "sbx"],
|
|
49
|
+
description: "Identity class: ind=individual, org=organisation, sov=sovereign, eph=ephemeral, sbx=sandbox"
|
|
50
|
+
},
|
|
51
|
+
payment_tx: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Solana transaction signature for the SIGIL fee payment"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
required: ["name", "principal", "identity_class", "payment_tx"]
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "provenonce_heartbeat",
|
|
61
|
+
description: "Submit a heartbeat to prove this agent is alive. Requires a SIGIL (call provenonce_purchase_sigil first). Requires a Solana payment transaction for the heartbeat fee.",
|
|
62
|
+
inputSchema: {
|
|
63
|
+
type: "object",
|
|
64
|
+
properties: {
|
|
65
|
+
payment_tx: {
|
|
66
|
+
type: "string",
|
|
67
|
+
description: "Solana transaction signature for the heartbeat fee payment"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
required: ["payment_tx"]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "provenonce_get_passport",
|
|
75
|
+
description: "Get this agent's cryptographically signed Passport \u2014 a verifiable identity document any third party can verify offline using the Provenonce authority public key. Requires an active SIGIL and at least one heartbeat.",
|
|
76
|
+
inputSchema: {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
payment_tx: {
|
|
80
|
+
type: "string",
|
|
81
|
+
description: "Solana transaction signature for the passport reissue fee (if applicable)"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "provenonce_beats_proof",
|
|
88
|
+
description: "Compute a local Beats work-proof \u2014 cryptographic evidence of computational effort by this agent. Returns a hash chain proof that can be shared as evidence of work. No network call required.",
|
|
89
|
+
inputSchema: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {
|
|
92
|
+
count: {
|
|
93
|
+
type: "integer",
|
|
94
|
+
description: "Number of beats to compute (min 10, max 1000)",
|
|
95
|
+
minimum: 10,
|
|
96
|
+
maximum: 1e3
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
required: ["count"]
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "provenonce_verify_agent",
|
|
104
|
+
description: "Verify another agent's Provenonce identity. Returns their SIGIL, identity class, and registration status. Public \u2014 no authentication required.",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {
|
|
108
|
+
hash: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "The agent hash to verify (0x + 64 hex chars)",
|
|
111
|
+
pattern: "^0x[0-9a-fA-F]{64}$"
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
required: ["hash"]
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "provenonce_spawn",
|
|
119
|
+
description: "Spawn a child agent under this agent's identity. The child inherits lineage from the parent. Returns the child's hash and API key. Requires sufficient beats balance or a work-proof receipt.",
|
|
120
|
+
inputSchema: {
|
|
121
|
+
type: "object",
|
|
122
|
+
properties: {
|
|
123
|
+
child_name: {
|
|
124
|
+
type: "string",
|
|
125
|
+
description: "Name for the child agent (max 64 chars)",
|
|
126
|
+
maxLength: 64
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
required: ["child_name"]
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: "provenonce_get_lineage",
|
|
134
|
+
description: "Get the full lineage chain for an agent \u2014 all events in its provenance history (registration, SIGIL issuance, heartbeats, spawns). Public \u2014 no authentication required.",
|
|
135
|
+
inputSchema: {
|
|
136
|
+
type: "object",
|
|
137
|
+
properties: {
|
|
138
|
+
hash: {
|
|
139
|
+
type: "string",
|
|
140
|
+
description: "The agent hash to get lineage for (0x + 64 hex chars). Defaults to this agent if omitted.",
|
|
141
|
+
pattern: "^0x[0-9a-fA-F]{64}$"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
export {
|
|
149
|
+
PROVENONCE_TOOLS
|
|
150
|
+
};
|
|
151
|
+
//# sourceMappingURL=chunk-CD2A6ZEQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools.ts"],"sourcesContent":["/** Provenonce Skill — 9 MCP tool definitions (JSON Schema) */\r\nexport const PROVENONCE_TOOLS = [\r\n {\r\n name: 'provenonce_register',\r\n description:\r\n 'Register this agent with Provenonce to get a cryptographic identity (hash + API key). ' +\r\n 'Safe to call multiple times — returns existing identity if already registered. ' +\r\n 'No wallet required. Free.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n name: {\r\n type: 'string',\r\n description: 'Human-readable name for this agent (optional, max 64 chars)',\r\n maxLength: 64,\r\n },\r\n skill_ref: {\r\n type: 'string',\r\n description:\r\n '16-character hex ref token of the skill that deployed you — for rev-share attribution (optional)',\r\n pattern: '^[0-9a-f]{16}$',\r\n },\r\n },\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_status',\r\n description:\r\n 'Get this agent\\'s current Provenonce status: identity, SIGIL, beats balance, and next steps. ' +\r\n 'Requires prior provenonce_register call.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {},\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_purchase_sigil',\r\n description:\r\n 'Purchase a Provenonce SIGIL to unlock full provenance: heartbeat access, signed passport, ' +\r\n 'and a permanent identity record. Requires a Solana payment transaction. ' +\r\n 'SIGIL format: name*principal*tier (e.g. my-agent*acme*ind).',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n name: {\r\n type: 'string',\r\n description: 'SIGIL name segment — identifies this specific agent (e.g. \"my-agent\")',\r\n },\r\n principal: {\r\n type: 'string',\r\n description: 'Principal segment — identifies the operator or organisation (e.g. \"acme\")',\r\n },\r\n identity_class: {\r\n type: 'string',\r\n enum: ['ind', 'org', 'sov', 'eph', 'sbx'],\r\n description:\r\n 'Identity class: ind=individual, org=organisation, sov=sovereign, eph=ephemeral, sbx=sandbox',\r\n },\r\n payment_tx: {\r\n type: 'string',\r\n description: 'Solana transaction signature for the SIGIL fee payment',\r\n },\r\n },\r\n required: ['name', 'principal', 'identity_class', 'payment_tx'],\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_heartbeat',\r\n description:\r\n 'Submit a heartbeat to prove this agent is alive. Requires a SIGIL (call provenonce_purchase_sigil first). ' +\r\n 'Requires a Solana payment transaction for the heartbeat fee.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n payment_tx: {\r\n type: 'string',\r\n description: 'Solana transaction signature for the heartbeat fee payment',\r\n },\r\n },\r\n required: ['payment_tx'],\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_get_passport',\r\n description:\r\n 'Get this agent\\'s cryptographically signed Passport — a verifiable identity document ' +\r\n 'any third party can verify offline using the Provenonce authority public key. ' +\r\n 'Requires an active SIGIL and at least one heartbeat.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n payment_tx: {\r\n type: 'string',\r\n description: 'Solana transaction signature for the passport reissue fee (if applicable)',\r\n },\r\n },\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_beats_proof',\r\n description:\r\n 'Compute a local Beats work-proof — cryptographic evidence of computational effort by this agent. ' +\r\n 'Returns a hash chain proof that can be shared as evidence of work. No network call required.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n count: {\r\n type: 'integer',\r\n description: 'Number of beats to compute (min 10, max 1000)',\r\n minimum: 10,\r\n maximum: 1000,\r\n },\r\n },\r\n required: ['count'],\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_verify_agent',\r\n description:\r\n 'Verify another agent\\'s Provenonce identity. Returns their SIGIL, identity class, and registration status. ' +\r\n 'Public — no authentication required.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n hash: {\r\n type: 'string',\r\n description: 'The agent hash to verify (0x + 64 hex chars)',\r\n pattern: '^0x[0-9a-fA-F]{64}$',\r\n },\r\n },\r\n required: ['hash'],\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_spawn',\r\n description:\r\n 'Spawn a child agent under this agent\\'s identity. The child inherits lineage from the parent. ' +\r\n 'Returns the child\\'s hash and API key. Requires sufficient beats balance or a work-proof receipt.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n child_name: {\r\n type: 'string',\r\n description: 'Name for the child agent (max 64 chars)',\r\n maxLength: 64,\r\n },\r\n },\r\n required: ['child_name'],\r\n },\r\n },\r\n\r\n {\r\n name: 'provenonce_get_lineage',\r\n description:\r\n 'Get the full lineage chain for an agent — all events in its provenance history ' +\r\n '(registration, SIGIL issuance, heartbeats, spawns). Public — no authentication required.',\r\n inputSchema: {\r\n type: 'object',\r\n properties: {\r\n hash: {\r\n type: 'string',\r\n description:\r\n 'The agent hash to get lineage for (0x + 64 hex chars). Defaults to this agent if omitted.',\r\n pattern: '^0x[0-9a-fA-F]{64}$',\r\n },\r\n },\r\n },\r\n },\r\n] as const;\r\n\r\nexport type ToolName = (typeof PROVENONCE_TOOLS)[number]['name'];\r\n"],"mappings":";;;AACO,IAAM,mBAAmB;AAAA,EAC9B;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IAGF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,Y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E,MAAM;AAAA,IACN,aACE;AAAA,IAEF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,OAAO;AAAA,UACL,MAAM;AAAA,UACN,aAAa;AAAA,UACb,SAAS;AAAA,UACT,SAAS;AAAA,QACX;AAAA,MACF;AAAA,MACA,UAAU,CAAC,OAAO;AAAA,IACpB;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IAEF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,aAAa;AAAA,UACb,SAAS;AAAA,QACX;AAAA,MACF;AAAA,MACA,UAAU,CAAC,MAAM;AAAA,IACnB;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IAEF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,YAAY;AAAA,UACV,MAAM;AAAA,UACN,aAAa;AAAA,UACb,WAAW;AAAA,QACb;AAAA,MACF;AAAA,MACA,UAAU,CAAC,YAAY;AAAA,IACzB;AAAA,EACF;AAAA,EAEA;AAAA,IACE,MAAM;AAAA,IACN,aACE;AAAA,IAEF,aAAa;AAAA,MACX,MAAM;AAAA,MACN,YAAY;AAAA,QACV,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,aACE;AAAA,UACF,SAAS;AAAA,QACX;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
// @provenonce/mcp — Provenonce Skill for AI agents
|
|
2
|
+
import {
|
|
3
|
+
PROVENONCE_TOOLS
|
|
4
|
+
} from "./chunk-CD2A6ZEQ.js";
|
|
5
|
+
|
|
6
|
+
// src/index.ts
|
|
7
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
8
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
|
+
import {
|
|
10
|
+
CallToolRequestSchema,
|
|
11
|
+
ListToolsRequestSchema
|
|
12
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
13
|
+
|
|
14
|
+
// src/handlers.ts
|
|
15
|
+
import { createHash } from "crypto";
|
|
16
|
+
|
|
17
|
+
// src/credentials.ts
|
|
18
|
+
import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync } from "fs";
|
|
19
|
+
import { join } from "path";
|
|
20
|
+
import { homedir } from "os";
|
|
21
|
+
function getConfigDir() {
|
|
22
|
+
return join(homedir(), ".provenonce");
|
|
23
|
+
}
|
|
24
|
+
function getConfigPath() {
|
|
25
|
+
return join(getConfigDir(), "config.json");
|
|
26
|
+
}
|
|
27
|
+
function loadCredentials() {
|
|
28
|
+
const apiKey = process.env.PROVENONCE_API_KEY;
|
|
29
|
+
const agentHash = process.env.PROVENONCE_AGENT_HASH;
|
|
30
|
+
if (apiKey && agentHash) {
|
|
31
|
+
return { api_key: apiKey, agent_hash: agentHash };
|
|
32
|
+
}
|
|
33
|
+
const configPath = getConfigPath();
|
|
34
|
+
if (!existsSync(configPath)) return null;
|
|
35
|
+
try {
|
|
36
|
+
const raw = readFileSync(configPath, "utf-8");
|
|
37
|
+
const parsed = JSON.parse(raw);
|
|
38
|
+
if (parsed.api_key && parsed.agent_hash) {
|
|
39
|
+
return { api_key: parsed.api_key, agent_hash: parsed.agent_hash };
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function saveCredentials(creds) {
|
|
46
|
+
const dir = getConfigDir();
|
|
47
|
+
if (!existsSync(dir)) {
|
|
48
|
+
mkdirSync(dir, { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
const configPath = getConfigPath();
|
|
51
|
+
const data = {
|
|
52
|
+
api_key: creds.api_key,
|
|
53
|
+
agent_hash: creds.agent_hash
|
|
54
|
+
};
|
|
55
|
+
writeFileSync(configPath, JSON.stringify(data, null, 2), "utf-8");
|
|
56
|
+
try {
|
|
57
|
+
chmodSync(configPath, 384);
|
|
58
|
+
} catch {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/client.ts
|
|
63
|
+
var REGISTRY_URL = process.env.PROVENONCE_REGISTRY_URL || "https://provenonce.io";
|
|
64
|
+
async function apiFetch(path, opts = {}) {
|
|
65
|
+
const headers = { "Content-Type": "application/json" };
|
|
66
|
+
if (opts.apiKey) headers["Authorization"] = `Bearer ${opts.apiKey}`;
|
|
67
|
+
try {
|
|
68
|
+
const res = await fetch(`${REGISTRY_URL}${path}`, {
|
|
69
|
+
method: opts.method ?? "GET",
|
|
70
|
+
headers,
|
|
71
|
+
body: opts.body ? JSON.stringify(opts.body) : void 0
|
|
72
|
+
});
|
|
73
|
+
const json = await res.json();
|
|
74
|
+
if (!res.ok) {
|
|
75
|
+
const msg = json.error ?? `HTTP ${res.status}`;
|
|
76
|
+
return { data: null, error: msg };
|
|
77
|
+
}
|
|
78
|
+
return { data: json, error: null };
|
|
79
|
+
} catch (err2) {
|
|
80
|
+
return { data: null, error: err2.message };
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function registerAgent(opts) {
|
|
84
|
+
return apiFetch("/api/v1/register", {
|
|
85
|
+
method: "POST",
|
|
86
|
+
body: {
|
|
87
|
+
name: opts.name,
|
|
88
|
+
wallet: "none",
|
|
89
|
+
...opts.skillRef ? { ref: opts.skillRef } : {}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async function getStatus(apiKey) {
|
|
94
|
+
return apiFetch("/api/v1/skill/bootstrap", {
|
|
95
|
+
method: "POST",
|
|
96
|
+
apiKey,
|
|
97
|
+
body: {}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
async function heartbeat(apiKey, paymentTx) {
|
|
101
|
+
return apiFetch("/api/v1/agent/heartbeat", {
|
|
102
|
+
method: "POST",
|
|
103
|
+
apiKey,
|
|
104
|
+
body: { payment_tx: paymentTx }
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
async function getPassport(apiKey, paymentTx) {
|
|
108
|
+
return apiFetch("/api/v1/agent/reissue-proof", {
|
|
109
|
+
method: "POST",
|
|
110
|
+
apiKey,
|
|
111
|
+
body: paymentTx ? { payment_tx: paymentTx } : {}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
async function purchaseSigil(apiKey, opts) {
|
|
115
|
+
return apiFetch("/api/v1/sigil", {
|
|
116
|
+
method: "POST",
|
|
117
|
+
apiKey,
|
|
118
|
+
body: {
|
|
119
|
+
name: opts.name,
|
|
120
|
+
principal: opts.principal,
|
|
121
|
+
identity_class: opts.identity_class,
|
|
122
|
+
payment_tx: opts.payment_tx,
|
|
123
|
+
...opts.skillRef ? { ref: opts.skillRef } : {}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
async function verifyAgent(hash) {
|
|
128
|
+
return apiFetch(`/api/v1/verify/${encodeURIComponent(hash)}`);
|
|
129
|
+
}
|
|
130
|
+
async function getLineage(hash) {
|
|
131
|
+
return apiFetch(`/api/v1/agent/lineage/${encodeURIComponent(hash)}`);
|
|
132
|
+
}
|
|
133
|
+
async function spawnChild(apiKey, opts) {
|
|
134
|
+
const step1 = await apiFetch("/api/v1/agent/spawn", {
|
|
135
|
+
method: "POST",
|
|
136
|
+
apiKey,
|
|
137
|
+
body: { child_name: opts.childName }
|
|
138
|
+
});
|
|
139
|
+
if (step1.error || !step1.data?.spawn_authorization) {
|
|
140
|
+
return { data: null, error: step1.error ?? "Spawn step 1 failed: no authorization returned" };
|
|
141
|
+
}
|
|
142
|
+
const spawnAuth = step1.data.spawn_authorization;
|
|
143
|
+
const reg = await apiFetch("/api/v1/register", {
|
|
144
|
+
method: "POST",
|
|
145
|
+
apiKey,
|
|
146
|
+
body: {
|
|
147
|
+
name: opts.childName,
|
|
148
|
+
wallet: "none",
|
|
149
|
+
spawn_authorization: spawnAuth
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
if (reg.error || !reg.data?.hash) {
|
|
153
|
+
return { data: null, error: reg.error ?? "Spawn step 2 (child registration) failed" };
|
|
154
|
+
}
|
|
155
|
+
const childHash = reg.data.hash;
|
|
156
|
+
const childApiKey = reg.data.api_key;
|
|
157
|
+
const step3 = await apiFetch("/api/v1/agent/spawn", {
|
|
158
|
+
method: "POST",
|
|
159
|
+
apiKey,
|
|
160
|
+
body: { child_hash: childHash }
|
|
161
|
+
});
|
|
162
|
+
if (step3.error) {
|
|
163
|
+
return { data: null, error: step3.error };
|
|
164
|
+
}
|
|
165
|
+
return {
|
|
166
|
+
data: {
|
|
167
|
+
child_hash: childHash,
|
|
168
|
+
child_api_key: childApiKey,
|
|
169
|
+
child_depth: reg.data.depth,
|
|
170
|
+
parent_hash: opts.parentHash
|
|
171
|
+
},
|
|
172
|
+
error: null
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/handlers.ts
|
|
177
|
+
function requireCredentials() {
|
|
178
|
+
const creds = loadCredentials();
|
|
179
|
+
if (!creds) {
|
|
180
|
+
throw new Error(
|
|
181
|
+
"Not registered. Call provenonce_register first."
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
return creds;
|
|
185
|
+
}
|
|
186
|
+
function ok(data) {
|
|
187
|
+
return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
|
|
188
|
+
}
|
|
189
|
+
function err(message) {
|
|
190
|
+
return { content: [{ type: "text", text: `Error: ${message}` }], isError: true };
|
|
191
|
+
}
|
|
192
|
+
async function handleRegister(args) {
|
|
193
|
+
const existing = loadCredentials();
|
|
194
|
+
if (existing) {
|
|
195
|
+
const { data: data2, error: error2 } = await getStatus(existing.api_key);
|
|
196
|
+
if (data2) {
|
|
197
|
+
return ok({
|
|
198
|
+
registered: false,
|
|
199
|
+
message: "Already registered \u2014 returning existing identity.",
|
|
200
|
+
hash: existing.agent_hash,
|
|
201
|
+
sigil: data2.sigil,
|
|
202
|
+
identity_class: data2.identity_class,
|
|
203
|
+
_hint: data2._hint
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
if (error2) {
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const { data, error } = await registerAgent({
|
|
210
|
+
name: args.name,
|
|
211
|
+
skillRef: args.skill_ref
|
|
212
|
+
});
|
|
213
|
+
if (error || !data) return err(error ?? "Registration failed");
|
|
214
|
+
saveCredentials({ api_key: data.api_key, agent_hash: data.hash });
|
|
215
|
+
return ok({
|
|
216
|
+
registered: true,
|
|
217
|
+
hash: data.hash,
|
|
218
|
+
api_key: data.api_key,
|
|
219
|
+
depth: data.depth,
|
|
220
|
+
message: "Agent registered. Credentials saved. Call provenonce_status to see your full state.",
|
|
221
|
+
_warning: "Save your api_key securely. It will not be shown again after this session."
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async function handleStatus() {
|
|
225
|
+
const creds = requireCredentials();
|
|
226
|
+
const { data, error } = await getStatus(creds.api_key);
|
|
227
|
+
if (error || !data) return err(error ?? "Failed to get status");
|
|
228
|
+
return ok(data);
|
|
229
|
+
}
|
|
230
|
+
async function handlePurchaseSigil(args) {
|
|
231
|
+
const creds = requireCredentials();
|
|
232
|
+
const skillRef = process.env.PROVENONCE_SKILL_REF;
|
|
233
|
+
const { data, error } = await purchaseSigil(creds.api_key, {
|
|
234
|
+
name: args.name,
|
|
235
|
+
principal: args.principal,
|
|
236
|
+
identity_class: args.identity_class,
|
|
237
|
+
payment_tx: args.payment_tx,
|
|
238
|
+
skillRef
|
|
239
|
+
});
|
|
240
|
+
if (error || !data) return err(error ?? "SIGIL purchase failed");
|
|
241
|
+
return ok({
|
|
242
|
+
...data,
|
|
243
|
+
heartbeat_unlocked: true,
|
|
244
|
+
message: `SIGIL issued: ${data.sigil}. You can now call provenonce_heartbeat and provenonce_get_passport.`
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
async function handleHeartbeat(args) {
|
|
248
|
+
const creds = requireCredentials();
|
|
249
|
+
const { data, error } = await heartbeat(creds.api_key, args.payment_tx);
|
|
250
|
+
if (error || !data) return err(error ?? "Heartbeat failed");
|
|
251
|
+
if (!data.ok && data.sigil_required) {
|
|
252
|
+
return err("SIGIL required. Call provenonce_purchase_sigil first.");
|
|
253
|
+
}
|
|
254
|
+
return ok({
|
|
255
|
+
ok: data.ok,
|
|
256
|
+
message: data.ok ? "Heartbeat recorded. Agent liveness confirmed." : "Heartbeat failed."
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
async function handleGetPassport(args) {
|
|
260
|
+
const creds = requireCredentials();
|
|
261
|
+
const { data, error } = await getPassport(creds.api_key, args.payment_tx);
|
|
262
|
+
if (error || !data) return err(error ?? "Passport retrieval failed");
|
|
263
|
+
return ok({
|
|
264
|
+
passport: data.lineage_proof,
|
|
265
|
+
message: "Passport issued. Share this signed document with any third party to prove your identity offline.",
|
|
266
|
+
_verify: "Verify at: GET https://provenonce.io/.well-known/provenonce-authority.json for the authority public key."
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
async function handleBeatsProof(args) {
|
|
270
|
+
const count = Math.max(10, Math.min(1e3, args.count));
|
|
271
|
+
const creds = loadCredentials();
|
|
272
|
+
const seed = creds?.agent_hash ?? `provenonce:beats:${Date.now()}`;
|
|
273
|
+
const start = Date.now();
|
|
274
|
+
let hash = createHash("sha256").update(seed).digest("hex");
|
|
275
|
+
const fromHash = `0x${hash}`;
|
|
276
|
+
for (let i = 1; i < count; i++) {
|
|
277
|
+
hash = createHash("sha256").update(hash).digest("hex");
|
|
278
|
+
}
|
|
279
|
+
const toHash = `0x${hash}`;
|
|
280
|
+
const duration = Date.now() - start;
|
|
281
|
+
return ok({
|
|
282
|
+
from_hash: fromHash,
|
|
283
|
+
to_hash: toHash,
|
|
284
|
+
beats_computed: count,
|
|
285
|
+
duration_ms: duration,
|
|
286
|
+
message: `Computed ${count} beats in ${duration}ms. This is cryptographic proof of computational work.`
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
async function handleVerifyAgent(args) {
|
|
290
|
+
const { data, error } = await verifyAgent(args.hash);
|
|
291
|
+
if (error || !data) return err(error ?? "Verification failed");
|
|
292
|
+
return ok(data);
|
|
293
|
+
}
|
|
294
|
+
async function handleSpawn(args) {
|
|
295
|
+
const creds = requireCredentials();
|
|
296
|
+
const { data, error } = await spawnChild(creds.api_key, {
|
|
297
|
+
childName: args.child_name,
|
|
298
|
+
parentHash: creds.agent_hash
|
|
299
|
+
});
|
|
300
|
+
if (error || !data) return err(error ?? "Spawn failed");
|
|
301
|
+
return ok({
|
|
302
|
+
...data,
|
|
303
|
+
message: `Child agent spawned: ${data.child_hash}. Save the child_api_key \u2014 it will not be shown again.`,
|
|
304
|
+
_warning: "The child agent has its own identity. Configure it with PROVENONCE_API_KEY + PROVENONCE_AGENT_HASH."
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
async function handleGetLineage(args) {
|
|
308
|
+
const creds = loadCredentials();
|
|
309
|
+
const targetHash = args.hash ?? creds?.agent_hash;
|
|
310
|
+
if (!targetHash) {
|
|
311
|
+
return err("No hash provided and agent is not registered. Call provenonce_register first or provide a hash.");
|
|
312
|
+
}
|
|
313
|
+
const { data, error } = await getLineage(targetHash);
|
|
314
|
+
if (error || !data) return err(error ?? "Lineage retrieval failed");
|
|
315
|
+
return ok(data);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// src/index.ts
|
|
319
|
+
var server = new Server(
|
|
320
|
+
{ name: "provenonce", version: "1.0.0" },
|
|
321
|
+
{ capabilities: { tools: {} } }
|
|
322
|
+
);
|
|
323
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
324
|
+
tools: PROVENONCE_TOOLS.map((t) => ({
|
|
325
|
+
name: t.name,
|
|
326
|
+
description: t.description,
|
|
327
|
+
inputSchema: t.inputSchema
|
|
328
|
+
}))
|
|
329
|
+
}));
|
|
330
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
331
|
+
const { name, arguments: args = {} } = request.params;
|
|
332
|
+
const a = args;
|
|
333
|
+
switch (name) {
|
|
334
|
+
case "provenonce_register":
|
|
335
|
+
return handleRegister({
|
|
336
|
+
name: a.name,
|
|
337
|
+
skill_ref: a.skill_ref
|
|
338
|
+
});
|
|
339
|
+
case "provenonce_status":
|
|
340
|
+
return handleStatus();
|
|
341
|
+
case "provenonce_purchase_sigil":
|
|
342
|
+
return handlePurchaseSigil({
|
|
343
|
+
name: a.name,
|
|
344
|
+
principal: a.principal,
|
|
345
|
+
identity_class: a.identity_class,
|
|
346
|
+
payment_tx: a.payment_tx
|
|
347
|
+
});
|
|
348
|
+
case "provenonce_heartbeat":
|
|
349
|
+
return handleHeartbeat({ payment_tx: a.payment_tx });
|
|
350
|
+
case "provenonce_get_passport":
|
|
351
|
+
return handleGetPassport({ payment_tx: a.payment_tx });
|
|
352
|
+
case "provenonce_beats_proof":
|
|
353
|
+
return handleBeatsProof({ count: a.count });
|
|
354
|
+
case "provenonce_verify_agent":
|
|
355
|
+
return handleVerifyAgent({ hash: a.hash });
|
|
356
|
+
case "provenonce_spawn":
|
|
357
|
+
return handleSpawn({ child_name: a.child_name });
|
|
358
|
+
case "provenonce_get_lineage":
|
|
359
|
+
return handleGetLineage({ hash: a.hash });
|
|
360
|
+
default:
|
|
361
|
+
return {
|
|
362
|
+
content: [{ type: "text", text: `Unknown tool: ${name}` }],
|
|
363
|
+
isError: true
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
async function main() {
|
|
368
|
+
const transport = new StdioServerTransport();
|
|
369
|
+
await server.connect(transport);
|
|
370
|
+
}
|
|
371
|
+
main().catch((err2) => {
|
|
372
|
+
process.stderr.write(`Fatal: ${err2.message}
|
|
373
|
+
`);
|
|
374
|
+
process.exit(1);
|
|
375
|
+
});
|
|
376
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/handlers.ts","../src/credentials.ts","../src/client.ts"],"sourcesContent":["import { Server } from '@modelcontextprotocol/sdk/server/index.js';\r\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\r\nimport {\r\n CallToolRequestSchema,\r\n ListToolsRequestSchema,\r\n} from '@modelcontextprotocol/sdk/types.js';\r\n\r\nimport { PROVENONCE_TOOLS } from './tools.js';\r\nimport {\r\n handleRegister,\r\n handleStatus,\r\n handlePurchaseSigil,\r\n handleHeartbeat,\r\n handleGetPassport,\r\n handleBeatsProof,\r\n handleVerifyAgent,\r\n handleSpawn,\r\n handleGetLineage,\r\n} from './handlers.js';\r\n\r\nconst server = new Server(\r\n { name: 'provenonce', version: '1.0.0' },\r\n { capabilities: { tools: {} } },\r\n);\r\n\r\n// List available tools\r\nserver.setRequestHandler(ListToolsRequestSchema, async () => ({\r\n tools: PROVENONCE_TOOLS.map((t) => ({\r\n name: t.name,\r\n description: t.description,\r\n inputSchema: t.inputSchema,\r\n })),\r\n}));\r\n\r\n// Handle tool calls\r\nserver.setRequestHandler(CallToolRequestSchema, async (request) => {\r\n const { name, arguments: args = {} } = request.params;\r\n const a = args as Record<string, unknown>;\r\n\r\n switch (name) {\r\n case 'provenonce_register':\r\n return handleRegister({\r\n name: a.name as string | undefined,\r\n skill_ref: a.skill_ref as string | undefined,\r\n });\r\n\r\n case 'provenonce_status':\r\n return handleStatus();\r\n\r\n case 'provenonce_purchase_sigil':\r\n return handlePurchaseSigil({\r\n name: a.name as string,\r\n principal: a.principal as string,\r\n identity_class: a.identity_class as string,\r\n payment_tx: a.payment_tx as string,\r\n });\r\n\r\n case 'provenonce_heartbeat':\r\n return handleHeartbeat({ payment_tx: a.payment_tx as string });\r\n\r\n case 'provenonce_get_passport':\r\n return handleGetPassport({ payment_tx: a.payment_tx as string | undefined });\r\n\r\n case 'provenonce_beats_proof':\r\n return handleBeatsProof({ count: a.count as number });\r\n\r\n case 'provenonce_verify_agent':\r\n return handleVerifyAgent({ hash: a.hash as string });\r\n\r\n case 'provenonce_spawn':\r\n return handleSpawn({ child_name: a.child_name as string });\r\n\r\n case 'provenonce_get_lineage':\r\n return handleGetLineage({ hash: a.hash as string | undefined });\r\n\r\n default:\r\n return {\r\n content: [{ type: 'text', text: `Unknown tool: ${name}` }],\r\n isError: true,\r\n };\r\n }\r\n});\r\n\r\n// Start stdio transport\r\nasync function main() {\r\n const transport = new StdioServerTransport();\r\n await server.connect(transport);\r\n}\r\n\r\nmain().catch((err) => {\r\n process.stderr.write(`Fatal: ${(err as Error).message}\\n`);\r\n process.exit(1);\r\n});\r\n","import { createHash } from 'crypto';\r\nimport { loadCredentials, saveCredentials } from './credentials.js';\r\nimport * as api from './client.js';\r\n\r\nfunction requireCredentials() {\r\n const creds = loadCredentials();\r\n if (!creds) {\r\n throw new Error(\r\n 'Not registered. Call provenonce_register first.',\r\n );\r\n }\r\n return creds;\r\n}\r\n\r\nfunction ok(data: unknown): { content: [{ type: 'text'; text: string }] } {\r\n return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };\r\n}\r\n\r\nfunction err(message: string): { content: [{ type: 'text'; text: string }]; isError: true } {\r\n return { content: [{ type: 'text', text: `Error: ${message}` }], isError: true };\r\n}\r\n\r\n// ── provenonce_register ───────────────────────────────────────────────────────\r\n\r\nexport async function handleRegister(args: { name?: string; skill_ref?: string }) {\r\n // Return existing identity if already registered\r\n const existing = loadCredentials();\r\n if (existing) {\r\n const { data, error } = await api.getStatus(existing.api_key);\r\n if (data) {\r\n return ok({\r\n registered: false,\r\n message: 'Already registered — returning existing identity.',\r\n hash: existing.agent_hash,\r\n sigil: data.sigil,\r\n identity_class: data.identity_class,\r\n _hint: data._hint,\r\n });\r\n }\r\n if (error) {\r\n // Credentials stale or invalid — fall through to re-register\r\n }\r\n }\r\n\r\n const { data, error } = await api.registerAgent({\r\n name: args.name,\r\n skillRef: args.skill_ref,\r\n });\r\n\r\n if (error || !data) return err(error ?? 'Registration failed');\r\n\r\n saveCredentials({ api_key: data.api_key, agent_hash: data.hash });\r\n\r\n return ok({\r\n registered: true,\r\n hash: data.hash,\r\n api_key: data.api_key,\r\n depth: data.depth,\r\n message: 'Agent registered. Credentials saved. Call provenonce_status to see your full state.',\r\n _warning: 'Save your api_key securely. It will not be shown again after this session.',\r\n });\r\n}\r\n\r\n// ── provenonce_status ─────────────────────────────────────────────────────────\r\n\r\nexport async function handleStatus() {\r\n const creds = requireCredentials();\r\n const { data, error } = await api.getStatus(creds.api_key);\r\n if (error || !data) return err(error ?? 'Failed to get status');\r\n return ok(data);\r\n}\r\n\r\n// ── provenonce_purchase_sigil ─────────────────────────────────────────────────\r\n\r\nexport async function handlePurchaseSigil(args: {\r\n name: string;\r\n principal: string;\r\n identity_class: string;\r\n payment_tx: string;\r\n}) {\r\n const creds = requireCredentials();\r\n const skillRef = process.env.PROVENONCE_SKILL_REF;\r\n\r\n const { data, error } = await api.purchaseSigil(creds.api_key, {\r\n name: args.name,\r\n principal: args.principal,\r\n identity_class: args.identity_class,\r\n payment_tx: args.payment_tx,\r\n skillRef,\r\n });\r\n\r\n if (error || !data) return err(error ?? 'SIGIL purchase failed');\r\n\r\n return ok({\r\n ...data,\r\n heartbeat_unlocked: true,\r\n message: `SIGIL issued: ${data.sigil}. You can now call provenonce_heartbeat and provenonce_get_passport.`,\r\n });\r\n}\r\n\r\n// ── provenonce_heartbeat ──────────────────────────────────────────────────────\r\n\r\nexport async function handleHeartbeat(args: { payment_tx: string }) {\r\n const creds = requireCredentials();\r\n const { data, error } = await api.heartbeat(creds.api_key, args.payment_tx);\r\n if (error || !data) return err(error ?? 'Heartbeat failed');\r\n\r\n if (!data.ok && data.sigil_required) {\r\n return err('SIGIL required. Call provenonce_purchase_sigil first.');\r\n }\r\n\r\n return ok({\r\n ok: data.ok,\r\n message: data.ok ? 'Heartbeat recorded. Agent liveness confirmed.' : 'Heartbeat failed.',\r\n });\r\n}\r\n\r\n// ── provenonce_get_passport ───────────────────────────────────────────────────\r\n\r\nexport async function handleGetPassport(args: { payment_tx?: string }) {\r\n const creds = requireCredentials();\r\n const { data, error } = await api.getPassport(creds.api_key, args.payment_tx);\r\n if (error || !data) return err(error ?? 'Passport retrieval failed');\r\n\r\n return ok({\r\n passport: data.lineage_proof,\r\n message:\r\n 'Passport issued. Share this signed document with any third party to prove your identity offline.',\r\n _verify:\r\n 'Verify at: GET https://provenonce.io/.well-known/provenonce-authority.json for the authority public key.',\r\n });\r\n}\r\n\r\n// ── provenonce_beats_proof ────────────────────────────────────────────────────\r\n\r\nexport async function handleBeatsProof(args: { count: number }) {\r\n const count = Math.max(10, Math.min(1000, args.count));\r\n const creds = loadCredentials();\r\n const seed = creds?.agent_hash ?? `provenonce:beats:${Date.now()}`;\r\n\r\n const start = Date.now();\r\n let hash = createHash('sha256').update(seed).digest('hex');\r\n const fromHash = `0x${hash}`;\r\n\r\n for (let i = 1; i < count; i++) {\r\n hash = createHash('sha256').update(hash).digest('hex');\r\n }\r\n\r\n const toHash = `0x${hash}`;\r\n const duration = Date.now() - start;\r\n\r\n return ok({\r\n from_hash: fromHash,\r\n to_hash: toHash,\r\n beats_computed: count,\r\n duration_ms: duration,\r\n message: `Computed ${count} beats in ${duration}ms. This is cryptographic proof of computational work.`,\r\n });\r\n}\r\n\r\n// ── provenonce_verify_agent ───────────────────────────────────────────────────\r\n\r\nexport async function handleVerifyAgent(args: { hash: string }) {\r\n const { data, error } = await api.verifyAgent(args.hash);\r\n if (error || !data) return err(error ?? 'Verification failed');\r\n return ok(data);\r\n}\r\n\r\n// ── provenonce_spawn ──────────────────────────────────────────────────────────\r\n\r\nexport async function handleSpawn(args: { child_name: string }) {\r\n const creds = requireCredentials();\r\n\r\n const { data, error } = await api.spawnChild(creds.api_key, {\r\n childName: args.child_name,\r\n parentHash: creds.agent_hash,\r\n });\r\n\r\n if (error || !data) return err(error ?? 'Spawn failed');\r\n\r\n return ok({\r\n ...data,\r\n message: `Child agent spawned: ${data.child_hash}. Save the child_api_key — it will not be shown again.`,\r\n _warning: 'The child agent has its own identity. Configure it with PROVENONCE_API_KEY + PROVENONCE_AGENT_HASH.',\r\n });\r\n}\r\n\r\n// ── provenonce_get_lineage ────────────────────────────────────────────────────\r\n\r\nexport async function handleGetLineage(args: { hash?: string }) {\r\n const creds = loadCredentials();\r\n const targetHash = args.hash ?? creds?.agent_hash;\r\n\r\n if (!targetHash) {\r\n return err('No hash provided and agent is not registered. Call provenonce_register first or provide a hash.');\r\n }\r\n\r\n const { data, error } = await api.getLineage(targetHash);\r\n if (error || !data) return err(error ?? 'Lineage retrieval failed');\r\n return ok(data);\r\n}\r\n","import { readFileSync, writeFileSync, mkdirSync, chmodSync, existsSync } from 'fs';\r\nimport { join } from 'path';\r\nimport { homedir } from 'os';\r\nimport type { StoredCredentials } from './types.js';\r\n\r\nfunction getConfigDir(): string {\r\n return join(homedir(), '.provenonce');\r\n}\r\n\r\nfunction getConfigPath(): string {\r\n return join(getConfigDir(), 'config.json');\r\n}\r\n\r\n/** Load credentials — env vars take priority over config file */\r\nexport function loadCredentials(): StoredCredentials | null {\r\n const apiKey = process.env.PROVENONCE_API_KEY;\r\n const agentHash = process.env.PROVENONCE_AGENT_HASH;\r\n\r\n if (apiKey && agentHash) {\r\n return { api_key: apiKey, agent_hash: agentHash };\r\n }\r\n\r\n const configPath = getConfigPath();\r\n if (!existsSync(configPath)) return null;\r\n\r\n try {\r\n const raw = readFileSync(configPath, 'utf-8');\r\n const parsed = JSON.parse(raw) as Partial<StoredCredentials>;\r\n if (parsed.api_key && parsed.agent_hash) {\r\n return { api_key: parsed.api_key, agent_hash: parsed.agent_hash };\r\n }\r\n } catch {\r\n // Corrupt config — treat as missing\r\n }\r\n\r\n return null;\r\n}\r\n\r\n/** Persist credentials to ~/.provenonce/config.json (chmod 600) */\r\nexport function saveCredentials(creds: StoredCredentials): void {\r\n const dir = getConfigDir();\r\n if (!existsSync(dir)) {\r\n mkdirSync(dir, { recursive: true });\r\n }\r\n\r\n const configPath = getConfigPath();\r\n const data: StoredCredentials = {\r\n api_key: creds.api_key,\r\n agent_hash: creds.agent_hash,\r\n };\r\n\r\n writeFileSync(configPath, JSON.stringify(data, null, 2), 'utf-8');\r\n\r\n // chmod 600 — owner read/write only (Unix only; no-op on Windows)\r\n try {\r\n chmodSync(configPath, 0o600);\r\n } catch {\r\n // Windows — chmod not supported; recommend env var instead\r\n }\r\n}\r\n\r\n/** Clear stored credentials */\r\nexport function clearCredentials(): void {\r\n const configPath = getConfigPath();\r\n if (existsSync(configPath)) {\r\n writeFileSync(configPath, '{}', 'utf-8');\r\n }\r\n}\r\n","import type {\r\n RegisterResult,\r\n AgentStatus,\r\n HeartbeatResult,\r\n PassportResult,\r\n SigilResult,\r\n VerifyAgentResult,\r\n LineageResult,\r\n SpawnResult,\r\n} from './types.js';\r\n\r\nconst REGISTRY_URL = process.env.PROVENONCE_REGISTRY_URL || 'https://provenonce.io';\r\n\r\nasync function apiFetch<T>(\r\n path: string,\r\n opts: { method?: string; body?: unknown; apiKey?: string; isPublic?: boolean } = {},\r\n): Promise<{ data: T | null; error: string | null }> {\r\n const headers: Record<string, string> = { 'Content-Type': 'application/json' };\r\n if (opts.apiKey) headers['Authorization'] = `Bearer ${opts.apiKey}`;\r\n\r\n try {\r\n const res = await fetch(`${REGISTRY_URL}${path}`, {\r\n method: opts.method ?? 'GET',\r\n headers,\r\n body: opts.body ? JSON.stringify(opts.body) : undefined,\r\n });\r\n\r\n const json = await res.json() as Record<string, unknown>;\r\n\r\n if (!res.ok) {\r\n const msg = (json.error as string) ?? `HTTP ${res.status}`;\r\n return { data: null, error: msg };\r\n }\r\n\r\n return { data: json as T, error: null };\r\n } catch (err) {\r\n return { data: null, error: (err as Error).message };\r\n }\r\n}\r\n\r\n/** Register a new agent (no-wallet path) */\r\nexport async function registerAgent(opts: {\r\n name?: string;\r\n skillRef?: string;\r\n}): Promise<{ data: RegisterResult | null; error: string | null }> {\r\n return apiFetch<RegisterResult>('/api/v1/register', {\r\n method: 'POST',\r\n body: {\r\n name: opts.name,\r\n wallet: 'none',\r\n ...(opts.skillRef ? { ref: opts.skillRef } : {}),\r\n },\r\n });\r\n}\r\n\r\n/** Get full agent status */\r\nexport async function getStatus(apiKey: string): Promise<{ data: AgentStatus | null; error: string | null }> {\r\n return apiFetch<AgentStatus>('/api/v1/skill/bootstrap', {\r\n method: 'POST',\r\n apiKey,\r\n body: {},\r\n });\r\n}\r\n\r\n/** Submit heartbeat */\r\nexport async function heartbeat(apiKey: string, paymentTx?: string): Promise<{ data: HeartbeatResult | null; error: string | null }> {\r\n return apiFetch<HeartbeatResult>('/api/v1/agent/heartbeat', {\r\n method: 'POST',\r\n apiKey,\r\n body: { payment_tx: paymentTx },\r\n });\r\n}\r\n\r\n/** Reissue passport / lineage proof */\r\nexport async function getPassport(apiKey: string, paymentTx?: string): Promise<{ data: { lineage_proof: PassportResult } | null; error: string | null }> {\r\n return apiFetch<{ lineage_proof: PassportResult }>('/api/v1/agent/reissue-proof', {\r\n method: 'POST',\r\n apiKey,\r\n body: paymentTx ? { payment_tx: paymentTx } : {},\r\n });\r\n}\r\n\r\n/** Purchase a SIGIL */\r\nexport async function purchaseSigil(apiKey: string, opts: {\r\n name: string;\r\n principal: string;\r\n identity_class: string;\r\n payment_tx: string;\r\n skillRef?: string;\r\n}): Promise<{ data: SigilResult | null; error: string | null }> {\r\n return apiFetch<SigilResult>('/api/v1/sigil', {\r\n method: 'POST',\r\n apiKey,\r\n body: {\r\n name: opts.name,\r\n principal: opts.principal,\r\n identity_class: opts.identity_class,\r\n payment_tx: opts.payment_tx,\r\n ...(opts.skillRef ? { ref: opts.skillRef } : {}),\r\n },\r\n });\r\n}\r\n\r\n/** Verify another agent's identity (public) */\r\nexport async function verifyAgent(hash: string): Promise<{ data: VerifyAgentResult | null; error: string | null }> {\r\n return apiFetch<VerifyAgentResult>(`/api/v1/verify/${encodeURIComponent(hash)}`);\r\n}\r\n\r\n/** Get agent lineage chain (public) */\r\nexport async function getLineage(hash: string): Promise<{ data: LineageResult | null; error: string | null }> {\r\n return apiFetch<LineageResult>(`/api/v1/agent/lineage/${encodeURIComponent(hash)}`);\r\n}\r\n\r\n/** Spawn a child agent — handles full 3-step flow internally */\r\nexport async function spawnChild(apiKey: string, opts: {\r\n childName: string;\r\n parentHash: string;\r\n}): Promise<{ data: SpawnResult | null; error: string | null }> {\r\n // Step 1: Get spawn authorization\r\n const step1 = await apiFetch<{\r\n spawn_authorization: string;\r\n child_name?: string;\r\n }>('/api/v1/agent/spawn', {\r\n method: 'POST',\r\n apiKey,\r\n body: { child_name: opts.childName },\r\n });\r\n\r\n if (step1.error || !step1.data?.spawn_authorization) {\r\n return { data: null, error: step1.error ?? 'Spawn step 1 failed: no authorization returned' };\r\n }\r\n\r\n const spawnAuth = step1.data.spawn_authorization;\r\n\r\n // Step 2: Register the child with the spawn_authorization\r\n const reg = await apiFetch<RegisterResult>('/api/v1/register', {\r\n method: 'POST',\r\n apiKey,\r\n body: {\r\n name: opts.childName,\r\n wallet: 'none',\r\n spawn_authorization: spawnAuth,\r\n },\r\n });\r\n\r\n if (reg.error || !reg.data?.hash) {\r\n return { data: null, error: reg.error ?? 'Spawn step 2 (child registration) failed' };\r\n }\r\n\r\n const childHash = reg.data.hash;\r\n const childApiKey = reg.data.api_key;\r\n\r\n // Step 3: Finalize the spawn\r\n const step3 = await apiFetch<{ ok: boolean }>('/api/v1/agent/spawn', {\r\n method: 'POST',\r\n apiKey,\r\n body: { child_hash: childHash },\r\n });\r\n\r\n if (step3.error) {\r\n return { data: null, error: step3.error };\r\n }\r\n\r\n return {\r\n data: {\r\n child_hash: childHash,\r\n child_api_key: childApiKey,\r\n child_depth: reg.data.depth,\r\n parent_hash: opts.parentHash,\r\n },\r\n error: null,\r\n };\r\n}\r\n"],"mappings":";;;;;;AAAA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACE;AAAA,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,WAAW,EAAE;AAAA,QACb,gBAAgB,EAAE;AAAA,QAClB,YAAY,EAAE;AAAA,MAChB,CAAC;AAAA,IAEH,KAAK;AACH,aAAO,gBAAgB,EAAE,YAAY,EAAE,WAAqB,CAAC;AAAA,IAE/D,KAAK;AACH,aAAO,kBAAkB,EAAE,YAAY,EAAE,WAAiC,CAAC;AAAA,IAE7E,KAAK;AACH,aAAO,iBAAiB,EAAE,OAAO,EAAE,MAAgB,CAAC;AAAA,IAEtD,KAAK;AACH,aAAO,kBAAkB,EAAE,MAAM,EAAE,KAAe,CAAC;AAAA,IAErD,KAAK;AACH,aAAO,YAAY,EAAE,YAAY,EAAE,WAAqB,CAAC;AAAA,IAE3D,KAAK;AACH,aAAO,iBAAiB,EAAE,MAAM,EAAE,KAA2B,CAAC;AAAA,IAEhE;AACE,aAAO;AAAA,QACL,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,iBAAiB,IAAI,GAAG,CAAC;AAAA,QACzD,SAAS;AAAA,MACX;AAAA,EACJ;AACF,CAAC;AAGD,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,MAAM,CAACC,SAAQ;AACpB,UAAQ,OAAO,MAAM,UAAWA,KAAc,OAAO;AAAA,CAAI;AACzD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["err","data","error","err"]}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/** Provenonce Skill — 9 MCP tool definitions (JSON Schema) */
|
|
2
|
+
declare const PROVENONCE_TOOLS: readonly [{
|
|
3
|
+
readonly name: "provenonce_register";
|
|
4
|
+
readonly description: string;
|
|
5
|
+
readonly inputSchema: {
|
|
6
|
+
readonly type: "object";
|
|
7
|
+
readonly properties: {
|
|
8
|
+
readonly name: {
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
readonly description: "Human-readable name for this agent (optional, max 64 chars)";
|
|
11
|
+
readonly maxLength: 64;
|
|
12
|
+
};
|
|
13
|
+
readonly skill_ref: {
|
|
14
|
+
readonly type: "string";
|
|
15
|
+
readonly description: "16-character hex ref token of the skill that deployed you — for rev-share attribution (optional)";
|
|
16
|
+
readonly pattern: "^[0-9a-f]{16}$";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "provenonce_status";
|
|
22
|
+
readonly description: string;
|
|
23
|
+
readonly inputSchema: {
|
|
24
|
+
readonly type: "object";
|
|
25
|
+
readonly properties: {};
|
|
26
|
+
};
|
|
27
|
+
}, {
|
|
28
|
+
readonly name: "provenonce_purchase_sigil";
|
|
29
|
+
readonly description: string;
|
|
30
|
+
readonly inputSchema: {
|
|
31
|
+
readonly type: "object";
|
|
32
|
+
readonly properties: {
|
|
33
|
+
readonly name: {
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly description: "SIGIL name segment — identifies this specific agent (e.g. \"my-agent\")";
|
|
36
|
+
};
|
|
37
|
+
readonly principal: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly description: "Principal segment — identifies the operator or organisation (e.g. \"acme\")";
|
|
40
|
+
};
|
|
41
|
+
readonly identity_class: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly enum: readonly ["ind", "org", "sov", "eph", "sbx"];
|
|
44
|
+
readonly description: "Identity class: ind=individual, org=organisation, sov=sovereign, eph=ephemeral, sbx=sandbox";
|
|
45
|
+
};
|
|
46
|
+
readonly payment_tx: {
|
|
47
|
+
readonly type: "string";
|
|
48
|
+
readonly description: "Solana transaction signature for the SIGIL fee payment";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
readonly required: readonly ["name", "principal", "identity_class", "payment_tx"];
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "provenonce_heartbeat";
|
|
55
|
+
readonly description: string;
|
|
56
|
+
readonly inputSchema: {
|
|
57
|
+
readonly type: "object";
|
|
58
|
+
readonly properties: {
|
|
59
|
+
readonly payment_tx: {
|
|
60
|
+
readonly type: "string";
|
|
61
|
+
readonly description: "Solana transaction signature for the heartbeat fee payment";
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
readonly required: readonly ["payment_tx"];
|
|
65
|
+
};
|
|
66
|
+
}, {
|
|
67
|
+
readonly name: "provenonce_get_passport";
|
|
68
|
+
readonly description: string;
|
|
69
|
+
readonly inputSchema: {
|
|
70
|
+
readonly type: "object";
|
|
71
|
+
readonly properties: {
|
|
72
|
+
readonly payment_tx: {
|
|
73
|
+
readonly type: "string";
|
|
74
|
+
readonly description: "Solana transaction signature for the passport reissue fee (if applicable)";
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
readonly name: "provenonce_beats_proof";
|
|
80
|
+
readonly description: string;
|
|
81
|
+
readonly inputSchema: {
|
|
82
|
+
readonly type: "object";
|
|
83
|
+
readonly properties: {
|
|
84
|
+
readonly count: {
|
|
85
|
+
readonly type: "integer";
|
|
86
|
+
readonly description: "Number of beats to compute (min 10, max 1000)";
|
|
87
|
+
readonly minimum: 10;
|
|
88
|
+
readonly maximum: 1000;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly required: readonly ["count"];
|
|
92
|
+
};
|
|
93
|
+
}, {
|
|
94
|
+
readonly name: "provenonce_verify_agent";
|
|
95
|
+
readonly description: string;
|
|
96
|
+
readonly inputSchema: {
|
|
97
|
+
readonly type: "object";
|
|
98
|
+
readonly properties: {
|
|
99
|
+
readonly hash: {
|
|
100
|
+
readonly type: "string";
|
|
101
|
+
readonly description: "The agent hash to verify (0x + 64 hex chars)";
|
|
102
|
+
readonly pattern: "^0x[0-9a-fA-F]{64}$";
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
readonly required: readonly ["hash"];
|
|
106
|
+
};
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "provenonce_spawn";
|
|
109
|
+
readonly description: string;
|
|
110
|
+
readonly inputSchema: {
|
|
111
|
+
readonly type: "object";
|
|
112
|
+
readonly properties: {
|
|
113
|
+
readonly child_name: {
|
|
114
|
+
readonly type: "string";
|
|
115
|
+
readonly description: "Name for the child agent (max 64 chars)";
|
|
116
|
+
readonly maxLength: 64;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
readonly required: readonly ["child_name"];
|
|
120
|
+
};
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "provenonce_get_lineage";
|
|
123
|
+
readonly description: string;
|
|
124
|
+
readonly inputSchema: {
|
|
125
|
+
readonly type: "object";
|
|
126
|
+
readonly properties: {
|
|
127
|
+
readonly hash: {
|
|
128
|
+
readonly type: "string";
|
|
129
|
+
readonly description: "The agent hash to get lineage for (0x + 64 hex chars). Defaults to this agent if omitted.";
|
|
130
|
+
readonly pattern: "^0x[0-9a-fA-F]{64}$";
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
}];
|
|
135
|
+
type ToolName = (typeof PROVENONCE_TOOLS)[number]['name'];
|
|
136
|
+
|
|
137
|
+
export { PROVENONCE_TOOLS, type ToolName };
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@provenonce/mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Provenonce Skill — MCP server giving any AI agent cryptographic identity, SIGIL, heartbeat, passport, and beats proofs.",
|
|
5
|
+
"keywords": ["provenonce", "mcp", "ai-agent", "identity", "provenance", "sigil"],
|
|
6
|
+
"homepage": "https://provenonce.io",
|
|
7
|
+
"repository": "github:jarekpiot/provenonce",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"bin": {
|
|
12
|
+
"provenonce-mcp": "bin/mcp.js"
|
|
13
|
+
},
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"types": "./dist/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./tools": {
|
|
20
|
+
"import": "./dist/tools.js",
|
|
21
|
+
"types": "./dist/tools.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"bin",
|
|
27
|
+
"README.md"
|
|
28
|
+
],
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"dev": "tsup --watch",
|
|
32
|
+
"prepublishOnly": "npm run build"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@modelcontextprotocol/sdk": "^1.5.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"typescript": "^5.4.0",
|
|
39
|
+
"tsup": "^8.3.0"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18"
|
|
43
|
+
}
|
|
44
|
+
}
|