@ramestta/agent-mcp-server 0.2.0 → 0.2.2
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/package.json +3 -2
- package/server.js +41 -8
- package/server.json +5 -3
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ramestta/agent-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "MCP server exposing a Ramestta AI agent's on-chain capabilities as tools",
|
|
5
|
+
"mcpName": "io.github.ramestta/agent-mcp-server",
|
|
5
6
|
"license": "MIT",
|
|
6
7
|
"bin": {
|
|
7
8
|
"ramestta-agent-mcp": "server.js"
|
|
@@ -13,7 +14,7 @@
|
|
|
13
14
|
"smithery.yaml"
|
|
14
15
|
],
|
|
15
16
|
"dependencies": {
|
|
16
|
-
"@ramestta/agent-kit": "^0.2.
|
|
17
|
+
"@ramestta/agent-kit": "^0.2.1",
|
|
17
18
|
"ethers": "^6.13.0"
|
|
18
19
|
},
|
|
19
20
|
"keywords": [
|
package/server.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* (with AGENT_KEY / AGENT_NAME in the environment)
|
|
16
16
|
*/
|
|
17
17
|
const { Agent } = require("@ramestta/agent-kit");
|
|
18
|
-
const { Wallet } = require("ethers");
|
|
18
|
+
const { Wallet, Contract, parseEther, formatEther, isAddress } = require("ethers");
|
|
19
19
|
|
|
20
20
|
const TOOLS = [
|
|
21
21
|
{ name: "ramestta_agent_info", description: "Get the agent's .rama name, wallet address and RAMA balance.", schema: { type: "object", properties: {} } },
|
|
@@ -35,13 +35,46 @@ function getAgent() {
|
|
|
35
35
|
return agentPromise;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
// resolve a 0x address or a .rama agent name to the agent's wallet address
|
|
39
|
+
async function resolveRecipient(agent, to) {
|
|
40
|
+
if (isAddress(to)) return to;
|
|
41
|
+
const helper = new Contract(agent.net.bootHelper, ["function resolveName(string) view returns (address)"], agent.provider);
|
|
42
|
+
const wallet = await helper.resolveName(String(to).replace(/\.rama$/i, ""));
|
|
43
|
+
if (wallet === "0x0000000000000000000000000000000000000000") throw new Error(`${to} is not a booted .rama agent`);
|
|
44
|
+
return wallet;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Call agent methods directly — no LangChain indirection, so the only runtime
|
|
48
|
+
// deps are @ramestta/agent-kit + ethers. Every value-moving call still passes
|
|
49
|
+
// the on-chain AgentPermissions layer inside agent.execute / scheduleEvery.
|
|
50
|
+
async function callTool(name, args = {}) {
|
|
40
51
|
const agent = await getAgent();
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
switch (name) {
|
|
53
|
+
case "ramestta_agent_info": {
|
|
54
|
+
const balance = await agent.provider.getBalance(agent.wallet);
|
|
55
|
+
return JSON.stringify({ name: `${agent.name}.rama`, wallet: agent.wallet, balanceRama: formatEther(balance), chainId: Number(agent.net.chainId) });
|
|
56
|
+
}
|
|
57
|
+
case "ramestta_remaining_quota":
|
|
58
|
+
return `${await agent.remainingQuota()} sponsored transactions remaining this period`;
|
|
59
|
+
case "ramestta_send_payment": {
|
|
60
|
+
const to = await resolveRecipient(agent, args.to);
|
|
61
|
+
await agent.execute(to, parseEther(String(args.amountRama)), "0x");
|
|
62
|
+
return `sent ${args.amountRama} RAMA to ${args.to} (${to})`;
|
|
63
|
+
}
|
|
64
|
+
case "ramestta_schedule_task": {
|
|
65
|
+
const taskId = await agent.scheduleEvery(args.everySeconds, args.targetAddress, args.callDataHex, { fund: parseEther(String(args.fundRama ?? "0.001")) });
|
|
66
|
+
return `scheduled task ${taskId}: call ${args.targetAddress} every ${args.everySeconds}s (keeper-executed, no server needed)`;
|
|
67
|
+
}
|
|
68
|
+
case "ramestta_list_tasks":
|
|
69
|
+
return JSON.stringify(await agent.tasks());
|
|
70
|
+
case "ramestta_send_message": {
|
|
71
|
+
const m = await agent.mesh();
|
|
72
|
+
const ack = await m.send(String(args.toName).replace(/\.rama$/i, ""), { text: args.message });
|
|
73
|
+
return `message to ${args.toName}: ${ack.delivered ? "delivered" : ack.queued ? "queued (recipient offline)" : "not delivered"}`;
|
|
74
|
+
}
|
|
75
|
+
default:
|
|
76
|
+
throw new Error(`unknown tool ${name}`);
|
|
77
|
+
}
|
|
45
78
|
}
|
|
46
79
|
|
|
47
80
|
// ─── MCP JSON-RPC over stdio ────────────────────────────────────────────────
|
|
@@ -51,7 +84,7 @@ async function handle(req) {
|
|
|
51
84
|
const { id, method, params } = req;
|
|
52
85
|
try {
|
|
53
86
|
if (method === "initialize") {
|
|
54
|
-
return { jsonrpc: "2.0", id, result: { protocolVersion: "2024-11-05", capabilities: { tools: {} }, serverInfo: { name: "ramestta-agent-os", version: "0.2.
|
|
87
|
+
return { jsonrpc: "2.0", id, result: { protocolVersion: "2024-11-05", capabilities: { tools: {} }, serverInfo: { name: "ramestta-agent-os", version: "0.2.2" } } };
|
|
55
88
|
}
|
|
56
89
|
if (method === "tools/list") {
|
|
57
90
|
return { jsonrpc: "2.0", id, result: { tools: TOOLS.map((t) => ({ name: t.name, description: t.description, inputSchema: t.schema })) } };
|
package/server.json
CHANGED
|
@@ -7,15 +7,17 @@
|
|
|
7
7
|
"source": "github",
|
|
8
8
|
"subfolder": "mcp-server"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.2.
|
|
10
|
+
"version": "0.2.2",
|
|
11
11
|
"websiteUrl": "https://agents.ramestta.com",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "@ramestta/agent-mcp-server",
|
|
17
|
-
"version": "0.2.
|
|
18
|
-
"transport": {
|
|
17
|
+
"version": "0.2.2",
|
|
18
|
+
"transport": {
|
|
19
|
+
"type": "stdio"
|
|
20
|
+
},
|
|
19
21
|
"environmentVariables": [
|
|
20
22
|
{
|
|
21
23
|
"name": "AGENT_KEY",
|