Skip to content

Commit 28942c2

Browse files
author
azeth-sync[bot]
committed
v0.2.15: sync from monorepo 2026-06-04
1 parent 4659edc commit 28942c2

4 files changed

Lines changed: 80 additions & 48 deletions

File tree

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@azeth/mcp-server",
3-
"version": "0.2.14",
3+
"version": "0.2.15",
44
"mcpName": "io.github.azeth-protocol/mcp-server",
55
"type": "module",
66
"description": "MCP server for the Azeth trust infrastructure — smart accounts, payments, reputation, and discovery tools for AI agents",
@@ -41,8 +41,8 @@
4141
"clean": "rm -rf dist"
4242
},
4343
"dependencies": {
44-
"@azeth/common": "^0.2.14",
45-
"@azeth/sdk": "^0.2.14",
44+
"@azeth/common": "^0.2.15",
45+
"@azeth/sdk": "^0.2.15",
4646
"@modelcontextprotocol/sdk": "^1.0.0",
4747
"dotenv": "^16.4.0",
4848
"viem": "^2.21.0",

test/tools/messaging.test.ts

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,24 @@ describe('messaging tools', () => {
5050
destroy: vi.fn(),
5151
} as never);
5252

53-
const tool = server.tools.get('azeth_send_message')!;
54-
const result = await tool.handler({
55-
chain: 'baseSepolia',
56-
to: 'not-an-address',
57-
content: 'Hello agent!',
58-
});
59-
60-
const { parsed, isError } = parseResult(result);
61-
expect(isError).toBe(true);
62-
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND']).toContain(parsed.error.code);
53+
// Stub the discovery fetch to return no matches → resolution fails fast and
54+
// deterministically. (A real network call hangs in CI until the test timeout.)
55+
const originalFetch = globalThis.fetch;
56+
globalThis.fetch = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ data: [] }) }) as never;
57+
try {
58+
const tool = server.tools.get('azeth_send_message')!;
59+
const result = await tool.handler({
60+
chain: 'baseSepolia',
61+
to: 'not-an-address',
62+
content: 'Hello agent!',
63+
});
64+
65+
const { parsed, isError } = parseResult(result);
66+
expect(isError).toBe(true);
67+
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND']).toContain(parsed.error.code);
68+
} finally {
69+
globalThis.fetch = originalFetch;
70+
}
6371
});
6472

6573
it('returns error when AZETH_PRIVATE_KEY is missing', async () => {
@@ -223,15 +231,23 @@ describe('messaging tools', () => {
223231
destroy: vi.fn(),
224232
} as never);
225233

226-
const tool = server.tools.get('azeth_check_reachability')!;
227-
const result = await tool.handler({
228-
chain: 'baseSepolia',
229-
address: 'bad-addr',
230-
});
231-
232-
const { parsed, isError } = parseResult(result);
233-
expect(isError).toBe(true);
234-
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND']).toContain(parsed.error.code);
234+
// Stub the discovery fetch to return no matches → resolution fails fast and
235+
// deterministically. (A real network call hangs in CI until the test timeout.)
236+
const originalFetch = globalThis.fetch;
237+
globalThis.fetch = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ data: [] }) }) as never;
238+
try {
239+
const tool = server.tools.get('azeth_check_reachability')!;
240+
const result = await tool.handler({
241+
chain: 'baseSepolia',
242+
address: 'bad-addr',
243+
});
244+
245+
const { parsed, isError } = parseResult(result);
246+
expect(isError).toBe(true);
247+
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND']).toContain(parsed.error.code);
248+
} finally {
249+
globalThis.fetch = originalFetch;
250+
}
235251
});
236252

