bsv-mcp 0.2.0 → 0.2.7

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.
Files changed (52) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/index.js +87272 -70728
  3. package/index.ts +409 -22
  4. package/package.json +28 -24
  5. package/tools/a2b/discover.ts +13 -13
  6. package/tools/bap/friend.ts +2 -3
  7. package/tools/bap/generate.ts +7 -9
  8. package/tools/bap/getCurrentAddress.ts +1 -8
  9. package/tools/bap/getId.ts +3 -3
  10. package/tools/bsocial/bmapFollow.ts +3 -7
  11. package/tools/bsocial/bmapLikes.ts +3 -3
  12. package/tools/bsocial/bmapReadPosts.ts +3 -3
  13. package/tools/bsocial/createPost.ts +3 -3
  14. package/tools/bsocial/readPosts.ts +3 -3
  15. package/tools/bsv/decodeTransaction.ts +2 -5
  16. package/tools/bsv/explore.ts +2 -3
  17. package/tools/bsv/getPrice.ts +1 -9
  18. package/tools/bsv/token.ts +14 -26
  19. package/tools/index.ts +0 -13
  20. package/tools/mnee/getBalance.ts +2 -4
  21. package/tools/mnee/parseTx.ts +3 -3
  22. package/tools/mnee/sendMnee.ts +5 -5
  23. package/tools/ordinals/getInscription.ts +2 -3
  24. package/tools/ordinals/getTokenByIdOrTicker.ts +6 -3
  25. package/tools/ordinals/marketListings.ts +2 -18
  26. package/tools/ordinals/marketSales.ts +2 -4
  27. package/tools/ordinals/searchInscriptions.ts +2 -4
  28. package/tools/utils/index.ts +14 -16
  29. package/tools/wallet/a2bPublishAgent.ts +18 -27
  30. package/tools/wallet/a2bPublishMcp.ts +17 -22
  31. package/tools/wallet/createOrdinals.ts +11 -20
  32. package/tools/wallet/fetchPaymentUtxos.ts +9 -1
  33. package/tools/wallet/gatherCollectionInfo.ts +9 -13
  34. package/tools/wallet/getAddress.ts +1 -9
  35. package/tools/wallet/getBalance.ts +2 -14
  36. package/tools/wallet/getBalanceDroplet.ts +2 -13
  37. package/tools/wallet/getPublicKey.ts +3 -16
  38. package/tools/wallet/mintCollection.ts +17 -22
  39. package/tools/wallet/purchaseListing.ts +19 -29
  40. package/tools/wallet/refreshUtxos.ts +2 -14
  41. package/tools/wallet/sendOrdinals.ts +11 -20
  42. package/tools/wallet/sendToAddress.ts +2 -22
  43. package/tools/wallet/setupDroplet.ts +7 -18
  44. package/tools/wallet/tools.ts +10 -80
  45. package/tools/wallet/transferOrdToken.ts +12 -20
  46. package/vite.config.ts +15 -0
  47. package/tools/bigblocks/components.ts +0 -304
  48. package/tools/bigblocks/docs.ts +0 -488
  49. package/tools/bigblocks/examples.ts +0 -527
  50. package/tools/bigblocks/generator.ts +0 -485
  51. package/tools/bigblocks/index.ts +0 -23
  52. package/tools/bsocial/bigblocksApiClient.ts +0 -189
@@ -25,12 +25,10 @@ const { toArray } = BSVUtils;
25
25
  const KEY_DIR = path.join(os.homedir(), ".bsv-mcp");
26
26
  const KEY_FILE_PATH = path.join(KEY_DIR, "keys.json");
27
27
 
28
- const bapGenerateArgsSchema = z
29
- .object({
30
- alternateName: z.string().optional(),
31
- description: z.string().optional(),
32
- })
33
- .optional();
28
+ const bapGenerateArgsSchema = z.object({
29
+ alternateName: z.string().optional().describe("Alternate name for the BAP identity profile"),
30
+ description: z.string().optional().describe("Description for the BAP identity profile"),
31
+ });
34
32
 
35
33
  export type BapGenerateArgs = z.infer<typeof bapGenerateArgsSchema>;
36
34
 
