@veyanet/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/CHANGELOG.md +28 -0
- package/LICENSE +21 -0
- package/README.md +502 -0
- package/SECURITY.md +72 -0
- package/assets/logo.png +0 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +441 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +444 -0
- package/dist/index.js.map +1 -0
- package/docs/ARCHITECTURE.md +77 -0
- package/docs/AUTHENTICATION.md +76 -0
- package/docs/CONFIGURATION.md +88 -0
- package/docs/DEPLOYMENT.md +119 -0
- package/docs/NETWORK_PIN.md +51 -0
- package/docs/QUICKSTART.md +111 -0
- package/docs/README.md +54 -0
- package/docs/SDK_BRIDGE.md +67 -0
- package/docs/TOOLS.md +148 -0
- package/docs/TRANSPORT.md +91 -0
- package/docs/VERIFICATION.md +81 -0
- package/package.json +69 -0
- package/src/auth.ts +24 -0
- package/src/cli.ts +6 -0
- package/src/config.test.ts +44 -0
- package/src/config.ts +49 -0
- package/src/http.ts +143 -0
- package/src/index.ts +9 -0
- package/src/sdk.ts +36 -0
- package/src/server.ts +23 -0
- package/src/tools/public.ts +113 -0
- package/src/tools/write.ts +120 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Configuration Reference — VEYA MCP
|
|
2
|
+
|
|
3
|
+
How `@veyanet/mcp` resolves runtime configuration. Source of truth: `src/config.ts`.
|
|
4
|
+
|
|
5
|
+
## Resolution order
|
|
6
|
+
|
|
7
|
+
1. Process environment variables (including values loaded from `.env` by your process manager)
|
|
8
|
+
2. Hard-coded Robinhood **testnet** defaults in `loadConfig()`
|
|
9
|
+
|
|
10
|
+
There is no separate config file format. Operators use `.env` on the host; the repository only ships `.env.example`.
|
|
11
|
+
|
|
12
|
+
## Variable catalog
|
|
13
|
+
|
|
14
|
+
### Process bind
|
|
15
|
+
|
|
16
|
+
| Variable | Type | Default | Notes |
|
|
17
|
+
|----------|------|---------|-------|
|
|
18
|
+
| `PORT` | number | `8788` | nginx should proxy here |
|
|
19
|
+
| `HOST` | string | `0.0.0.0` | use `127.0.0.1` only if nginx is local and you want bind lockdown |
|
|
20
|
+
| `PUBLIC_MCP_URL` | URL | `https://mcp.veyanet.tech/mcp` | Trailing slash stripped; shown on landing + health |
|
|
21
|
+
| `NODE_ENV` | string | `development` | use `production` on the public host |
|
|
22
|
+
|
|
23
|
+
### Settlement pins
|
|
24
|
+
|
|
25
|
+
| Variable | Type | Default |
|
|
26
|
+
|----------|------|---------|
|
|
27
|
+
| `ROBINHOOD_NETWORK` | string | documented in `.env.example` as `testnet` (informational) |
|
|
28
|
+
| `ROBINHOOD_CHAIN_ID` | number | `46630` |
|
|
29
|
+
| `ROBINHOOD_RPC_URL` | URL | `https://rpc.testnet.chain.robinhood.com` |
|
|
30
|
+
| `ROBINHOOD_EXPLORER_URL` | URL | `https://explorer.testnet.chain.robinhood.com` |
|
|
31
|
+
| `VEYA_CONTRACT_ADDRESS` | address | `0x1a1Dc3c55550FCE9F70ef6cDEeF967c0b72a5d84` |
|
|
32
|
+
|
|
33
|
+
### Product API
|
|
34
|
+
|
|
35
|
+
| Variable | Type | Default |
|
|
36
|
+
|----------|------|---------|
|
|
37
|
+
| `VEYA_API_URL` | URL | `https://api.veyanet.tech` |
|
|
38
|
+
|
|
39
|
+
Used only by `veya_api_health` (trailing slash stripped).
|
|
40
|
+
|
|
41
|
+
### Write gate
|
|
42
|
+
|
|
43
|
+
| Variable | Type | Default |
|
|
44
|
+
|----------|------|---------|
|
|
45
|
+
| `MCP_API_KEY` | string | empty → writes disabled |
|
|
46
|
+
| `VEYA_RELAYER_PRIVATE_KEY` | `0x` hex key | empty → writes disabled |
|
|
47
|
+
| `VEYA_DEPLOYER_PRIVATE_KEY` | `0x` hex key | fallback if relayer unset |
|
|
48
|
+
|
|
49
|
+
`writesEnabled` is true only when **both** an API key and a payer key resolve.
|
|
50
|
+
|
|
51
|
+
### CORS
|
|
52
|
+
|
|
53
|
+
| Variable | Type | Default |
|
|
54
|
+
|----------|------|---------|
|
|
55
|
+
| `CORS_ORIGIN` | comma-separated origins | empty |
|
|
56
|
+
|
|
57
|
+
Empty allowlist: credentialed browser Origins are rejected. Requests with no `Origin` (typical MCP connectors) still work.
|
|
58
|
+
|
|
59
|
+
## Derived helpers
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { loadConfig, writesEnabled, MCP_SERVICE_NAME, MCP_SERVICE_VERSION } from "@veyanet/mcp";
|
|
63
|
+
|
|
64
|
+
const cfg = loadConfig();
|
|
65
|
+
writesEnabled(cfg); // boolean
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Local `.env` hygiene
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cp .env.example .env
|
|
72
|
+
chmod 600 .env
|
|
73
|
+
# never git add .env
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`.gitignore` already excludes `.env`.
|
|
77
|
+
|
|
78
|
+
## Misconfiguration patterns
|
|
79
|
+
|
|
80
|
+
| Mistake | Symptom |
|
|
81
|
+
|---------|---------|
|
|
82
|
+
| Wrong chain id alone | Writes fail `CHAIN_MISMATCH`; reads may look “fine” on wrong network data |
|
|
83
|
+
| `PUBLIC_MCP_URL` still localhost in prod | Landing/health advertise wrong paste URL |
|
|
84
|
+
| Write key set without `MCP_API_KEY` | Writes stay disabled |
|
|
85
|
+
| `MCP_API_KEY` set without relayer | Writes stay disabled |
|
|
86
|
+
| Forgetting nginx `Authorization` forward | Bearer never reaches Node; writes always unauthorized |
|
|
87
|
+
|
|
88
|
+
See also [NETWORK_PIN.md](./NETWORK_PIN.md) and [AUTHENTICATION.md](./AUTHENTICATION.md).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Deployment Guide — VEYA MCP
|
|
2
|
+
|
|
3
|
+
Production target: **`https://mcp.veyanet.tech/mcp`**
|
|
4
|
+
Package: `@veyanet/mcp` in monorepo directory `robinhood/hosted-mcp/`
|
|
5
|
+
Stdio sibling (not this service): `veya-anchor/packages/mcp/`
|
|
6
|
+
|
|
7
|
+
## Architecture on the host
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
Internet → TLS (mcp.veyanet.tech) → nginx → 127.0.0.1:8788 → node dist/cli.js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Build on the server
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
cd /opt/veya/sdk # or your checkout path for robinhood/sdk
|
|
17
|
+
npm install && npm run build
|
|
18
|
+
|
|
19
|
+
cd /opt/veya/mcp # checkout of robinhood/hosted-mcp
|
|
20
|
+
npm install && npm run build
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Copy `.env.example` → `.env` and edit secrets **on the server only**.
|
|
24
|
+
|
|
25
|
+
## Required production env
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
NODE_ENV=production
|
|
29
|
+
HOST=0.0.0.0
|
|
30
|
+
PORT=8788
|
|
31
|
+
PUBLIC_MCP_URL=https://mcp.veyanet.tech/mcp
|
|
32
|
+
ROBINHOOD_CHAIN_ID=46630
|
|
33
|
+
ROBINHOOD_RPC_URL=https://rpc.testnet.chain.robinhood.com
|
|
34
|
+
ROBINHOOD_EXPLORER_URL=https://explorer.testnet.chain.robinhood.com
|
|
35
|
+
VEYA_CONTRACT_ADDRESS=0x1a1Dc3c55550FCE9F70ef6cDEeF967c0b72a5d84
|
|
36
|
+
VEYA_API_URL=https://api.veyanet.tech
|
|
37
|
+
CORS_ORIGIN=https://veyanet.tech,https://www.veyanet.tech,https://app.veyanet.tech
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Optional writes:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
MCP_API_KEY=<long-random-secret>
|
|
44
|
+
VEYA_RELAYER_PRIVATE_KEY=0x...
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Leave write vars empty for a public read-only MCP (recommended default until you need agent writes).
|
|
48
|
+
|
|
49
|
+
## nginx
|
|
50
|
+
|
|
51
|
+
```nginx
|
|
52
|
+
server {
|
|
53
|
+
listen 443 ssl http2;
|
|
54
|
+
server_name mcp.veyanet.tech;
|
|
55
|
+
ssl_certificate /etc/letsencrypt/live/mcp.veyanet.tech/fullchain.pem;
|
|
56
|
+
ssl_certificate_key /etc/letsencrypt/live/mcp.veyanet.tech/privkey.pem;
|
|
57
|
+
|
|
58
|
+
location / {
|
|
59
|
+
proxy_pass http://127.0.0.1:8788;
|
|
60
|
+
proxy_http_version 1.1;
|
|
61
|
+
proxy_set_header Host $host;
|
|
62
|
+
proxy_set_header X-Forwarded-Proto $scheme;
|
|
63
|
+
proxy_set_header Authorization $http_authorization;
|
|
64
|
+
proxy_buffering off;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Critical:** forward `Authorization` so Bearer write auth reaches Node. Disable response buffering for Streamable HTTP.
|
|
70
|
+
|
|
71
|
+
## systemd unit (example)
|
|
72
|
+
|
|
73
|
+
```ini
|
|
74
|
+
[Unit]
|
|
75
|
+
Description=VEYA MCP
|
|
76
|
+
After=network.target
|
|
77
|
+
|
|
78
|
+
[Service]
|
|
79
|
+
Type=simple
|
|
80
|
+
WorkingDirectory=/opt/veya/mcp
|
|
81
|
+
ExecStart=/usr/bin/node dist/cli.js
|
|
82
|
+
EnvironmentFile=/opt/veya/mcp/.env
|
|
83
|
+
Restart=always
|
|
84
|
+
RestartSec=3
|
|
85
|
+
User=veya
|
|
86
|
+
Group=veya
|
|
87
|
+
|
|
88
|
+
[Install]
|
|
89
|
+
WantedBy=multi-user.target
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
sudo systemctl daemon-reload
|
|
94
|
+
sudo systemctl enable --now veya-mcp
|
|
95
|
+
sudo systemctl status veya-mcp
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Post-deploy checklist
|
|
99
|
+
|
|
100
|
+
- [ ] `curl -s https://mcp.veyanet.tech/health` → `status: ok`, `chainId: 46630`
|
|
101
|
+
- [ ] Landing `/` shows paste URL `https://mcp.veyanet.tech/mcp`
|
|
102
|
+
- [ ] Claude / Cursor can connect and call `veya_describe`
|
|
103
|
+
- [ ] `veya_ping_chain` returns 46630
|
|
104
|
+
- [ ] `veya_verify_transaction` works on a known tx
|
|
105
|
+
- [ ] If writes disabled: `/health` has `writesEnabled: false`
|
|
106
|
+
- [ ] If writes enabled: Bearer required; wrong Bearer fails
|
|
107
|
+
- [ ] `.env` not in git; file mode restricted (`chmod 600`)
|
|
108
|
+
|
|
109
|
+
## Rollback
|
|
110
|
+
|
|
111
|
+
1. `systemctl stop veya-mcp`
|
|
112
|
+
2. Redeploy previous `dist/` + `.env`
|
|
113
|
+
3. `systemctl start veya-mcp`
|
|
114
|
+
4. Re-run health + `veya_ping_chain`
|
|
115
|
+
|
|
116
|
+
## Companion docs
|
|
117
|
+
|
|
118
|
+
* Tree: `robinhood/docs/phase2/MCP.md`
|
|
119
|
+
* Ship board: `robinhood/docs/phase2/SHIP.md` §3b
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Network Specifications — VEYA MCP
|
|
2
|
+
|
|
3
|
+
Pinned settlement constants for `@veyanet/mcp`. These match `@veyanet/sdk` defaults so MCP tools and library callers speak the same chain.
|
|
4
|
+
|
|
5
|
+
## Robinhood Chain testnet
|
|
6
|
+
|
|
7
|
+
| Constant | Value |
|
|
8
|
+
|----------|-------|
|
|
9
|
+
| Network name | Robinhood Chain Testnet |
|
|
10
|
+
| Chain ID (decimal) | `46630` |
|
|
11
|
+
| Chain ID (hex) | `0xb636` |
|
|
12
|
+
| JSON-RPC | `https://rpc.testnet.chain.robinhood.com` |
|
|
13
|
+
| Explorer | `https://explorer.testnet.chain.robinhood.com` |
|
|
14
|
+
| Protocol contract | `Veya.sol` |
|
|
15
|
+
| Contract address | `0x1a1Dc3c55550FCE9F70ef6cDEeF967c0b72a5d84` |
|
|
16
|
+
|
|
17
|
+
## Public VEYA endpoints
|
|
18
|
+
|
|
19
|
+
| Service | URL |
|
|
20
|
+
|---------|-----|
|
|
21
|
+
| MCP (Streamable HTTP) | `https://mcp.veyanet.tech/mcp` |
|
|
22
|
+
| MCP landing | `https://mcp.veyanet.tech/` |
|
|
23
|
+
| MCP health | `https://mcp.veyanet.tech/health` |
|
|
24
|
+
| Product API | `https://api.veyanet.tech` |
|
|
25
|
+
| Product API health | `https://api.veyanet.tech/health` |
|
|
26
|
+
| Marketing site | `https://veyanet.tech` |
|
|
27
|
+
|
|
28
|
+
## What is not pinned here
|
|
29
|
+
|
|
30
|
+
| Claim | Status |
|
|
31
|
+
|-------|--------|
|
|
32
|
+
| Mainnet chain id / contract | **Not** a VEYA settlement claim until Phase 3 |
|
|
33
|
+
| ERC-20 / token address | **Never** — `Veya.sol` is not a token |
|
|
34
|
+
| Live FHE / TFHE | **Not** — sealed path is AES-256-GCM; TFHE is a later phase |
|
|
35
|
+
| Loopback validators `7701–7703` | Local ops only; not required for public MCP read tools |
|
|
36
|
+
| Sealed-node `7800` | Local / fleet ops; not this MCP’s default execution surface |
|
|
37
|
+
|
|
38
|
+
## Changing pins
|
|
39
|
+
|
|
40
|
+
If you change `ROBINHOOD_CHAIN_ID`, you must also change RPC, explorer, and `VEYA_CONTRACT_ADDRESS` together. SDK write paths call `ensureRobinhoodChain()` and will reject a mismatched `eth_chainId`. Do not advertise a custom pin as “VEYA production” unless the protocol deploy and docs agree.
|
|
41
|
+
|
|
42
|
+
## Explorer checks
|
|
43
|
+
|
|
44
|
+
* Contract: `{explorer}/address/{VEYA_CONTRACT_ADDRESS}`
|
|
45
|
+
* Transaction: `{explorer}/tx/{txHash}`
|
|
46
|
+
|
|
47
|
+
Example commitment transaction used in smoke / docs:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
0xd68ab19671f0a3be63651cb6d6e24f5decf591da981708502827bca3689d31d8
|
|
51
|
+
```
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Quickstart Guide — VEYA MCP
|
|
2
|
+
|
|
3
|
+
This guide takes a stranger from zero to a verified chain ping, then a developer from clone to smoke green. It mirrors the “first success” role of the SDK quickstart, but for Streamable HTTP MCP.
|
|
4
|
+
|
|
5
|
+
## Part 1 — Stranger (no code, no keys)
|
|
6
|
+
|
|
7
|
+
### Step 1 — Add the MCP URL
|
|
8
|
+
|
|
9
|
+
In Claude or Cursor, add a custom MCP connector with **Streamable HTTP** transport:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
https://mcp.veyanet.tech/mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Step 2 — Honesty card
|
|
16
|
+
|
|
17
|
+
Ask the agent:
|
|
18
|
+
|
|
19
|
+
> Call `veya_describe` and summarize settlement and sealed claims.
|
|
20
|
+
|
|
21
|
+
You should see:
|
|
22
|
+
* `@veyanet/mcp`
|
|
23
|
+
* chain id **46630**
|
|
24
|
+
* `Veya.sol` address
|
|
25
|
+
* sealed = **AES-256-GCM** (not FHE)
|
|
26
|
+
* mainnet deferred
|
|
27
|
+
|
|
28
|
+
### Step 3 — Live chain ping
|
|
29
|
+
|
|
30
|
+
> Call `veya_ping_chain`.
|
|
31
|
+
|
|
32
|
+
Confirm `expectedChainId` / chain id is **46630** and a recent block number appears.
|
|
33
|
+
|
|
34
|
+
### Step 4 — Verify a transaction
|
|
35
|
+
|
|
36
|
+
> Call `veya_verify_transaction` with tx
|
|
37
|
+
> `0xd68ab19671f0a3be63651cb6d6e24f5decf591da981708502827bca3689d31d8`
|
|
38
|
+
|
|
39
|
+
Expect a parsed Veya event (e.g. `CommitmentStored`) and digest hex. Cross-check the hash on the Robinhood testnet explorer.
|
|
40
|
+
|
|
41
|
+
### Step 5 — Optional API health
|
|
42
|
+
|
|
43
|
+
> Call `veya_api_health`.
|
|
44
|
+
|
|
45
|
+
The product API may return `degraded` if validators/sealed are down. That is honest status from `api.veyanet.tech`, not a requirement that MCP itself is broken.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Part 2 — Developer (local)
|
|
50
|
+
|
|
51
|
+
### Prerequisites
|
|
52
|
+
* Node.js ≥ 20
|
|
53
|
+
* Network access to Robinhood testnet RPC
|
|
54
|
+
|
|
55
|
+
### Install and run
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cd robinhood/sdk
|
|
59
|
+
npm install
|
|
60
|
+
npm run build
|
|
61
|
+
|
|
62
|
+
cd ../hosted-mcp
|
|
63
|
+
npm install
|
|
64
|
+
npm run build
|
|
65
|
+
cp .env.example .env
|
|
66
|
+
npm start
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Local paste URL:
|
|
70
|
+
|
|
71
|
+
```text
|
|
72
|
+
http://127.0.0.1:8788/mcp
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
claude mcp add veya-local --transport http http://127.0.0.1:8788/mcp
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Verify locally
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm run lint
|
|
83
|
+
npm test
|
|
84
|
+
npm run smoke
|
|
85
|
+
curl -s http://127.0.0.1:8788/health
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Smoke must print `PASS` after `veya_describe` and `veya_ping_chain`.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Part 3 — Operator writes (optional)
|
|
93
|
+
|
|
94
|
+
Only if you intend authenticated on-chain tools on testnet:
|
|
95
|
+
|
|
96
|
+
1. Generate a long random `MCP_API_KEY`.
|
|
97
|
+
2. Fund a Robinhood **testnet** key; set `VEYA_RELAYER_PRIVATE_KEY`.
|
|
98
|
+
3. Restart; `/health` must show `"writesEnabled": true`.
|
|
99
|
+
4. Call write tools only with `Authorization: Bearer <MCP_API_KEY>`.
|
|
100
|
+
5. Confirm returned `txHash` on the explorer.
|
|
101
|
+
|
|
102
|
+
Do not enable writes on a public server without rate limits, key rotation, and a dedicated relayer wallet.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Next reading
|
|
107
|
+
|
|
108
|
+
* [TOOLS.md](./TOOLS.md) — full argument lists
|
|
109
|
+
* [VERIFICATION.md](./VERIFICATION.md) — audit-grade verify path
|
|
110
|
+
* [DEPLOYMENT.md](./DEPLOYMENT.md) — `mcp.veyanet.tech` TLS
|
|
111
|
+
* [AUTHENTICATION.md](./AUTHENTICATION.md) — Bearer model
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# VEYA MCP — Documentation Hub
|
|
2
|
+
|
|
3
|
+
This directory is the documentation set for `@veyanet/mcp`, the Streamable HTTP Model Context Protocol server for VEYA on Robinhood Chain. The root [README.md](../README.md) is the publish-facing entry (same role as `@veyanet/sdk`’s README). Use the table below for depth.
|
|
4
|
+
|
|
5
|
+
## Reading paths
|
|
6
|
+
|
|
7
|
+
### Stranger / agent client
|
|
8
|
+
1. [QUICKSTART.md](./QUICKSTART.md) — paste `https://mcp.veyanet.tech/mcp`
|
|
9
|
+
2. [TOOLS.md](./TOOLS.md) — what each `veya_*` tool does
|
|
10
|
+
3. [NETWORK_PIN.md](./NETWORK_PIN.md) — chain id, contract, explorer
|
|
11
|
+
4. [VERIFICATION.md](./VERIFICATION.md) — prove a commitment without trusting UI screenshots
|
|
12
|
+
|
|
13
|
+
### Operator / deployer
|
|
14
|
+
1. [DEPLOYMENT.md](./DEPLOYMENT.md) — TLS, nginx, systemd, env
|
|
15
|
+
2. [CONFIGURATION.md](./CONFIGURATION.md) — every environment variable
|
|
16
|
+
3. [AUTHENTICATION.md](./AUTHENTICATION.md) — Bearer write gate
|
|
17
|
+
4. [TRANSPORT.md](./TRANSPORT.md) — Streamable HTTP details
|
|
18
|
+
|
|
19
|
+
### Integrator / security reviewer
|
|
20
|
+
1. [ARCHITECTURE.md](./ARCHITECTURE.md) — trust boundaries
|
|
21
|
+
2. [SDK_BRIDGE.md](./SDK_BRIDGE.md) — what MCP calls in `@veyanet/sdk`
|
|
22
|
+
3. [../SECURITY.md](../SECURITY.md) — disclosure
|
|
23
|
+
|
|
24
|
+
## Package identity
|
|
25
|
+
|
|
26
|
+
| Item | Value |
|
|
27
|
+
|------|-------|
|
|
28
|
+
| npm / service name | `@veyanet/mcp` |
|
|
29
|
+
| Monorepo directory | `robinhood/hosted-mcp/` |
|
|
30
|
+
| Public URL | `https://mcp.veyanet.tech/mcp` |
|
|
31
|
+
| Sibling SDK | `robinhood/sdk` (`@veyanet/sdk`) |
|
|
32
|
+
| Stdio MCP (operators) | `veya-anchor/packages/mcp/` |
|
|
33
|
+
|
|
34
|
+
## Honesty (always)
|
|
35
|
+
|
|
36
|
+
* Settlement today: Robinhood Chain **testnet** chain id **46630**
|
|
37
|
+
* Protocol contract: `Veya.sol` (not an ERC-20)
|
|
38
|
+
* Sealed execution elsewhere: **AES-256-GCM** (not FHE; not SGX/Nitro product path)
|
|
39
|
+
* Mainnet: Phase 3 — not a current VEYA settlement claim
|
|
40
|
+
|
|
41
|
+
## Catalog
|
|
42
|
+
|
|
43
|
+
| Document | Description |
|
|
44
|
+
|----------|-------------|
|
|
45
|
+
| [NETWORK_PIN.md](./NETWORK_PIN.md) | Network constants and pins |
|
|
46
|
+
| [QUICKSTART.md](./QUICKSTART.md) | First connect and first tools |
|
|
47
|
+
| [ARCHITECTURE.md](./ARCHITECTURE.md) | Trust model and component map |
|
|
48
|
+
| [TOOLS.md](./TOOLS.md) | Full tool reference |
|
|
49
|
+
| [VERIFICATION.md](./VERIFICATION.md) | Audit / stranger verify flow |
|
|
50
|
+
| [DEPLOYMENT.md](./DEPLOYMENT.md) | Production deploy for `mcp.veyanet.tech` |
|
|
51
|
+
| [CONFIGURATION.md](./CONFIGURATION.md) | Environment variable reference |
|
|
52
|
+
| [TRANSPORT.md](./TRANSPORT.md) | HTTP / MCP transport |
|
|
53
|
+
| [AUTHENTICATION.md](./AUTHENTICATION.md) | Write auth and key custody |
|
|
54
|
+
| [SDK_BRIDGE.md](./SDK_BRIDGE.md) | SDK methods used by tools |
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# SDK Bridge — VEYA MCP ↔ `@veyanet/sdk`
|
|
2
|
+
|
|
3
|
+
This document lists exactly what `@veyanet/mcp` imports from `@veyanet/sdk` and what it deliberately does not re-implement.
|
|
4
|
+
|
|
5
|
+
## Dependency
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
"@veyanet/sdk": "file:../sdk"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Build the SDK before installing MCP:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd ../sdk && npm install && npm run build
|
|
15
|
+
cd ../hosted-mcp && npm install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Factories (`src/sdk.ts`)
|
|
19
|
+
|
|
20
|
+
| Helper | SDK usage |
|
|
21
|
+
|--------|-----------|
|
|
22
|
+
| `createReadClient(cfg)` | `new VeyaClient({ rpcUrl, contractAddress, chainId, explorerUrl })` — no payer |
|
|
23
|
+
| `createWriteClient(cfg)` | same + `payerPrivateKey: cfg.relayerPrivateKey` |
|
|
24
|
+
| `parseHexBytes` | local helper (not SDK) for tool hex args |
|
|
25
|
+
|
|
26
|
+
## Public tools → SDK methods
|
|
27
|
+
|
|
28
|
+
| MCP tool | SDK call |
|
|
29
|
+
|----------|----------|
|
|
30
|
+
| `veya_describe` | none (config honesty JSON) |
|
|
31
|
+
| `veya_ping_chain` | `client.pingChain()`, `client.describe()` |
|
|
32
|
+
| `veya_hash_blake3` | `client.hashBlake3(data)` |
|
|
33
|
+
| `veya_verify_transaction` | `client.verifyTransaction(txHash)` |
|
|
34
|
+
| `veya_api_health` | `fetch(apiUrl/health)` — not SDK |
|
|
35
|
+
|
|
36
|
+
## Write tools → SDK methods
|
|
37
|
+
|
|
38
|
+
| MCP tool | SDK call |
|
|
39
|
+
|----------|----------|
|
|
40
|
+
| `veya_store_commitment` | `client.requireEvm().storeCommitment(uuid16, commitment32)` |
|
|
41
|
+
| `veya_attest_execution` | `client.requireEvm().attestExecution(...)` |
|
|
42
|
+
| `veya_register_environment` | `client.requireEvm().registerEnvironment(...)` |
|
|
43
|
+
|
|
44
|
+
`EvmAnchor` enforces `ensureRobinhoodChain()` before submit.
|
|
45
|
+
|
|
46
|
+
## Not exposed via MCP (use SDK or product API)
|
|
47
|
+
|
|
48
|
+
* `runConsensus` / validator fleet orchestration
|
|
49
|
+
* `protectedExecute` / sealed-node AES session
|
|
50
|
+
* Kyber session establishment
|
|
51
|
+
* In-memory `recordLocalSpend` ledger
|
|
52
|
+
* Full product guest/wallet JWT auth
|
|
53
|
+
* `initSpendingLimit` / `recordSpend` / `flagMemoryNullifier` (backend request path; not currently MCP tools)
|
|
54
|
+
|
|
55
|
+
If you need those, import `@veyanet/sdk` in your own process or use the product API — do not assume MCP mirrors the entire SDK surface.
|
|
56
|
+
|
|
57
|
+
## Version alignment
|
|
58
|
+
|
|
59
|
+
MCP honesty and docs assume SDK **1.2.x** honesty (`SDK_SURFACE`: AES-256-GCM, not FHE, testnet 46630). After upgrading the SDK, re-run:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm run lint && npm test && npm run smoke
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Why a bridge exists
|
|
66
|
+
|
|
67
|
+
Agents should not embed relayer keys. MCP lets them call read/verify tools over HTTPS. Operators who need full cryptographic control stay on the SDK.
|
package/docs/TOOLS.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Tools Reference — VEYA MCP
|
|
2
|
+
|
|
3
|
+
Complete catalog of MCP tools registered by `@veyanet/mcp`. Argument schemas are enforced with Zod on the server.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Public tools (no Bearer required)
|
|
8
|
+
|
|
9
|
+
### `veya_describe`
|
|
10
|
+
|
|
11
|
+
**Purpose:** Honesty card for clients and diligence.
|
|
12
|
+
|
|
13
|
+
**Args:** none
|
|
14
|
+
|
|
15
|
+
**Returns (JSON text):** package name/version, `publicUrl`, settlement object (network, chainId, contract, explorer, rpc), product API URL, sealed claim (AES-256-GCM, not FHE), mainnet deferral, write policy string, stdio sibling path.
|
|
16
|
+
|
|
17
|
+
**When to use:** First call after connecting. Always safe.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
### `veya_ping_chain`
|
|
22
|
+
|
|
23
|
+
**Purpose:** Live RPC connectivity and chain id check via `@veyanet/sdk`.
|
|
24
|
+
|
|
25
|
+
**Args:** none
|
|
26
|
+
|
|
27
|
+
**Returns:** ping fields including `chainId` (stringified bigint), block metadata, `expectedChainId`, resolved client config summary.
|
|
28
|
+
|
|
29
|
+
**Failure:** RPC unreachable or chain id mismatch throws / errors in tool result.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### `veya_hash_blake3`
|
|
34
|
+
|
|
35
|
+
**Purpose:** Compute BLAKE3-256 hex digest.
|
|
36
|
+
|
|
37
|
+
**Args:**
|
|
38
|
+
|
|
39
|
+
| Name | Type | Constraint |
|
|
40
|
+
|------|------|------------|
|
|
41
|
+
| `data` | string | min length 1 |
|
|
42
|
+
|
|
43
|
+
**Returns:** `{ "hash": "<64 hex chars>" }`
|
|
44
|
+
|
|
45
|
+
**Notes:** Commitment helper. Does not write on-chain.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### `veya_verify_transaction`
|
|
50
|
+
|
|
51
|
+
**Purpose:** Parse Veya.sol events from a mined transaction.
|
|
52
|
+
|
|
53
|
+
**Args:**
|
|
54
|
+
|
|
55
|
+
| Name | Type | Constraint |
|
|
56
|
+
|------|------|------------|
|
|
57
|
+
| `txHash` | string | min length 66 (0x-prefixed hash) |
|
|
58
|
+
|
|
59
|
+
**Returns:** Parsed proof object from SDK `verifyTransaction` (event name, digest, explorer URL, etc.) or nullish if no Veya event.
|
|
60
|
+
|
|
61
|
+
**Notes:** Transaction `to` must be the configured `Veya.sol` address or SDK raises mismatch.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### `veya_api_health`
|
|
66
|
+
|
|
67
|
+
**Purpose:** Probe product API honesty endpoint.
|
|
68
|
+
|
|
69
|
+
**Args:** none
|
|
70
|
+
|
|
71
|
+
**Returns:** `{ httpStatus, body }` from `GET {VEYA_API_URL}/health`.
|
|
72
|
+
|
|
73
|
+
**Notes:** `degraded` on the API is allowed and informative. Does not imply MCP process failure.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### `veya_writes_status`
|
|
78
|
+
|
|
79
|
+
**Purpose:** Explicit “writes off” tool when keys are not configured.
|
|
80
|
+
|
|
81
|
+
**Args:** none
|
|
82
|
+
|
|
83
|
+
**Returns:** `{ writesEnabled: false, reason: "..." }`
|
|
84
|
+
|
|
85
|
+
**Notes:** Not registered when writes are enabled; write tools are registered instead.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Authenticated write tools
|
|
90
|
+
|
|
91
|
+
**Server requirements:** `MCP_API_KEY` and `VEYA_RELAYER_PRIVATE_KEY` (or `VEYA_DEPLOYER_PRIVATE_KEY`) both set.
|
|
92
|
+
|
|
93
|
+
**Request requirement:**
|
|
94
|
+
|
|
95
|
+
```http
|
|
96
|
+
Authorization: Bearer <MCP_API_KEY>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
All write tools call `assertWriteAuthorized` then SDK `EvmAnchor` methods (chain id guard on submit).
|
|
100
|
+
|
|
101
|
+
### `veya_store_commitment`
|
|
102
|
+
|
|
103
|
+
| Arg | Type | Meaning |
|
|
104
|
+
|-----|------|---------|
|
|
105
|
+
| `environmentUuidHex` | string | 16-byte UUID as hex |
|
|
106
|
+
| `commitmentHex` | string | 32-byte commitment as hex |
|
|
107
|
+
|
|
108
|
+
**On-chain:** `storeCommitment`
|
|
109
|
+
**Returns:** `{ txHash, explorer }`
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### `veya_attest_execution`
|
|
114
|
+
|
|
115
|
+
| Arg | Type | Meaning |
|
|
116
|
+
|-----|------|---------|
|
|
117
|
+
| `environmentUuidHex` | string | 16-byte env UUID hex |
|
|
118
|
+
| `blake3HashHex` | string | 32-byte execution hash hex |
|
|
119
|
+
| `mldsaSigHex` | string | ML-DSA signature bytes as hex |
|
|
120
|
+
|
|
121
|
+
**On-chain:** `attestExecution`
|
|
122
|
+
**Returns:** `{ txHash, explorer }`
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### `veya_register_environment`
|
|
127
|
+
|
|
128
|
+
| Arg | Type | Meaning |
|
|
129
|
+
|-----|------|---------|
|
|
130
|
+
| `environmentUuidHex` | string | 16-byte UUID hex |
|
|
131
|
+
| `pqPubkeyHashHex` | string | 32-byte PQ pubkey hash hex |
|
|
132
|
+
| `envType` | number | `0` Execution, `1` SecureEnclave, `2` Governance (Veya.sol enum) |
|
|
133
|
+
|
|
134
|
+
**On-chain:** `registerEnvironment`
|
|
135
|
+
**Returns:** `{ txHash, explorer }`
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Tool surface vs product API
|
|
140
|
+
|
|
141
|
+
| Concern | Prefer |
|
|
142
|
+
|---------|--------|
|
|
143
|
+
| Guest Use stamp / UI verify | Product site + `api.veyanet.tech` |
|
|
144
|
+
| Agent paste-URL read/verify | This MCP |
|
|
145
|
+
| Full Build rooms / spend in product | Product API + wallet session |
|
|
146
|
+
| Library integration in your backend | `@veyanet/sdk` directly |
|
|
147
|
+
|
|
148
|
+
MCP write tools are an operator/agent convenience over the same contract methods; they are not a replacement for product auth (guest JWT / wallet SIWE).
|