@namera-ai/cli 0.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 +268 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3270 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Namera CLI
|
|
2
|
+
|
|
3
|
+
Namera CLI gives agents controlled access to smart accounts with session keys and scoped permissions, running fully local and agent-first across chains.
|
|
4
|
+
|
|
5
|
+
> [!IMPORTANT]
|
|
6
|
+
> This CLI is under active development. Expect changes as we approach v1.
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<a href="https://www.npmjs.com/package/@namera-ai/cli"><img src="https://img.shields.io/npm/v/@namera-ai/cli" alt="npm version"></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/@namera-ai/cli"><img src="https://img.shields.io/npm/dm/@namera-ai/cli" alt="npm downloads"></a>
|
|
11
|
+
<a href="https://github.com/thenamespace/namera/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@namera-ai/cli" alt="license"></a>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
## Contents
|
|
15
|
+
|
|
16
|
+
- [Namera CLI](#namera-cli)
|
|
17
|
+
- [Contents](#contents)
|
|
18
|
+
- [Prerequisites](#prerequisites)
|
|
19
|
+
- [Installation](#installation)
|
|
20
|
+
- [Quick Start](#quick-start)
|
|
21
|
+
- [Why Namera CLI?](#why-namera-cli)
|
|
22
|
+
- [Command Groups](#command-groups)
|
|
23
|
+
- [Params Mode and Schema](#params-mode-and-schema)
|
|
24
|
+
- [Output Formats](#output-formats)
|
|
25
|
+
- [Session Key Policies](#session-key-policies)
|
|
26
|
+
- [MCP Server](#mcp-server)
|
|
27
|
+
- [MCP Params Mode](#mcp-params-mode)
|
|
28
|
+
- [Supported Chains](#supported-chains)
|
|
29
|
+
- [Environment Variables](#environment-variables)
|
|
30
|
+
- [Examples](#examples)
|
|
31
|
+
- [Documentation](#documentation)
|
|
32
|
+
- [Security](#security)
|
|
33
|
+
- [License](#license)
|
|
34
|
+
|
|
35
|
+
## Prerequisites
|
|
36
|
+
|
|
37
|
+
- **Node.js 18+** for running the CLI via npm/pnpm/bun
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
Install globally with your package manager:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm i -g @namera-ai/cli
|
|
45
|
+
#or
|
|
46
|
+
pnpm i -g @namera-ai/cli
|
|
47
|
+
#or
|
|
48
|
+
bun i -g @namera-ai/cli
|
|
49
|
+
#or
|
|
50
|
+
yarn global add @namera-ai/cli
|
|
51
|
+
```
|
|
52
|
+
Build from source:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
gh repo clone thenamespace/namera
|
|
56
|
+
cd namera
|
|
57
|
+
bun install
|
|
58
|
+
cd apps/cli
|
|
59
|
+
bun run build
|
|
60
|
+
bun run start -- --help
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
Create a keystore, smart account, and session key (interactive prompts):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
namera keystore create --alias my-owner
|
|
69
|
+
```
|
|
70
|
+
```bash
|
|
71
|
+
namera smart-account create --alias my-smart --owner-alias my-owner
|
|
72
|
+
```
|
|
73
|
+
```bash
|
|
74
|
+
namera session-key create --alias my-session-key --smart-account my-smart
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Start the MCP server:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
namera mcp start --smart-account my-smart --session-key my-session-key=my-password --transport http --port 8080
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Why Namera CLI?
|
|
84
|
+
|
|
85
|
+
**For humans**: clear prompts, consistent flags, and readable output.
|
|
86
|
+
|
|
87
|
+
**For agents**: every command has a JSON schema, supports deterministic `--params`, and returns structured output that is easy to parse.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Schema discovery
|
|
91
|
+
namera schema session-key.create
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Deterministic params mode
|
|
96
|
+
namera session-key create --params '{"alias":"my-session-key","smartAccountAlias":"my-smart","chains":["eth-mainnet"],"sessionKeyPassword":"session-password","ownerKeystorePassword":"owner-password","policyParams":[{"type":"sudo"}]}'
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Command Groups
|
|
100
|
+
|
|
101
|
+
- `keystore` (`k`): Create, import, list, inspect, decrypt, and remove keystores
|
|
102
|
+
- `smart-account` (`sa`): Create, import, list, inspect, status, and remove smart accounts
|
|
103
|
+
- `session-key` (`sk`): Create, list, inspect, status, and remove session keys
|
|
104
|
+
- `schema`: Print JSON schema for command parameters
|
|
105
|
+
- `mcp`: Start the local MCP server
|
|
106
|
+
|
|
107
|
+
Explore help:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
namera --help
|
|
111
|
+
namera keystore --help
|
|
112
|
+
namera smart-account --help
|
|
113
|
+
namera session-key --help
|
|
114
|
+
namera mcp --help
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Params Mode and Schema
|
|
118
|
+
|
|
119
|
+
Agents should use `--params` with the schema command to discover the exact input shape.
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
namera schema keystore.create
|
|
123
|
+
namera schema smart-account.create
|
|
124
|
+
namera schema session-key.create
|
|
125
|
+
namera schema mcp.start
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Example params mode calls:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
namera keystore create --params '{"alias":"my-owner","password":"my-password"}'
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
namera smart-account create --params '{"alias":"my-smart","ownerAlias":"my-owner","ownerPassword":"my-password","index":0}'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
namera session-key create --params '{"alias":"my-session-key","smartAccountAlias":"my-smart","chains":["eth-mainnet"],"sessionKeyPassword":"session-password","ownerKeystorePassword":"owner-password","policyParams":[{"type":"sudo"}]}'
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Output Formats
|
|
143
|
+
|
|
144
|
+
All commands support global output flags:
|
|
145
|
+
|
|
146
|
+
- `--output`, `-o`: `pretty` (default), `json`, or `ndjson`
|
|
147
|
+
- `--quite`, `-q`: Suppress output entirely
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
namera smart-account list --output json
|
|
151
|
+
namera session-key list --output ndjson
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Session Key Policies
|
|
155
|
+
|
|
156
|
+
Session keys are scoped by one or more policies:
|
|
157
|
+
|
|
158
|
+
- `sudo`: Full permission, no restrictions
|
|
159
|
+
- `call`: Restrict targets, functions, and value limits
|
|
160
|
+
- `timestamp`: Limit validity by time range
|
|
161
|
+
- `gas`: Limit total gas spend and optionally require a paymaster
|
|
162
|
+
- `rate-limit`: Limit number of requests per interval
|
|
163
|
+
- `signature-caller`: Restrict who can validate signatures
|
|
164
|
+
|
|
165
|
+
Example policy payload:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{ "type": "timestamp", "validAfter": 1719916800, "validUntil": 1722604800 }
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## MCP Server
|
|
172
|
+
|
|
173
|
+
Start MCP over stdio (default):
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
namera mcp start --smart-account my-smart --session-key my-session-key=my-password
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Start MCP over HTTP:
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
namera mcp start --smart-account my-smart --session-key my-session-key=my-password --transport http --port 8080
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
HTTP endpoint: `http://localhost:8080/mcp`
|
|
186
|
+
|
|
187
|
+
Tools exposed:
|
|
188
|
+
|
|
189
|
+
- `get_wallet_address`
|
|
190
|
+
- `get_balance`
|
|
191
|
+
- `read_contract`
|
|
192
|
+
- `native_transfer`
|
|
193
|
+
- `execute_transaction`
|
|
194
|
+
|
|
195
|
+
### MCP Params Mode
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
namera mcp start --params '{"smartAccountAlias":"my-smart","transport":"http","port":8080,"sessionKeys":{"my-session-key":"my-password"}}'
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
## Supported Chains
|
|
202
|
+
|
|
203
|
+
See the supported chain keys and IDs on [Namera Documentation](https://namera.ai/docs/cli/supported-chains).
|
|
204
|
+
|
|
205
|
+
## Environment Variables
|
|
206
|
+
|
|
207
|
+
You can pass chain-specific environment variables when starting MCP:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Ethereum Mainnet
|
|
211
|
+
export ETH_MAINNET_RPC_URL="https://mainnet.infura.io/v3/YOUR-PROJECT-ID"
|
|
212
|
+
export ETH_MAINNET_BUNDLER_URL="https://rpc.zerodev.app/api/v3/<api-token>/chain/1"
|
|
213
|
+
export ETH_MAINNET_PAYMASTER_URL="https://rpc.zerodev.app/api/v3/<api-token>/chain/1"
|
|
214
|
+
|
|
215
|
+
# Polygon Mainnet
|
|
216
|
+
export POLYGON_MAINNET_RPC_URL="https://polygon-rpc.com"
|
|
217
|
+
export POLYGON_MAINNET_BUNDLER_URL="https://rpc.zerodev.app/api/v3/<api-token>/chain/137"
|
|
218
|
+
export POLYGON_MAINNET_PAYMASTER_URL="https://rpc.zerodev.app/api/v3/<api-token>/chain/137"
|
|
219
|
+
|
|
220
|
+
# ... and more
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
By default, MCP uses the public RPC and public Pimlico Bundler RPC: `https://public.pimlico.io/v2/{chain_id}/rpc`.
|
|
224
|
+
|
|
225
|
+
## Examples
|
|
226
|
+
|
|
227
|
+
Create a keystore and smart account:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
# Create a keystore
|
|
231
|
+
namera keystore create -a my-owner -p my-password
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# Create a smart account
|
|
236
|
+
namera smart-account create -a my-smart -oa my-owner -op my-password -i 0
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Create a session key (interactive policy selection):
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
namera session-key create -a my-session-key -sa my-smart
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
Check deployment status:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Check smart account deployment status on Ethereum Mainnet
|
|
249
|
+
namera smart-account status --alias my-smart --chain eth-mainnet
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
# Check session key installation status on Ethereum Mainnet
|
|
254
|
+
namera session-key status --alias my-session-key --chain eth-mainnet
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Documentation
|
|
258
|
+
|
|
259
|
+
- CLI Docs: [https://namera.ai/docs/cli](https://namera.ai/docs/cli)
|
|
260
|
+
- CLI Docs Source: [apps/docs/content/docs/cli](https://github.com/thenamespace/namera/tree/main/apps/docs/content/docs/cli)
|
|
261
|
+
|
|
262
|
+
## Security
|
|
263
|
+
|
|
264
|
+
Please report security issues via GitHub: https://github.com/thenamespace/namera/security
|
|
265
|
+
|
|
266
|
+
## License
|
|
267
|
+
|
|
268
|
+
Apache 2.0. See [LICENSE](https://github.com/thenamespace/namera/blob/main/LICENSE).
|
package/dist/index.d.mts
ADDED