@@ -415,10 +413,10 @@ export function registerBapGenerateTool(server: McpServer) {
415
413
  server.tool(
416
414
  "bap_generate",
417
415
  "Generates a BAP HD master key AND derives the first identity key if no BAP keys (xprv or identityPk) exist. Saves keys to secure storage. Attempts on-chain registration using payPk (honors DISABLE_BROADCASTING). Optionally takes alternateName and description for the profile.",
418
- { args: bapGenerateArgsSchema },
419
- async ({ args }: { args?: BapGenerateArgs }): Promise<CallToolResult> => {
416
+ { ...bapGenerateArgsSchema.shape },
417
+ async ({ alternateName, description }): Promise<CallToolResult> => {
420
418
  try {
421
- const result = await generateBapKeys(args);
419
+ const result = await generateBapKeys({ alternateName, description });
422
420
  // Format result as JSON
423
421
  return {
424
422
  content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
@@ -15,14 +15,7 @@ export function registerBapGetCurrentAddressTool(
15
15
  server.tool(
16
16
  "bap_getCurrentAddress",
17
17
  "Retrieves the current BAP identity's Bitcoin SV address. This address is derived from the server's configured identity key.",
18
- {
19
- args: z
20
- .object({}) // No arguments needed
21
- .optional()
22
- .describe(
23
- "No parameters required - simply returns the current BAP identity address",
24
- ),
25
- },
18
+ {},
26
19
  async () => {
27
20
  try {
28
21
  let pkToUse = identityPk;
@@ -73,12 +73,12 @@ export function registerBapGetIdTool(
73
73
  server.tool(
74
74
  "bap_getId",
75
75
  "Retrieves a Bitcoin Attestation Protocol (BAP) identity profile using an idKey (Paymail or public key). If no idKey is provided, it attempts to use the server's configured identity key.",
76
- { args: bapGetIdArgsSchema },
76
+ { ...bapGetIdArgsSchema.shape },
77
77
  async (
78
- { args }: { args: BapGetIdArgs },
78
+ { idKey },
79
79
  extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
80
80
  ): Promise<CallToolResult> => {
81
- let targetIdKey = args.idKey;
81
+ let targetIdKey = idKey;
82
82
 
83
83
  if (!targetIdKey) {
84
84
  // First priority: Use authenticated user's BAP ID from OAuth session
@@ -83,14 +83,10 @@ export function registerBmapReadFollowsTool(server: McpServer) {
83
83
  server.tool(
84
84
  "bmap_readFollows",
85
85
  "Read follow relationships from the BMAP API. Shows who a user is following or who follows them.",
86
- { args: bmapReadFollowsArgsSchema },
87
- async ({
88
- args,
89
- }: {
90
- args: BmapReadFollowsArgs;
91
- }): Promise<CallToolResult> => {
86
+ { ...bmapReadFollowsArgsSchema.shape },
87
+ async ({ bapId, type, limit, page }): Promise<CallToolResult> => {
92
88
  try {
93
- const result = await readBmapFollows(args);
89
+ const result = await readBmapFollows({ bapId, type, limit, page });
94
90
 
95
91
  if (result.success) {
96
92
  return {
@@ -73,10 +73,10 @@ export function registerBmapReadLikesTool(server: McpServer) {
73
73
  server.tool(
74
74
  "bmap_readLikes",
75
75
  "Read likes and reactions for a specific post from the BMAP API. Shows who liked the post and what emoji reactions were used.",
76
- { args: bmapReadLikesArgsSchema },
77
- async ({ args }: { args: BmapReadLikesArgs }): Promise<CallToolResult> => {
76
+ { ...bmapReadLikesArgsSchema.shape },
77
+ async ({ txid, limit, page }): Promise<CallToolResult> => {
78
78
  try {
79
- const result = await readBmapLikes(args);
79
+ const result = await readBmapLikes({ txid, limit, page });
80
80
 
81
81
  if (result.success) {
82
82
  return {
@@ -110,10 +110,10 @@ export function registerBmapReadPostsTool(server: McpServer) {
110
110
  server.tool(
111
111
  "bmap_readPosts",
112
112
  "Read social posts from the BMAP API (query layer). Can fetch posts by author (BAP ID), specific post by transaction ID, or recent posts from all users. Supports pagination and feed functionality.",
113
- { args: bmapReadPostsArgsSchema },
114
- async ({ args }: { args: BmapReadPostsArgs }): Promise<CallToolResult> => {
113
+ { ...bmapReadPostsArgsSchema.shape },
114
+ async ({ bapId, txid, limit, page, feed, address }): Promise<CallToolResult> => {
115
115
  try {
116
- const result = await readBmapPosts(args);
116
+ const result = await readBmapPosts({ bapId, txid, limit, page, feed, address });
117
117
 
118
118
  if (result.success) {
119
119
  return {
@@ -127,9 +127,9 @@ export function registerCreatePostTool(server: McpServer, wallet: Wallet) {
127
127
  server.tool(
128
128
  "bsocial_createPost",
129
129
  "Create a social post on the BSV blockchain using B:// and MAP protocols. Posts are stored permanently on-chain and can include plain text or markdown content.",
130
- { args: createPostArgsSchema },
131
- async ({ args }: { args: CreatePostArgs }): Promise<CallToolResult> => {
132
- const result = await createSocialPost(args, wallet);
130
+ { ...createPostArgsSchema.shape },
131
+ async ({ content, contentType, app, additionalMapData }): Promise<CallToolResult> => {
132
+ const result = await createSocialPost({ content, contentType, app, additionalMapData }, wallet);
133
133
  return createResponse(result);
134
134
  },
135
135
  );
@@ -198,10 +198,10 @@ export function registerReadPostsTool(server: McpServer) {
198
198
  server.tool(
199
199
  "bsocial_readPosts",
200
200
  "Read social posts from the BSV blockchain using BMAP API. Can fetch posts by author (BAP ID), specific post by transaction ID, or recent posts from all users. Supports pagination and feed functionality.",
201
- { args: readPostsArgsSchema },
202
- async ({ args }: { args: ReadPostsArgs }): Promise<CallToolResult> => {
201
+ { ...readPostsArgsSchema.shape },
202
+ async ({ bapId, txid, limit, page, feed }): Promise<CallToolResult> => {
203
203
  try {
204
- const result = await readSocialPosts(args);
204
+ const result = await readSocialPosts({ bapId, txid, limit, page, feed });
205
205
 
206
206
  if (result.success && result.posts) {
207
207
  // Format posts for display
@@ -123,15 +123,12 @@ export function registerDecodeTransactionTool(server: McpServer): void {
123
123
  server.tool(
124
124
  "bsv_decodeTransaction",
125
125
  "Decodes and analyzes Bitcoin SV transactions to provide detailed insights. This powerful tool accepts either a transaction ID or raw transaction data and returns comprehensive information including inputs, outputs, fee calculations, script details, and blockchain context. Supports both hex and base64 encoded transactions and automatically fetches additional on-chain data when available.",
126
- {
127
- args: decodeTransactionArgsSchema,
128
- },
126
+ decodeTransactionArgsSchema.shape,
129
127
  async (
130
- { args }: { args: DecodeTransactionArgs },
128
+ { tx, encoding },
131
129
  extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
132
130
  ) => {
133
131
  try {
134
- const { tx, encoding } = args;
135
132
  let transaction: Transaction;
136
133
  let rawTx: string;
137
134
  let txid: string;
@@ -131,10 +131,9 @@ export function registerExploreTool(server: McpServer): void {
131
131
  "NETWORK:\n" +
132
132
  "- health: API health check\n\n" +
133
133
  "Use the appropriate parameters for each endpoint type and specify 'main' or 'test' network.",
134
- { args: exploreArgsSchema },
135
- async ({ args }) => {
134
+ exploreArgsSchema.shape,
135
+ async (params) => {
136
136
  try {
137
- const params = exploreArgsSchema.parse(args);
138
137
 
139
138
  // Validate required parameters for specific endpoints
140
139
  if (
@@ -1,5 +1,4 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { z } from "zod";
3
2
 
4
3
  // Define cache duration (5 minutes in milliseconds)
5
4
  const PRICE_CACHE_DURATION = 5 * 60 * 1000;
@@ -53,14 +52,7 @@ export function registerGetPriceTool(server: McpServer): void {
53
52
  server.tool(
54
53
  "bsv_getPrice",
55
54
  "Retrieves the current price of Bitcoin SV (BSV) in USD from a reliable exchange API. This tool provides real-time market data that can be used for calculating transaction values, monitoring market conditions, or converting between BSV and fiat currencies.",
56
- {
57
- args: z
58
- .object({})
59
- .optional()
60
- .describe(
61
- "No parameters required - simply returns the current BSV price in USD",
62
- ),
63
- },
55
+ {},
64
56
  async () => {
65
57
  try {
66
58
  const price = await getBsvPriceWithCache();
@@ -17,14 +17,11 @@ export function registerTokenTools(server: McpServer): void {
17
17
  server.tool(
18
18
  "bsv_toSatoshi",
19
19
  {
20
- args: z.object({
21
- bitcoin: z.union([z.number(), z.string()]),
22
- returnType: z.enum(["number", "string", "bigint"]).optional(),
23
- }),
20
+ bitcoin: z.union([z.number(), z.string()]),
21
+ returnType: z.enum(["number", "string", "bigint"]).optional(),
24
22
  },
25
- async ({ args }) => {
23
+ async ({ bitcoin, returnType }) => {
26
24
  try {
27
- const { bitcoin, returnType } = args;
28
25
  let result: number | string | bigint;
29
26
 
30
27
  switch (returnType) {
@@ -49,14 +46,11 @@ export function registerTokenTools(server: McpServer): void {
49
46
  server.tool(
50
47
  "bsv_toBitcoin",
51
48
  {
52
- args: z.object({
53
- satoshis: z.union([z.number(), z.string(), z.bigint()]),
54
- returnType: z.enum(["number", "string", "bigint"]).optional(),
55
- }),
49
+ satoshis: z.union([z.number(), z.string(), z.bigint()]),
50
+ returnType: z.enum(["number", "string", "bigint"]).optional(),
56
51
  },
57
- async ({ args }) => {
52
+ async ({ satoshis, returnType }) => {
58
53
  try {
59
- const { satoshis, returnType } = args;
60
54
  let result: number | string | bigint;
61
55
 
62
56
  switch (returnType) {
@@ -93,15 +87,12 @@ export function registerTokenTools(server: McpServer): void {
93
87
  server.tool(
94
88
  "bsv_toTokenSatoshi",
95
89
  {
96
- args: z.object({
97
- token: z.union([z.number(), z.string(), z.bigint()]),
98
- decimals: z.number().int().min(0),
99
- returnType: z.enum(["number", "string", "bigint"]).optional(),
100
- }),
90
+ token: z.union([z.number(), z.string(), z.bigint()]),
91
+ decimals: z.number().int().min(0),
92
+ returnType: z.enum(["number", "string", "bigint"]).optional(),
101
93
  },
102
- async ({ args }) => {
94
+ async ({ token, decimals, returnType }) => {
103
95
  try {
104
- const { token, decimals, returnType } = args;
105
96
  let result: number | string | bigint;
106
97
 
107
98
  switch (returnType) {
@@ -126,15 +117,12 @@ export function registerTokenTools(server: McpServer): void {
126
117
  server.tool(
127
118
  "bsv_toToken",
128
119
  {
129
- args: z.object({
130
- tokenSatoshi: z.union([z.number(), z.string(), z.bigint()]),
131
- decimals: z.number().int().min(0),
132
- returnType: z.enum(["number", "string", "bigint"]).optional(),
133
- }),
120
+ tokenSatoshi: z.union([z.number(), z.string(), z.bigint()]),
121
+ decimals: z.number().int().min(0),
122
+ returnType: z.enum(["number", "string", "bigint"]).optional(),
134
123
  },
135
- async ({ args }) => {
124
+ async ({ tokenSatoshi, decimals, returnType }) => {
136
125
  try {
137
- const { tokenSatoshi, decimals, returnType } = args;
138
126
  let result: number | string | bigint;
139
127
 
140
128
  switch (returnType) {
package/tools/index.ts CHANGED
@@ -2,7 +2,6 @@ import type { PrivateKey } from "@bsv/sdk";
2
2
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
3
  import { registerA2bDiscoverTool } from "./a2b/discover";
4
4
  import { registerBapTools } from "./bap";
5
- // import { registerBigBlocksTools } from "./bigblocks"; // Disabled - Turbopack module resolution issues
6
5
  import { registerBsocialTools } from "./bsocial";
7
6
  import { registerBsvTools } from "./bsv";
8
7
  import { registerMneeTools } from "./mnee";
@@ -26,7 +25,6 @@ import type { Wallet } from "./wallet/wallet";
26
25
  * - enableBsocialTools: controlled by DISABLE_BSOCIAL_TOOLS
27
26
  * - enableWalletTools: controlled by DISABLE_WALLET_TOOLS
28
27
  * - enableMneeTools: controlled by DISABLE_MNEE_TOOLS
29
- * - enableBigBlocksTools: controlled by DISABLE_BIGBLOCKS_TOOLS
30
28
  */
31
29
  export interface ToolsConfig {
32
30
  enableBsvTools?: boolean;
@@ -37,7 +35,6 @@ export interface ToolsConfig {
37
35
  enableBsocialTools?: boolean;
38
36
  enableWalletTools?: boolean;
39
37
  enableMneeTools?: boolean;
40
- enableBigBlocksTools?: boolean;
41
38
  identityPk?: PrivateKey;
42
39
  payPk?: PrivateKey;
43
40
  xprv?: string;
@@ -77,10 +74,6 @@ export function registerAllTools(
77
74
  const enableBsocialTools =
78
75
  process.env.DISABLE_BSOCIAL_TOOLS !== "true" &&
79
76
  config.enableBsocialTools !== false;
80
- const enableBigBlocksTools =
81
- process.env.DISABLE_BIGBLOCKS_TOOLS !== "true" &&
82
- config.enableBigBlocksTools !== false;
83
-
84
77
  // Register BSV-related tools
85
78
  if (enableBsvTools) {
86
79
  registerBsvTools(server);
@@ -117,12 +110,6 @@ export function registerAllTools(
117
110
  registerBsocialTools(server, { wallet: config.wallet });
118
111
  }
119
112
 
120
- // Register BigBlocks tools
121
- // Disabled - Turbopack module resolution issues
122
- // if (enableBigBlocksTools) {
123
- // registerBigBlocksTools(server);
124
- // }
125
-
126
113
  // Register Wallet tools themselves
127
114
  if (enableWalletTools) {
128
115
  if (config.integratedWallet?.isDropletMode) {
@@ -19,11 +19,9 @@ export function registerGetBalanceTool(
19
19
  server.tool(
20
20
  "mnee_getBalance",
21
21
  "Retrieves the current MNEE token balance for the wallet. Returns the balance in MNEE tokens.",
22
- {
23
- args: getBalanceArgsSchema,
24
- },
22
+ {},
25
23
  async (
26
- { args }: { args: GetBalanceArgs },
24
+ _params,
27
25
  extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
28
26
  ) => {
29
27
  try {
@@ -24,13 +24,13 @@ export function registerParseTxTool(
24
24
  server.tool(
25
25
  "mnee_parseTx",
26
26
  "Parse an MNEE transaction to get detailed information about its operations and amounts. All amounts are in atomic units with 5 decimal precision (e.g. 1000 atomic units = 0.01 MNEE).",
27
- { args: parseTxArgsSchema },
27
+ { ...parseTxArgsSchema.shape },
28
28
  async (
29
- { args }: { args: ParseTxArgs },
29
+ { txid },
30
30
  extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
31
31
  ): Promise<CallToolResult> => {
32
32
  try {
33
- const result: ParseTxResponse = await mnee.parseTx(args.txid);
33
+ const result: ParseTxResponse = await mnee.parseTx(txid);
34
34
 
35
35
  return {
36
36
  content: [
@@ -42,18 +42,18 @@ export function registerSendMneeTool(server: McpServer, mnee: Mnee): void {
42
42
  server.tool(
43
43
  "mnee_sendMnee",
44
44
  "Send MNEE tokens to a specified address",
45
- { args: sendMneeArgsSchema },
45
+ { ...sendMneeArgsSchema.shape },
46
46
  async (
47
- { args }: { args: SendMneeArgs },
47
+ { address, amount, currency },
48
48
  extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
49
49
  ): Promise<CallToolResult> => {
50
50
  try {
51
51
  // Since 1 MNEE = $1, the amount is the same in both currencies
52
- const mneeAmount = args.amount;
52
+ const mneeAmount = amount;
53
53
 
54
54
  const transferRequest: SendMNEE[] = [
55
55
  {
56
- address: args.address,
56
+ address,
57
57
  amount: mneeAmount,
58
58
  },
59
59
  ];
@@ -101,7 +101,7 @@ export function registerSendMneeTool(server: McpServer, mnee: Mnee): void {
101
101
  rawtx: result.rawtx,
102
102
  mneeAmount: mneeAmount,
103
103
  usdAmount: formatUSD(mneeAmount),
104
- recipient: args.address,
104
+ recipient: address,
105
105
  },
106
106
  null,
107
107
  2,
@@ -42,14 +42,13 @@ export function registerGetInscriptionTool(server: McpServer): void {
42
42
  "ordinals_getInscription",
43
43
  "Retrieves detailed information about a specific ordinal inscription by its outpoint. Returns complete inscription data including content type, file information, inscription origin, and current status. Useful for verifying NFT authenticity or retrieving metadata about digital artifacts.",
44
44
  {
45
- args: getInscriptionArgsSchema,
45
+ ...getInscriptionArgsSchema.shape,
46
46
  },
47
47
  async (
48
- { args }: { args: GetInscriptionArgs },
48
+ { outpoint },
49
49
  extra: RequestHandlerExtra,
50
50
  ) => {
51
51
  try {
52
- const { outpoint } = args;
53
52
 
54
53
  // Validate outpoint format
55
54
  if (!/^[0-9a-f]{64}_\d+$/i.test(outpoint)) {
@@ -43,14 +43,17 @@ export function registerGetTokenByIdOrTickerTool(server: McpServer): void {
43
43
  "ordinals_getTokenByIdOrTicker",
44
44
  "Retrieves detailed information about a specific BSV-20 token by its ID or ticker symbol. Returns complete token data including ticker symbol, supply information, decimals, and current status. This tool is useful for verifying token authenticity or checking supply metrics.",
45
45
  {
46
- args: getTokenByIdOrTickerArgsSchema,
46
+ id: z
47
+ .string()
48
+ .optional()
49
+ .describe("BSV20 token ID in outpoint format (txid_vout)"),
50
+ tick: z.string().optional().describe("BSV20 token ticker symbol"),
47
51
  },
48
52
  async (
49
- { args }: { args: GetTokenByIdOrTickerArgs },
53
+ { id, tick },
50
54
  extra: RequestHandlerExtra,
51
55
  ) => {
52
56
  try {
53
- const { id, tick } = args;
54
57
 
55
58
  // Validate that at least one of id or tick is provided
56
59
  if (!id && !tick) {
@@ -95,29 +95,13 @@ export function registerMarketListingsTool(server: McpServer): void {
95
95
  "ordinals_marketListings",
96
96
  "Retrieves current marketplace listings for Bitcoin SV ordinals with flexible filtering. Supports multiple asset types (NFTs, BSV-20 tokens, BSV-21 tokens) through a unified interface. Results include listing prices, details about the assets, and seller information.",
97
97
  {
98
- args: marketListingsArgsSchema,
98
+ ...marketListingsArgsSchema.shape,
99
99
  },
100
100
  async (
101
- { args }: { args: MarketListingsArgs },
101
+ { limit, offset, sort, dir, address, origin, mime, num, minPrice, maxPrice, tokenType, id, tick, pending },
102
102
  extra: RequestHandlerExtra,
103
103
  ) => {
104
104
  try {
105
- const {
106
- limit,
107
- offset,
108
- sort,
109
- dir,
110
- address,
111
- origin,
112
- mime,
113
- num,
114
- minPrice,
115
- maxPrice,
116
- tokenType,
117
- id,
118
- tick,
119
- pending,
120
- } = args;
121
105
 
122
106
  // Determine the API endpoint based on tokenType
123
107
  let baseUrl = "https://ordinals.gorillapool.io/api";
@@ -73,12 +73,10 @@ export function registerMarketSalesTool(server: McpServer): void {
73
73
  "ordinals_marketSales",
74
74
  "Retrieves recent sales data for BSV-20 and BSV-21 tokens on the ordinals marketplace. This tool provides insights into market activity, including sale prices, transaction details, and token information. Supports filtering by token ID, ticker symbol, or seller address to help analyze market trends and track specific token sales.",
75
75
  {
76
- args: marketSalesArgsSchema,
76
+ ...marketSalesArgsSchema.shape,
77
77
  },
78
- async ({ args }: { args: MarketSalesArgs }, extra: RequestHandlerExtra) => {
78
+ async ({ limit, offset, dir, tokenType, id, tick, pending, address }, extra: RequestHandlerExtra) => {
79
79
  try {
80
- const { limit, offset, dir, tokenType, id, tick, pending, address } =
81
- args;
82
80
 
83
81
  // Determine the API endpoint based on tokenType
84
82
  let baseUrl = "https://ordinals.gorillapool.io/api";
@@ -59,15 +59,13 @@ export function registerSearchInscriptionsTool(server: McpServer): void {
59
59
  "ordinals_searchInscriptions",
60
60
  "Searches for Bitcoin SV ordinal inscriptions using flexible criteria. This powerful search tool supports filtering by address, inscription content, MIME type, MAP fields, and other parameters. Results include detailed information about each matched inscription. Ideal for discovering NFTs and exploring the ordinals ecosystem.",
61
61
  {
62
- args: searchInscriptionsArgsSchema,
62
+ ...searchInscriptionsArgsSchema.shape,
63
63
  },
64
64
  async (
65
- { args }: { args: SearchInscriptionsArgs },
65
+ { limit, offset, dir, num, origin, address, map, terms, mime },
66
66
  extra: RequestHandlerExtra,
67
67
  ) => {
68
68
  try {
69
- const { limit, offset, dir, num, origin, address, map, terms, mime } =
70
- args;
71
69
 
72
70
  // Build the URL with query parameters
73
71
  const url = new URL(
@@ -14,10 +14,10 @@ export function registerUtilsTools(server: McpServer): void {
14
14
  server.tool(
15
15
  installAgentMasterTool.name,
16
16
  installAgentMasterTool.description,
17
- { args: installAgentMasterTool.inputSchema },
18
- async ({ args }) => {
17
+ { ...installAgentMasterTool.inputSchema.shape },
18
+ async (params) => {
19
19
  try {
20
- const result = await installAgentMasterTool.handler(args);
20
+ const result = await installAgentMasterTool.handler(params);
21
21
  return {
22
22
  content: [
23
23
  {
@@ -62,22 +62,20 @@ export function registerUtilsTools(server: McpServer): void {
62
62
  "- The tool returns the converted data as a string\n" +
63
63
  "- For binary conversion, data is represented as an array of byte values",
64
64
  {
65
- args: z.object({
66
- data: z.string().describe("The data string to be converted"),
67
- from: encodingSchema.describe(
68
- "Source encoding format (utf8, hex, base64, or binary)",
69
- ),
70
- to: encodingSchema.describe(
71
- "Target encoding format to convert to (utf8, hex, base64, or binary)",
72
- ),
73
- }),
65
+ data: z.string().describe("The data string to be converted"),
66
+ from: encodingSchema.describe(
67
+ "Source encoding format (utf8, hex, base64, or binary)",
68
+ ),
69
+ to: encodingSchema.describe(
70
+ "Target encoding format to convert to (utf8, hex, base64, or binary)",
71
+ ),
74
72
  },
75
- async ({ args }) => {
73
+ async ({ data, from, to }) => {
76
74
  try {
77
75
  const result = convertData({
78
- data: args.data,
79
- from: args.from,
80
- to: args.to,
76
+ data,
77
+ from,
78
+ to,
81
79
  });
82
80
  return {
83
81
  content: [
@@ -1,10 +1,5 @@
1
1
  import { PrivateKey, Utils } from "@bsv/sdk";
2
2
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
- import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
4
- import type {
5
- ServerNotification,
6
- ServerRequest,
7
- } from "@modelcontextprotocol/sdk/types.js";
8
3
  import type {
9
4
  ChangeResult,
10
5
  CreateOrdinalsConfig,
@@ -14,7 +9,6 @@ import type {
14
9
  PreMAP,
15
10
  } from "js-1sat-ord";
16
11
  import { createOrdinals } from "js-1sat-ord";
17
- import { Sigma } from "sigma-protocol";
18
12
  import { z } from "zod";
19
13
  import packageJson from "../../package.json";
20
14
  import { V5Broadcaster } from "../../utils/broadcaster";
@@ -155,11 +149,8 @@ export function registerA2bPublishAgentTool(server: McpServer, wallet: Wallet) {
155
149
  server.tool(
156
150
  "wallet_a2bPublish",
157
151
  "Publish an agent.json record on-chain via Ordinal inscription",
158
- { args: a2bPublishArgsSchema },
159
- async (
160
- { args }: { args: A2bPublishArgs },
161
- extra: RequestHandlerExtra<ServerRequest, ServerNotification>,
162
- ) => {
152
+ { ...a2bPublishArgsSchema.shape },
153
+ async ({ agentUrl, agentName, description, providerOrganization, providerUrl, version, documentationUrl, streaming, pushNotifications, stateTransitionHistory, defaultInputModes, defaultOutputModes, skills, destinationAddress }) => {
163
154
  try {
164
155
  const paymentPk = wallet.getPaymentKey();
165
156
  if (!paymentPk) throw new Error("No private key available");
@@ -167,7 +158,7 @@ export function registerA2bPublishAgentTool(server: McpServer, wallet: Wallet) {
167
158
  if (!paymentUtxos?.length)
168
159
  throw new Error("No payment UTXOs available to fund inscription");
169
160
 
170
- // TODO: Get the skills from actually running the MCP instead of trusting the agent args for args.skills
161
+ // TODO: Get the skills from actually running the MCP instead of trusting the agent args for skills
171
162
  const walletAddress = paymentPk.toAddress().toString();
172
163
 
173
164
  // Create pricing plans using the new schema
@@ -212,27 +203,27 @@ export function registerA2bPublishAgentTool(server: McpServer, wallet: Wallet) {
212
203
 
213
204
  // Assemble AgentCard with defaults and user overrides
214
205
  const agentCard = {
215
- name: args.agentName,
216
- description: args.description ?? null,
217
- url: args.agentUrl,
206
+ name: agentName,
207
+ description: description ?? null,
208
+ url: agentUrl,
218
209
  provider:
219
- args.providerOrganization && args.providerUrl
210
+ providerOrganization && providerUrl
220
211
  ? {
221
- organization: args.providerOrganization,
222
- url: args.providerUrl,
212
+ organization: providerOrganization,
213
+ url: providerUrl,
223
214
  }
224
215
  : null,
225
- version: args.version ?? packageJson.version,
226
- documentationUrl: args.documentationUrl ?? null,
216
+ version: version ?? packageJson.version,
217
+ documentationUrl: documentationUrl ?? null,
227
218
  capabilities: {
228
- streaming: args.streaming,
229
- pushNotifications: args.pushNotifications,
230
- stateTransitionHistory: args.stateTransitionHistory,
219
+ streaming,
220
+ pushNotifications,
221
+ stateTransitionHistory,
231
222
  },
232
223
  authentication: null,
233
- defaultInputModes: args.defaultInputModes,
234
- defaultOutputModes: args.defaultOutputModes,
235
- skills: args.skills,
224
+ defaultInputModes,
225
+ defaultOutputModes,
226
+ skills,
236
227
  "x-payment-config": pricingConfig,
237
228
  };
238
229
  // Validate compliance
@@ -245,7 +236,7 @@ export function registerA2bPublishAgentTool(server: McpServer, wallet: Wallet) {
245
236
  contentType: "application/json",
246
237
  };
247
238
  // Destination for the ordinal
248
- const targetAddress = args.destinationAddress ?? walletAddress;
239
+ const targetAddress = destinationAddress ?? walletAddress;
249
240
  const destinations: Destination[] = [
250
241
  { address: targetAddress, inscription },
251
242
  ];