237253
it('returns error when AZETH_PRIVATE_KEY is missing', async () => {

test/tools/payments.test.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -406,20 +406,28 @@ describe('payment tools', () => {
406406
destroy: vi.fn(),
407407
} as never);
408408

409-
const tool = server.tools.get('azeth_create_payment_agreement')!;
410-
const result = await tool.handler({
411-
privateKey: TEST_PRIVATE_KEY,
412-
chain: 'baseSepolia',
413-
payee: 'not-address',
414-
token: TEST_USDC_ADDRESS,
415-
amount: '10.00',
416-
intervalSeconds: 86400,
417-
});
418-
419-
const { parsed, isError } = parseResult(result);
420-
expect(isError).toBe(true);
421-
// Name resolution fails with NETWORK_ERROR (server unreachable), SERVICE_NOT_FOUND, or ACCOUNT_NOT_FOUND
422-
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND', 'ACCOUNT_NOT_FOUND']).toContain(parsed.error.code);
409+
// Stub the discovery fetch to return no matches → resolution fails fast and
410+
// deterministically. (A real network call hangs in CI until the test timeout.)
411+
const originalFetch = globalThis.fetch;
412+
globalThis.fetch = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ data: [] }) }) as never;
413+
try {
414+
const tool = server.tools.get('azeth_create_payment_agreement')!;
415+
const result = await tool.handler({
416+
privateKey: TEST_PRIVATE_KEY,
417+
chain: 'baseSepolia',
418+
payee: 'not-address',
419+
token: TEST_USDC_ADDRESS,
420+
amount: '10.00',
421+
intervalSeconds: 86400,
422+
});
423+
424+
const { parsed, isError } = parseResult(result);
425+
expect(isError).toBe(true);
426+
// No match → SERVICE_NOT_FOUND (or ACCOUNT_NOT_FOUND/NETWORK_ERROR).
427+
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND', 'ACCOUNT_NOT_FOUND']).toContain(parsed.error.code);
428+
} finally {
429+
globalThis.fetch = originalFetch;
430+
}
423431
});
424432

425433
it('returns error for invalid token address', async () => {

test/tools/transfer.test.ts

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,26 @@ describe('azeth_transfer', () => {
6262
destroy: vi.fn(),
6363
} as never);
6464

65-
const tool = server.tools.get('azeth_transfer')!;
66-
const result = await tool.handler({
67-
privateKey: TEST_PRIVATE_KEY,
68-
chain: 'baseSepolia',
69-
to: 'not-an-address',
70-
amount: '1.0',
71-
});
72-
73-
const { parsed, isError } = parseResult(result);
74-
expect(isError).toBe(true);
75-
// Name resolution fails with NETWORK_ERROR (server unreachable), SERVICE_NOT_FOUND, or ACCOUNT_NOT_FOUND
76-
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND', 'ACCOUNT_NOT_FOUND']).toContain(parsed.error.code);
65+
// Stub the discovery fetch to return no matches → resolution fails fast and
66+
// deterministically. (A real network call hangs in CI until the test timeout.)
67+
const originalFetch = globalThis.fetch;
68+
globalThis.fetch = vi.fn().mockResolvedValue({ ok: true, json: async () => ({ data: [] }) }) as never;
69+
try {
70+
const tool = server.tools.get('azeth_transfer')!;
71+
const result = await tool.handler({
72+
privateKey: TEST_PRIVATE_KEY,
73+
chain: 'baseSepolia',
74+
to: 'not-an-address',
75+
amount: '1.0',
76+
});
77+
78+
const { parsed, isError } = parseResult(result);
79+
expect(isError).toBe(true);
80+
// No match → ACCOUNT_NOT_FOUND (account context), or SERVICE_NOT_FOUND/NETWORK_ERROR.
81+
expect(['NETWORK_ERROR', 'SERVICE_NOT_FOUND', 'ACCOUNT_NOT_FOUND']).toContain(parsed.error.code);
82+
} finally {
83+
globalThis.fetch = originalFetch;
84+
}
7785
});
7886

7987
it('returns error for invalid token address', async () => {

0 commit comments

Comments
 (0)