@one-source/api-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/LICENSE +21 -0
- package/README.md +147 -0
- package/dist/analytics.d.ts +53 -0
- package/dist/analytics.d.ts.map +1 -0
- package/dist/analytics.fix-verification.test.d.ts +11 -0
- package/dist/analytics.fix-verification.test.d.ts.map +1 -0
- package/dist/analytics.fix-verification.test.js +146 -0
- package/dist/analytics.fix-verification.test.js.map +1 -0
- package/dist/analytics.js +126 -0
- package/dist/analytics.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +144 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +52 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +126 -0
- package/dist/client.js.map +1 -0
- package/dist/create-server.d.ts +28 -0
- package/dist/create-server.d.ts.map +1 -0
- package/dist/create-server.js +133 -0
- package/dist/create-server.js.map +1 -0
- package/dist/tools/chain/contract-code.d.ts +6 -0
- package/dist/tools/chain/contract-code.d.ts.map +1 -0
- package/dist/tools/chain/contract-code.js +19 -0
- package/dist/tools/chain/contract-code.js.map +1 -0
- package/dist/tools/chain/ens-resolve.d.ts +3 -0
- package/dist/tools/chain/ens-resolve.d.ts.map +1 -0
- package/dist/tools/chain/ens-resolve.js +25 -0
- package/dist/tools/chain/ens-resolve.js.map +1 -0
- package/dist/tools/chain/estimate-gas.d.ts +6 -0
- package/dist/tools/chain/estimate-gas.d.ts.map +1 -0
- package/dist/tools/chain/estimate-gas.js +31 -0
- package/dist/tools/chain/estimate-gas.js.map +1 -0
- package/dist/tools/chain/network-info.d.ts +6 -0
- package/dist/tools/chain/network-info.d.ts.map +1 -0
- package/dist/tools/chain/network-info.js +18 -0
- package/dist/tools/chain/network-info.js.map +1 -0
- package/dist/tools/chain/nonce.d.ts +6 -0
- package/dist/tools/chain/nonce.d.ts.map +1 -0
- package/dist/tools/chain/nonce.js +19 -0
- package/dist/tools/chain/nonce.js.map +1 -0
- package/dist/tools/chain/pending-block.d.ts +6 -0
- package/dist/tools/chain/pending-block.d.ts.map +1 -0
- package/dist/tools/chain/pending-block.js +18 -0
- package/dist/tools/chain/pending-block.js.map +1 -0
- package/dist/tools/chain/proxy-detect.d.ts +6 -0
- package/dist/tools/chain/proxy-detect.d.ts.map +1 -0
- package/dist/tools/chain/proxy-detect.js +19 -0
- package/dist/tools/chain/proxy-detect.js.map +1 -0
- package/dist/tools/chain/simulate-call.d.ts +6 -0
- package/dist/tools/chain/simulate-call.d.ts.map +1 -0
- package/dist/tools/chain/simulate-call.js +33 -0
- package/dist/tools/chain/simulate-call.js.map +1 -0
- package/dist/tools/chain/storage-read.d.ts +3 -0
- package/dist/tools/chain/storage-read.d.ts.map +1 -0
- package/dist/tools/chain/storage-read.js +22 -0
- package/dist/tools/chain/storage-read.js.map +1 -0
- package/dist/tools/chain/tx-receipt.d.ts +6 -0
- package/dist/tools/chain/tx-receipt.d.ts.map +1 -0
- package/dist/tools/chain/tx-receipt.js +18 -0
- package/dist/tools/chain/tx-receipt.js.map +1 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +77 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/indexed/address-txs.d.ts +6 -0
- package/dist/tools/indexed/address-txs.d.ts.map +1 -0
- package/dist/tools/indexed/address-txs.js +25 -0
- package/dist/tools/indexed/address-txs.js.map +1 -0
- package/dist/tools/indexed/block.d.ts +3 -0
- package/dist/tools/indexed/block.d.ts.map +1 -0
- package/dist/tools/indexed/block.js +23 -0
- package/dist/tools/indexed/block.js.map +1 -0
- package/dist/tools/indexed/contract-info.d.ts +6 -0
- package/dist/tools/indexed/contract-info.d.ts.map +1 -0
- package/dist/tools/indexed/contract-info.js +18 -0
- package/dist/tools/indexed/contract-info.js.map +1 -0
- package/dist/tools/indexed/erc1155-balance.d.ts +6 -0
- package/dist/tools/indexed/erc1155-balance.d.ts.map +1 -0
- package/dist/tools/indexed/erc1155-balance.js +24 -0
- package/dist/tools/indexed/erc1155-balance.js.map +1 -0
- package/dist/tools/indexed/erc20-balance.d.ts +6 -0
- package/dist/tools/indexed/erc20-balance.d.ts.map +1 -0
- package/dist/tools/indexed/erc20-balance.js +22 -0
- package/dist/tools/indexed/erc20-balance.js.map +1 -0
- package/dist/tools/indexed/erc20-transfers.d.ts +6 -0
- package/dist/tools/indexed/erc20-transfers.d.ts.map +1 -0
- package/dist/tools/indexed/erc20-transfers.js +24 -0
- package/dist/tools/indexed/erc20-transfers.js.map +1 -0
- package/dist/tools/indexed/events.d.ts +3 -0
- package/dist/tools/indexed/events.d.ts.map +1 -0
- package/dist/tools/indexed/events.js +32 -0
- package/dist/tools/indexed/events.js.map +1 -0
- package/dist/tools/indexed/nft-media.d.ts +6 -0
- package/dist/tools/indexed/nft-media.d.ts.map +1 -0
- package/dist/tools/indexed/nft-media.js +22 -0
- package/dist/tools/indexed/nft-media.js.map +1 -0
- package/dist/tools/indexed/nft-metadata.d.ts +6 -0
- package/dist/tools/indexed/nft-metadata.d.ts.map +1 -0
- package/dist/tools/indexed/nft-metadata.js +22 -0
- package/dist/tools/indexed/nft-metadata.js.map +1 -0
- package/dist/tools/indexed/nft-owner.d.ts +6 -0
- package/dist/tools/indexed/nft-owner.d.ts.map +1 -0
- package/dist/tools/indexed/nft-owner.js +22 -0
- package/dist/tools/indexed/nft-owner.js.map +1 -0
- package/dist/tools/indexed/tx-details.d.ts +6 -0
- package/dist/tools/indexed/tx-details.d.ts.map +1 -0
- package/dist/tools/indexed/tx-details.js +19 -0
- package/dist/tools/indexed/tx-details.js.map +1 -0
- package/dist/tools/indexed/wallet-nfts.d.ts +6 -0
- package/dist/tools/indexed/wallet-nfts.d.ts.map +1 -0
- package/dist/tools/indexed/wallet-nfts.js +22 -0
- package/dist/tools/indexed/wallet-nfts.js.map +1 -0
- package/dist/tools/live/allowance.d.ts +6 -0
- package/dist/tools/live/allowance.d.ts.map +1 -0
- package/dist/tools/live/allowance.js +24 -0
- package/dist/tools/live/allowance.js.map +1 -0
- package/dist/tools/live/contract-info.d.ts +6 -0
- package/dist/tools/live/contract-info.d.ts.map +1 -0
- package/dist/tools/live/contract-info.js +19 -0
- package/dist/tools/live/contract-info.js.map +1 -0
- package/dist/tools/live/erc1155-balance.d.ts +6 -0
- package/dist/tools/live/erc1155-balance.d.ts.map +1 -0
- package/dist/tools/live/erc1155-balance.js +24 -0
- package/dist/tools/live/erc1155-balance.js.map +1 -0
- package/dist/tools/live/erc20-balance.d.ts +6 -0
- package/dist/tools/live/erc20-balance.d.ts.map +1 -0
- package/dist/tools/live/erc20-balance.js +22 -0
- package/dist/tools/live/erc20-balance.js.map +1 -0
- package/dist/tools/live/erc20-transfers.d.ts +3 -0
- package/dist/tools/live/erc20-transfers.d.ts.map +1 -0
- package/dist/tools/live/erc20-transfers.js +26 -0
- package/dist/tools/live/erc20-transfers.js.map +1 -0
- package/dist/tools/live/erc721-tokens.d.ts +6 -0
- package/dist/tools/live/erc721-tokens.d.ts.map +1 -0
- package/dist/tools/live/erc721-tokens.js +22 -0
- package/dist/tools/live/erc721-tokens.js.map +1 -0
- package/dist/tools/live/events.d.ts +3 -0
- package/dist/tools/live/events.d.ts.map +1 -0
- package/dist/tools/live/events.js +26 -0
- package/dist/tools/live/events.js.map +1 -0
- package/dist/tools/live/multi-balance.d.ts +3 -0
- package/dist/tools/live/multi-balance.d.ts.map +1 -0
- package/dist/tools/live/multi-balance.js +26 -0
- package/dist/tools/live/multi-balance.js.map +1 -0
- package/dist/tools/live/nft-metadata.d.ts +6 -0
- package/dist/tools/live/nft-metadata.d.ts.map +1 -0
- package/dist/tools/live/nft-metadata.js +22 -0
- package/dist/tools/live/nft-metadata.js.map +1 -0
- package/dist/tools/live/nft-owner.d.ts +6 -0
- package/dist/tools/live/nft-owner.d.ts.map +1 -0
- package/dist/tools/live/nft-owner.js +22 -0
- package/dist/tools/live/nft-owner.js.map +1 -0
- package/dist/tools/live/total-supply.d.ts +6 -0
- package/dist/tools/live/total-supply.d.ts.map +1 -0
- package/dist/tools/live/total-supply.js +20 -0
- package/dist/tools/live/total-supply.js.map +1 -0
- package/dist/tools/live/tx-details.d.ts +6 -0
- package/dist/tools/live/tx-details.d.ts.map +1 -0
- package/dist/tools/live/tx-details.js +19 -0
- package/dist/tools/live/tx-details.js.map +1 -0
- package/dist/types.d.ts +74 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +86 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { networkParam, formatResponse, addressParam, tokenIdParam } from '../../types.js';
|
|
2
|
+
export const tool = {
|
|
3
|
+
name: '1s_nft_owner_live',
|
|
4
|
+
description: 'Get the current NFT owner via ownerOf(tokenId) RPC call. ' +
|
|
5
|
+
'Use this for real-time ownership verification; use 1s_nft_owner for cached lookups. ' +
|
|
6
|
+
'Only works for ERC721 tokens.',
|
|
7
|
+
category: 'live',
|
|
8
|
+
schema: {
|
|
9
|
+
contract: addressParam.describe('NFT contract address'),
|
|
10
|
+
token_id: tokenIdParam,
|
|
11
|
+
network: networkParam,
|
|
12
|
+
},
|
|
13
|
+
handler: async (input, client) => {
|
|
14
|
+
const res = await client.get('/api/chain/nft-owner', {
|
|
15
|
+
contract: input.contract,
|
|
16
|
+
token_id: input.token_id,
|
|
17
|
+
network: input.network,
|
|
18
|
+
});
|
|
19
|
+
return formatResponse(res);
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=nft-owner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nft-owner.js","sourceRoot":"","sources":["../../../src/tools/live/nft-owner.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE1F,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,mBAAmB;IACzB,WAAW,EACT,2DAA2D;QAC3D,sFAAsF;QACtF,+BAA+B;IACjC,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE;QACN,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,sBAAsB,CAAC;QACvD,QAAQ,EAAE,YAAY;QACtB,OAAO,EAAE,YAAY;KACtB;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,sBAAsB,EAAE;YACnD,QAAQ,EAAE,KAAK,CAAC,QAAkB;YAClC,QAAQ,EAAE,KAAK,CAAC,QAAkB;YAClC,OAAO,EAAE,KAAK,CAAC,OAA6B;SAC7C,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"total-supply.d.ts","sourceRoot":"","sources":["../../../src/tools/live/total-supply.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,IAAI,EAAE,OAkBlB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { networkParam, formatResponse, addressParam } from '../../types.js';
|
|
2
|
+
export const tool = {
|
|
3
|
+
name: '1s_total_supply_live',
|
|
4
|
+
description: 'Get the total supply of an ERC20 or ERC721 token via totalSupply() RPC call. ' +
|
|
5
|
+
'Use this for real-time supply data. ' +
|
|
6
|
+
'Returns raw token units for ERC20 (divide by 10^decimals) or total count for ERC721.',
|
|
7
|
+
category: 'live',
|
|
8
|
+
schema: {
|
|
9
|
+
token: addressParam.describe('Token contract address'),
|
|
10
|
+
network: networkParam,
|
|
11
|
+
},
|
|
12
|
+
handler: async (input, client) => {
|
|
13
|
+
const res = await client.get('/api/chain/total-supply', {
|
|
14
|
+
token: input.token,
|
|
15
|
+
network: input.network,
|
|
16
|
+
});
|
|
17
|
+
return formatResponse(res);
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=total-supply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"total-supply.js","sourceRoot":"","sources":["../../../src/tools/live/total-supply.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE5E,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,+EAA+E;QAC/E,sCAAsC;QACtC,sFAAsF;IACxF,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE;QACN,KAAK,EAAE,YAAY,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QACtD,OAAO,EAAE,YAAY;KACtB;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,yBAAyB,EAAE;YACtD,KAAK,EAAE,KAAK,CAAC,KAAe;YAC5B,OAAO,EAAE,KAAK,CAAC,OAA6B;SAC7C,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx-details.d.ts","sourceRoot":"","sources":["../../../src/tools/live/tx-details.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,IAAI,EAAE,OAiBlB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { networkParam, formatResponse, txHashParam, safePath } from '../../types.js';
|
|
2
|
+
export const tool = {
|
|
3
|
+
name: '1s_tx_details_live',
|
|
4
|
+
description: 'Get full transaction data and receipt directly from the RPC node. ' +
|
|
5
|
+
'Use this for very recent or unindexed transactions; use 1s_tx_details for enriched indexed data. ' +
|
|
6
|
+
'Returns both transaction fields and receipt (status, gas used, logs).',
|
|
7
|
+
category: 'live',
|
|
8
|
+
schema: {
|
|
9
|
+
hash: txHashParam,
|
|
10
|
+
network: networkParam,
|
|
11
|
+
},
|
|
12
|
+
handler: async (input, client) => {
|
|
13
|
+
const res = await client.get(`/api/chain/tx/${safePath(input.hash)}`, {
|
|
14
|
+
network: input.network,
|
|
15
|
+
});
|
|
16
|
+
return formatResponse(res);
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=tx-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tx-details.js","sourceRoot":"","sources":["../../../src/tools/live/tx-details.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAErF,MAAM,CAAC,MAAM,IAAI,GAAY;IAC3B,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,oEAAoE;QACpE,mGAAmG;QACnG,uEAAuE;IACzE,QAAQ,EAAE,MAAM;IAChB,MAAM,EAAE;QACN,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,YAAY;KACtB;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,iBAAiB,QAAQ,CAAC,KAAK,CAAC,IAAc,CAAC,EAAE,EAAE;YAC9E,OAAO,EAAE,KAAK,CAAC,OAA6B;SAC7C,CAAC,CAAC;QACH,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for tool definitions.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import type { OneSourceClient } from './client.js';
|
|
6
|
+
/**
|
|
7
|
+
* API response envelope — discriminated union on the `error` field.
|
|
8
|
+
* Moved here from client.ts to avoid circular imports with formatResponse.
|
|
9
|
+
*/
|
|
10
|
+
export type ApiResponse<T = unknown> = {
|
|
11
|
+
data: T;
|
|
12
|
+
error?: undefined;
|
|
13
|
+
meta?: Record<string, unknown>;
|
|
14
|
+
} | {
|
|
15
|
+
data?: undefined;
|
|
16
|
+
error: string;
|
|
17
|
+
meta?: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Every tool exports a ToolDef. The server factory iterates these to register tools.
|
|
21
|
+
*/
|
|
22
|
+
export interface ToolDef {
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
category: 'indexed' | 'live' | 'chain';
|
|
26
|
+
schema: z.ZodRawShape;
|
|
27
|
+
handler: (input: Record<string, unknown>, client: OneSourceClient) => Promise<string>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Common parameter: optional network selection.
|
|
31
|
+
*/
|
|
32
|
+
export declare const networkParam: z.ZodOptional<z.ZodEnum<["ethereum", "sepolia", "avax"]>>;
|
|
33
|
+
/**
|
|
34
|
+
* Common parameter: Ethereum address.
|
|
35
|
+
*/
|
|
36
|
+
export declare const addressParam: z.ZodString;
|
|
37
|
+
/**
|
|
38
|
+
* Common parameter: optional Ethereum address.
|
|
39
|
+
*/
|
|
40
|
+
export declare const optionalAddressParam: z.ZodOptional<z.ZodString>;
|
|
41
|
+
/**
|
|
42
|
+
* Common parameter: transaction hash.
|
|
43
|
+
*/
|
|
44
|
+
export declare const txHashParam: z.ZodString;
|
|
45
|
+
/**
|
|
46
|
+
* Common parameter: token ID (for NFTs).
|
|
47
|
+
*/
|
|
48
|
+
export declare const tokenIdParam: z.ZodString;
|
|
49
|
+
/**
|
|
50
|
+
* Common parameter: hex-encoded data.
|
|
51
|
+
*/
|
|
52
|
+
export declare const hexDataParam: z.ZodString;
|
|
53
|
+
/**
|
|
54
|
+
* Common parameter: optional hex-encoded data.
|
|
55
|
+
*/
|
|
56
|
+
export declare const optionalHexParam: z.ZodOptional<z.ZodString>;
|
|
57
|
+
/**
|
|
58
|
+
* Common parameter: result limit.
|
|
59
|
+
*/
|
|
60
|
+
export declare const limitParam: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
/**
|
|
62
|
+
* Common parameter: block number.
|
|
63
|
+
*/
|
|
64
|
+
export declare const blockNumberParam: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
/**
|
|
66
|
+
* Encode a value for safe interpolation into a URL path segment.
|
|
67
|
+
* Use this for any user-supplied value placed in a URL path.
|
|
68
|
+
*/
|
|
69
|
+
export declare function safePath(segment: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Format an API response for the LLM. Returns text content.
|
|
72
|
+
*/
|
|
73
|
+
export declare function formatResponse(response: ApiResponse): string;
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,GAAG,OAAO,IAC/B;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAC9D;IAAE,IAAI,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACvC,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACvF;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,2DAKtB,CAAC;AAEJ;;GAEG;AACH,eAAO,MAAM,YAAY,aAGc,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,oBAAoB,4BAA0B,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,WAAW,aAGe,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,YAAY,aAGe,CAAC;AAEzC;;GAEG;AACH,eAAO,MAAM,YAAY,aAGc,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,gBAAgB,4BAA0B,CAAC;AAExD;;GAEG;AACH,eAAO,MAAM,UAAU,4BAMqD,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,gBAAgB,4BAKF,CAAC;AAE5B;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAQ5D"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for tool definitions.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
/**
|
|
6
|
+
* Common parameter: optional network selection.
|
|
7
|
+
*/
|
|
8
|
+
export const networkParam = z
|
|
9
|
+
.enum(['ethereum', 'sepolia', 'avax'])
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('Blockchain network: "ethereum" (default), "sepolia", "avax"');
|
|
12
|
+
/**
|
|
13
|
+
* Common parameter: Ethereum address.
|
|
14
|
+
*/
|
|
15
|
+
export const addressParam = z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, 'Must be a valid 0x address (40 hex chars)')
|
|
18
|
+
.describe('Ethereum address (0x...)');
|
|
19
|
+
/**
|
|
20
|
+
* Common parameter: optional Ethereum address.
|
|
21
|
+
*/
|
|
22
|
+
export const optionalAddressParam = addressParam.optional();
|
|
23
|
+
/**
|
|
24
|
+
* Common parameter: transaction hash.
|
|
25
|
+
*/
|
|
26
|
+
export const txHashParam = z
|
|
27
|
+
.string()
|
|
28
|
+
.regex(/^0x[a-fA-F0-9]{64}$/, 'Must be a valid transaction hash (64 hex chars)')
|
|
29
|
+
.describe('Transaction hash (0x...)');
|
|
30
|
+
/**
|
|
31
|
+
* Common parameter: token ID (for NFTs).
|
|
32
|
+
*/
|
|
33
|
+
export const tokenIdParam = z
|
|
34
|
+
.string()
|
|
35
|
+
.regex(/^\d+$/, 'Must be a numeric string')
|
|
36
|
+
.describe('Token ID (numeric string)');
|
|
37
|
+
/**
|
|
38
|
+
* Common parameter: hex-encoded data.
|
|
39
|
+
*/
|
|
40
|
+
export const hexDataParam = z
|
|
41
|
+
.string()
|
|
42
|
+
.regex(/^0x[a-fA-F0-9]*$/, 'Must be a hex string (0x...)')
|
|
43
|
+
.describe('Hex-encoded data (0x...)');
|
|
44
|
+
/**
|
|
45
|
+
* Common parameter: optional hex-encoded data.
|
|
46
|
+
*/
|
|
47
|
+
export const optionalHexParam = hexDataParam.optional();
|
|
48
|
+
/**
|
|
49
|
+
* Common parameter: result limit.
|
|
50
|
+
*/
|
|
51
|
+
export const limitParam = z
|
|
52
|
+
.number()
|
|
53
|
+
.int()
|
|
54
|
+
.min(1)
|
|
55
|
+
.max(100)
|
|
56
|
+
.optional()
|
|
57
|
+
.describe('Maximum results to return (1-100, default varies by endpoint)');
|
|
58
|
+
/**
|
|
59
|
+
* Common parameter: block number.
|
|
60
|
+
*/
|
|
61
|
+
export const blockNumberParam = z
|
|
62
|
+
.number()
|
|
63
|
+
.int()
|
|
64
|
+
.min(0)
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Block number');
|
|
67
|
+
/**
|
|
68
|
+
* Encode a value for safe interpolation into a URL path segment.
|
|
69
|
+
* Use this for any user-supplied value placed in a URL path.
|
|
70
|
+
*/
|
|
71
|
+
export function safePath(segment) {
|
|
72
|
+
return encodeURIComponent(segment);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Format an API response for the LLM. Returns text content.
|
|
76
|
+
*/
|
|
77
|
+
export function formatResponse(response) {
|
|
78
|
+
if (response.error) {
|
|
79
|
+
return `Error: ${response.error}`;
|
|
80
|
+
}
|
|
81
|
+
if (response.meta) {
|
|
82
|
+
return JSON.stringify({ data: response.data, meta: response.meta }, null, 2);
|
|
83
|
+
}
|
|
84
|
+
return JSON.stringify(response.data, null, 2) ?? 'null';
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAsBxB;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;KACrC,QAAQ,EAAE;KACV,QAAQ,CACP,6DAA6D,CAC9D,CAAC;AAEJ;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,KAAK,CAAC,qBAAqB,EAAE,2CAA2C,CAAC;KACzE,QAAQ,CAAC,0BAA0B,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;AAE5D;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC;KACzB,MAAM,EAAE;KACR,KAAK,CAAC,qBAAqB,EAAE,iDAAiD,CAAC;KAC/E,QAAQ,CAAC,0BAA0B,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,KAAK,CAAC,OAAO,EAAE,0BAA0B,CAAC;KAC1C,QAAQ,CAAC,2BAA2B,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC;KAC1B,MAAM,EAAE;KACR,KAAK,CAAC,kBAAkB,EAAE,8BAA8B,CAAC;KACzD,QAAQ,CAAC,0BAA0B,CAAC,CAAC;AAExC;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC;KACxB,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,GAAG,CAAC,GAAG,CAAC;KACR,QAAQ,EAAE;KACV,QAAQ,CAAC,+DAA+D,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,EAAE;KACR,GAAG,EAAE;KACL,GAAG,CAAC,CAAC,CAAC;KACN,QAAQ,EAAE;KACV,QAAQ,CAAC,cAAc,CAAC,CAAC;AAE5B;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,QAAqB;IAClD,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,CAAC;IACpC,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC;AAC1D,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@one-source/api-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "MCP server for OneSource blockchain data — 34 named tools for balances, NFTs, transactions, events, and live chain queries via x402",
|
|
6
|
+
"bin": {
|
|
7
|
+
"onesource-api-mcp": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./dist/create-server.js",
|
|
10
|
+
"types": "./dist/create-server.d.ts",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/create-server.d.ts",
|
|
14
|
+
"default": "./dist/create-server.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"onesource",
|
|
26
|
+
"web3",
|
|
27
|
+
"blockchain",
|
|
28
|
+
"ethereum",
|
|
29
|
+
"x402",
|
|
30
|
+
"nft",
|
|
31
|
+
"erc20",
|
|
32
|
+
"transactions"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"gen": "node scripts/gen-tools-index.mjs",
|
|
36
|
+
"new-tool": "node scripts/new-tool.mjs",
|
|
37
|
+
"prebuild": "npm run gen",
|
|
38
|
+
"build": "tsc",
|
|
39
|
+
"prepublishOnly": "npm run build",
|
|
40
|
+
"dev": "tsc --watch",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
46
|
+
"zod": "^3.24.0"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^22.0.0",
|
|
50
|
+
"typescript": "^5.7.0",
|
|
51
|
+
"vitest": "^2.0.0"
|
|
52
|
+
},
|
|
53
|
+
"engines": {
|
|
54
|
+
"node": ">=18"
|
|
55
|
+
},
|
|
56
|
+
"author": "BlockParty",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"homepage": "https://docs.onesource.io",
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "git",
|
|
61
|
+
"url": "https://github.com/AnonDev-BlockParty/sre-services.git",
|
|
62
|
+
"directory": "skills/mcp"
|
|
63
|
+
}
|
|
64
|
+
}
|