@verusidx/definecurrency-mcp 0.1.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/LICENSE +21 -0
- package/README.md +74 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +16 -0
- package/build/index.js.map +1 -0
- package/build/tools.d.ts +3 -0
- package/build/tools.d.ts.map +1 -0
- package/build/tools.js +64 -0
- package/build/tools.js.map +1 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VerusIDX Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# @verusidx/definecurrency-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for defining and launching new currencies on Verus — simple tokens, fractional basket currencies, centralized tokens, ID control tokens, and Ethereum ERC-20 mapped tokens.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
**Prerequisite:** `@verusidx/chain-mcp` must be configured and `refresh_chains` called at least once so the chain registry exists.
|
|
8
|
+
|
|
9
|
+
Add to your MCP client config (e.g., Claude Code `claude_desktop_config.json`):
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"mcpServers": {
|
|
14
|
+
"verusidx-definecurrency": {
|
|
15
|
+
"command": "npx",
|
|
16
|
+
"args": ["@verusidx/definecurrency-mcp"],
|
|
17
|
+
"env": {}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**Alternative: local install.** If you prefer a pinned version or offline use, install into a project directory with `npm install @verusidx/definecurrency-mcp` (or `pnpm add` / `yarn add`) and point your config at the local path instead of using `npx`.
|
|
24
|
+
|
|
25
|
+
### Environment Variables
|
|
26
|
+
|
|
27
|
+
| Variable | Default | Description |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| `VERUSIDX_READ_ONLY` | `false` | Set to `true` to disable all tools. This is a write-only MCP — no tools are available in read-only mode. |
|
|
30
|
+
| `VERUSIDX_AUDIT_LOG` | `true` | Set to `false` to disable audit logging. |
|
|
31
|
+
| `VERUSIDX_AUDIT_DIR` | OS default | Custom directory for audit log files. |
|
|
32
|
+
|
|
33
|
+
### Read-Only Mode
|
|
34
|
+
|
|
35
|
+
This is a **write-only MCP**. Setting `VERUSIDX_READ_ONLY=true` disables the only tool (`definecurrency`), leaving zero tools registered.
|
|
36
|
+
|
|
37
|
+
## Tools
|
|
38
|
+
|
|
39
|
+
| Tool | Description |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `definecurrency` | Define a new currency — returns signed tx hex to broadcast via `sendrawtransaction` (chain-mcp) |
|
|
42
|
+
|
|
43
|
+
## Launch Workflow
|
|
44
|
+
|
|
45
|
+
`definecurrency` creates a signed transaction but does **not** broadcast it:
|
|
46
|
+
|
|
47
|
+
1. Ensure a VerusID with the currency name exists and is controlled by the wallet
|
|
48
|
+
2. **`definecurrency`** — returns `{txid, tx, hex}`
|
|
49
|
+
3. **`sendrawtransaction`** (chain-mcp) with the `hex` — broadcasts the definition
|
|
50
|
+
4. Wait for the preconversion timeframe (minimum 20 blocks)
|
|
51
|
+
5. **`getcurrency`** (chain-mcp) to verify the currency launched
|
|
52
|
+
|
|
53
|
+
## Currency Types
|
|
54
|
+
|
|
55
|
+
| Options | Type | Description |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `32` | Simple token | Basic token, optionally with preconversion funding |
|
|
58
|
+
| `33` | Basket currency | Fractional reserve currency supporting on-chain conversions |
|
|
59
|
+
| `2080` | ID control token | Single-satoshi token granting revoke/recover authority |
|
|
60
|
+
|
|
61
|
+
Common options shown. Combine values for variants (e.g., `41` = basket + referrals, `34` = token + ID-restricted). See `tool-specs/definecurrency.md` for the full options table, field reference, and examples.
|
|
62
|
+
|
|
63
|
+
Set `proofprotocol: 2` for centralized tokens (rootID can mint/burn), or `proofprotocol: 3` for Ethereum ERC-20 mapped tokens.
|
|
64
|
+
|
|
65
|
+
## Audit Logging
|
|
66
|
+
|
|
67
|
+
All `definecurrency` calls are logged to date-stamped JSONL files in the audit directory. The hex is truncated in audit entries. Logs are append-only with `0600` permissions.
|
|
68
|
+
|
|
69
|
+
## Requirements
|
|
70
|
+
|
|
71
|
+
- Node.js >= 18.0.0
|
|
72
|
+
- `@verusidx/chain-mcp` installed and `refresh_chains` called (chain registry must exist)
|
|
73
|
+
- At least one Verus daemon running
|
|
74
|
+
- A VerusID matching the currency name, controlled by the wallet
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
+
import { registerTools } from './tools.js';
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: 'verusidx-definecurrency-mcp',
|
|
7
|
+
version: '0.1.0',
|
|
8
|
+
});
|
|
9
|
+
registerTools(server);
|
|
10
|
+
const transport = new StdioServerTransport();
|
|
11
|
+
await server.connect(transport);
|
|
12
|
+
process.on('SIGINT', async () => {
|
|
13
|
+
await server.close();
|
|
14
|
+
process.exit(0);
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,6BAA6B;IACnC,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAEhC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,KAAK,IAAI,EAAE;IAC9B,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/build/tools.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAuCzE,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA6CrD"}
|
package/build/tools.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { rpcCall, auditLog, isReadOnly, assertWriteEnabled, VerusError, } from '@verusidx/shared';
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Response helpers
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
function ok(data) {
|
|
7
|
+
return {
|
|
8
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function fail(category, message) {
|
|
12
|
+
return {
|
|
13
|
+
content: [{ type: 'text', text: JSON.stringify({ error: category, message }, null, 2) }],
|
|
14
|
+
isError: true,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function handleError(err) {
|
|
18
|
+
if (err instanceof VerusError) {
|
|
19
|
+
return fail(err.category, err.message);
|
|
20
|
+
}
|
|
21
|
+
return fail('INTERNAL_ERROR', err instanceof Error ? err.message : 'Unknown error');
|
|
22
|
+
}
|
|
23
|
+
const SERVER_NAME = 'verusidx-definecurrency-mcp';
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Tool registration
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
export function registerTools(server) {
|
|
28
|
+
// definecurrency is write-only — no tools registered in read-only mode
|
|
29
|
+
if (!isReadOnly()) {
|
|
30
|
+
server.tool('definecurrency', 'Define a new currency on the blockchain. Creates a signed transaction that defines the currency — the transaction is NOT broadcast automatically. The returned hex must be sent via sendrawtransaction (in chain-mcp) to actually launch the currency. Supports simple tokens (options: 32), fractional basket currencies (options: 33), centralized tokens (proofprotocol: 2), ID control tokens (options: 2080), and Ethereum ERC-20 mapped tokens (proofprotocol: 3). A VerusID with the same name must exist, be controlled by the wallet, and have sufficient funds to pay the definition fee. Only root IDs can define currencies (except ID control tokens, which subIDs can also define). After broadcasting, wait for the preconversion timeframe (minimum 20 blocks), then verify with getcurrency (chain-mcp). FEE DISCOVERY: Call getcurrency (chain-mcp) on the chain\'s own currency (e.g., "VRSC" or the PBaaS chain name). Regular currencies cost currencyregistrationfee (e.g., 200 VRSC on mainnet). ID control tokens (options: 2080) cost much less — the chain\'s idimportfees value (e.g., 0.02 VRSC on mainnet). The defining ID must hold these funds.', {
|
|
31
|
+
chain: z.string().describe('Chain to define the currency on (e.g., "VRSC", "vrsctest")'),
|
|
32
|
+
definition: z.record(z.unknown()).describe('Currency definition object. Required fields: name (string, must match an existing VerusID), options (number, bitfield — 32=token, 33=basket, 2080=ID control token). Optional fields: proofprotocol (1=decentralized, 2=centralized, 3=ERC-20), currencies (string[], reserve currencies), weights (number[], must sum to 1.0), conversions (number[], preconversion prices), initialsupply (number, required for baskets), preallocations (object[]), initialcontributions (number[]), minpreconversion (number[]), maxpreconversion (number[]), prelaunchcarveout (number), prelaunchdiscount (number), idregistrationfees (number), idreferrallevels (number), idimportfees (number), startblock (number), endblock (number), expiryheight (number), nativecurrencyid (object, for ERC-20), systemid (string), parent (string), launchsystemid (string).'),
|
|
33
|
+
}, async ({ chain, definition }) => {
|
|
34
|
+
try {
|
|
35
|
+
assertWriteEnabled();
|
|
36
|
+
// definecurrency '{"name":"...","options":...}'
|
|
37
|
+
const result = await rpcCall(chain, 'definecurrency', [definition]);
|
|
38
|
+
const defName = definition.name;
|
|
39
|
+
auditLog({
|
|
40
|
+
server: SERVER_NAME,
|
|
41
|
+
tool: 'definecurrency',
|
|
42
|
+
chain,
|
|
43
|
+
params: {
|
|
44
|
+
name: defName,
|
|
45
|
+
options: definition.options,
|
|
46
|
+
proofprotocol: definition.proofprotocol,
|
|
47
|
+
},
|
|
48
|
+
result: {
|
|
49
|
+
txid: result?.txid,
|
|
50
|
+
hex: typeof result?.hex === 'string'
|
|
51
|
+
? result.hex.slice(0, 20) + '...'
|
|
52
|
+
: undefined,
|
|
53
|
+
},
|
|
54
|
+
success: true,
|
|
55
|
+
});
|
|
56
|
+
return ok(result);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
return handleError(err);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,OAAO,EACP,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,UAAU,GACX,MAAM,kBAAkB,CAAC;AAE1B,8EAA8E;AAC9E,mBAAmB;AACnB,8EAA8E;AAE9E,SAAS,EAAE,CAAC,IAAa;IACvB,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED,SAAS,IAAI,CAAC,QAAgB,EAAE,OAAe;IAC7C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACjG,OAAO,EAAE,IAAa;KACvB,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,GAAY;IAC/B,IAAI,GAAG,YAAY,UAAU,EAAE,C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,MAAkC,EAAE,GAAG,KAAK,QAAQ;4BAC/D,CAAC,CAAG,MAAkC,CAAC,GAAc,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;4BAC1E,CAAC,CAAC,SAAS;qBACd;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC,CAAC;gBAEH,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@verusidx/definecurrency-mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for defining Verus currencies — tokens, fractional baskets, centralized currencies, and ERC-20 mapped tokens",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"verusidx-definecurrency-mcp": "./build/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"build"
|
|
12
|
+
],
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=18.0.0"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
18
|
+
"zod": "^3.23.0",
|
|
19
|
+
"@verusidx/shared": "0.1.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "^22.0.0",
|
|
23
|
+
"typescript": "^5.7.0",
|
|
24
|
+
"vitest": "^3.0.0"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"test": "vitest run"
|
|
29
|
+
}
|
|
30
|
+
}
|