@iqai/adk 0.1.2 → 0.1.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @iqai/adk
2
2
 
3
+ ## 0.1.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 5e68c31: Adds sampling handler for mcp-simplified-syntax
8
+
9
+ ## 0.1.3
10
+
11
+ ### Patch Changes
12
+
13
+ - f1cb8d4: Allow mcp interface to allow parameters optional
14
+
3
15
  ## 0.1.2
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1500,6 +1500,38 @@ declare function createSamplingHandler(handler: SamplingHandler): SamplingHandle
1500
1500
  * tools: [...atpTools, ...fraxlendTools],
1501
1501
  * });
1502
1502
  * ```
1503
+ *
1504
+ * @example
1505
+ * ```typescript
1506
+ * // Using MCP servers with sampling handlers:
1507
+ * import { createSamplingHandler, LlmResponse } from "@iqai/adk";
1508
+ *
1509
+ * const samplingHandler = createSamplingHandler(async (request) => {
1510
+ * // Handle MCP sampling requests
1511
+ * return new LlmResponse({
1512
+ * content: {
1513
+ * role: "model",
1514
+ * parts: [{ text: "Response from sampling handler" }],
1515
+ * },
1516
+ * });
1517
+ * });
1518
+ *
1519
+ * const nearTools = await McpNearAgent({
1520
+ * env: {
1521
+ * ACCOUNT_ID: env.ACCOUNT_ID,
1522
+ * ACCOUNT_KEY: env.ACCOUNT_KEY,
1523
+ * NEAR_NETWORK_ID: "testnet",
1524
+ * PATH: env.PATH
1525
+ * },
1526
+ * samplingHandler
1527
+ * }).getTools();
1528
+ *
1529
+ * const agent = new LlmAgent({
1530
+ * name: "near_assistant",
1531
+ * model: "gemini-2.5-flash",
1532
+ * tools: nearTools,
1533
+ * });
1534
+ * ```
1503
1535
  */
1504
1536
  /**
1505
1537
  * Base configuration interface for MCP servers
@@ -1516,6 +1548,8 @@ interface McpServerConfig {
1516
1548
  maxRetries?: number;
1517
1549
  initialDelay?: number;
1518
1550
  };
1551
+ /** Sampling handler for processing MCP sampling requests */
1552
+ samplingHandler?: SamplingHandler;
1519
1553
  }
1520
1554
  /**
1521
1555
  * MCP ABI - Smart contract ABI interactions for Ethereum-compatible blockchains
@@ -1523,25 +1557,25 @@ interface McpServerConfig {
1523
1557
  * Required env vars: CONTRACT_ABI, CONTRACT_ADDRESS
1524
1558
  * Optional env vars: CONTRACT_NAME, CHAIN_ID, RPC_URL, WALLET_PRIVATE_KEY
1525
1559
  */
1526
- declare function McpAbi(config: McpServerConfig): McpToolset;
1560
+ declare function McpAbi(config?: McpServerConfig): McpToolset;
1527
1561
  /**
1528
1562
  * MCP ATP - Interact with the IQ AI Agent Tokenization Platform
1529
1563
  *
1530
1564
  * Required env vars: ATP_WALLET_PRIVATE_KEY, ATP_API_KEY
1531
1565
  */
1532
- declare function McpAtp(config: McpServerConfig): McpToolset;
1566
+ declare function McpAtp(config?: McpServerConfig): McpToolset;
1533
1567
  /**
1534
1568
  * MCP BAMM - Borrow Automated Market Maker operations on Fraxtal
1535
1569
  *
1536
1570
  * Required env vars: WALLET_PRIVATE_KEY
1537
1571
  */
1538
- declare function McpBamm(config: McpServerConfig): McpToolset;
1572
+ declare function McpBamm(config?: McpServerConfig): McpToolset;
1539
1573
  /**
1540
1574
  * MCP FRAXLEND - Interact with the Fraxlend lending platform
1541
1575
  *
1542
1576
  * Required env vars: WALLET_PRIVATE_KEY
1543
1577
  */
1544
- declare function McpFraxlend(config: McpServerConfig): McpToolset;
1578
+ declare function McpFraxlend(config?: McpServerConfig): McpToolset;
1545
1579
  /**
1546
1580
  * MCP IQWiki - Access and manage IQ.wiki data and user activities
1547
1581
  *
@@ -1554,26 +1588,26 @@ declare function McpIqWiki(config?: McpServerConfig): McpToolset;
1554
1588
  * Required env vars: ACCOUNT_ID, ACCOUNT_KEY
1555
1589
  * Optional env vars: NEAR_NETWORK_ID, NEAR_NODE_URL, NEAR_GAS_LIMIT
1556
1590
  */
1557
- declare function McpNearAgent(config: McpServerConfig): McpToolset;
1591
+ declare function McpNearAgent(config?: McpServerConfig): McpToolset;
1558
1592
  /**
1559
1593
  * MCP NEAR Intent Swaps - NEAR Protocol intent swaps functionality
1560
1594
  *
1561
1595
  * Required env vars: ACCOUNT_ID, ACCOUNT_KEY
1562
1596
  * Optional env vars: NEAR_NETWORK_ID, NEAR_NODE_URL, NEAR_GAS_LIMIT
1563
1597
  */
1564
- declare function McpNearIntentSwaps(config: McpServerConfig): McpToolset;
1598
+ declare function McpNearIntentSwaps(config?: McpServerConfig): McpToolset;
1565
1599
  /**
1566
1600
  * MCP ODOS - Interact with decentralized exchanges through ODOS aggregation
1567
1601
  *
1568
1602
  * Required env vars: WALLET_PRIVATE_KEY
1569
1603
  */
1570
- declare function McpOdos(config: McpServerConfig): McpToolset;
1604
+ declare function McpOdos(config?: McpServerConfig): McpToolset;
1571
1605
  /**
1572
1606
  * MCP Telegram - Interact with Telegram bots and channels
1573
1607
  *
1574
1608
  * Required env vars: TELEGRAM_BOT_TOKEN
1575
1609
  */
1576
- declare function McpTelegram(config: McpServerConfig): McpToolset;
1610
+ declare function McpTelegram(config?: McpServerConfig): McpToolset;
1577
1611
  /**
1578
1612
  * Popular third-party MCP servers
1579
1613
  * These can be added as we expand support for community MCP servers
@@ -1594,7 +1628,7 @@ declare function McpMemory(config?: McpServerConfig): McpToolset;
1594
1628
  * Generic MCP server function for any package
1595
1629
  *
1596
1630
  * @param packageName The npm package name of the MCP server
1597
- * @param config Configuration object with environment variables
1631
+ * @param config Configuration object with environment variables and optional sampling handler
1598
1632
  * @param name Optional custom name for the client
1599
1633
  */
1600
1634
  declare function McpGeneric(packageName: string, config?: McpServerConfig, name?: string): McpToolset;
package/dist/index.d.ts CHANGED
@@ -1500,6 +1500,38 @@ declare function createSamplingHandler(handler: SamplingHandler): SamplingHandle
1500
1500
  * tools: [...atpTools, ...fraxlendTools],
1501
1501
  * });
1502
1502
  * ```
1503
+ *
1504
+ * @example
1505
+ * ```typescript
1506
+ * // Using MCP servers with sampling handlers:
1507
+ * import { createSamplingHandler, LlmResponse } from "@iqai/adk";
1508
+ *
1509
+ * const samplingHandler = createSamplingHandler(async (request) => {
1510
+ * // Handle MCP sampling requests
1511
+ * return new LlmResponse({
1512
+ * content: {
1513
+ * role: "model",
1514
+ * parts: [{ text: "Response from sampling handler" }],
1515
+ * },
1516
+ * });
1517
+ * });
1518
+ *
1519
+ * const nearTools = await McpNearAgent({
1520
+ * env: {
1521
+ * ACCOUNT_ID: env.ACCOUNT_ID,
1522
+ * ACCOUNT_KEY: env.ACCOUNT_KEY,
1523
+ * NEAR_NETWORK_ID: "testnet",
1524
+ * PATH: env.PATH
1525
+ * },
1526
+ * samplingHandler
1527
+ * }).getTools();
1528
+ *
1529
+ * const agent = new LlmAgent({
1530
+ * name: "near_assistant",
1531
+ * model: "gemini-2.5-flash",
1532
+ * tools: nearTools,
1533
+ * });
1534
+ * ```
1503
1535
  */
1504
1536
  /**
1505
1537
  * Base configuration interface for MCP servers
@@ -1516,6 +1548,8 @@ interface McpServerConfig {
1516
1548
  maxRetries?: number;
1517
1549
  initialDelay?: number;
1518
1550
  };
1551
+ /** Sampling handler for processing MCP sampling requests */
1552
+ samplingHandler?: SamplingHandler;
1519
1553
  }
1520
1554
  /**
1521
1555
  * MCP ABI - Smart contract ABI interactions for Ethereum-compatible blockchains
@@ -1523,25 +1557,25 @@ interface McpServerConfig {
1523
1557
  * Required env vars: CONTRACT_ABI, CONTRACT_ADDRESS
1524
1558
  * Optional env vars: CONTRACT_NAME, CHAIN_ID, RPC_URL, WALLET_PRIVATE_KEY
1525
1559
  */
1526
- declare function McpAbi(config: McpServerConfig): McpToolset;
1560
+ declare function McpAbi(config?: McpServerConfig): McpToolset;
1527
1561
  /**
1528
1562
  * MCP ATP - Interact with the IQ AI Agent Tokenization Platform
1529
1563
  *
1530
1564
  * Required env vars: ATP_WALLET_PRIVATE_KEY, ATP_API_KEY
1531
1565
  */
1532
- declare function McpAtp(config: McpServerConfig): McpToolset;
1566
+ declare function McpAtp(config?: McpServerConfig): McpToolset;
1533
1567
  /**
1534
1568
  * MCP BAMM - Borrow Automated Market Maker operations on Fraxtal
1535
1569
  *
1536
1570
  * Required env vars: WALLET_PRIVATE_KEY
1537
1571
  */
1538
- declare function McpBamm(config: McpServerConfig): McpToolset;
1572
+ declare function McpBamm(config?: McpServerConfig): McpToolset;
1539
1573
  /**
1540
1574
  * MCP FRAXLEND - Interact with the Fraxlend lending platform
1541
1575
  *
1542
1576
  * Required env vars: WALLET_PRIVATE_KEY
1543
1577
  */
1544
- declare function McpFraxlend(config: McpServerConfig): McpToolset;
1578
+ declare function McpFraxlend(config?: McpServerConfig): McpToolset;
1545
1579
  /**
1546
1580
  * MCP IQWiki - Access and manage IQ.wiki data and user activities
1547
1581
  *
@@ -1554,26 +1588,26 @@ declare function McpIqWiki(config?: McpServerConfig): McpToolset;
1554
1588
  * Required env vars: ACCOUNT_ID, ACCOUNT_KEY
1555
1589
  * Optional env vars: NEAR_NETWORK_ID, NEAR_NODE_URL, NEAR_GAS_LIMIT
1556
1590
  */
1557
- declare function McpNearAgent(config: McpServerConfig): McpToolset;
1591
+ declare function McpNearAgent(config?: McpServerConfig): McpToolset;
1558
1592
  /**
1559
1593
  * MCP NEAR Intent Swaps - NEAR Protocol intent swaps functionality
1560
1594
  *
1561
1595
  * Required env vars: ACCOUNT_ID, ACCOUNT_KEY
1562
1596
  * Optional env vars: NEAR_NETWORK_ID, NEAR_NODE_URL, NEAR_GAS_LIMIT
1563
1597
  */
1564
- declare function McpNearIntentSwaps(config: McpServerConfig): McpToolset;
1598
+ declare function McpNearIntentSwaps(config?: McpServerConfig): McpToolset;
1565
1599
  /**
1566
1600
  * MCP ODOS - Interact with decentralized exchanges through ODOS aggregation
1567
1601
  *
1568
1602
  * Required env vars: WALLET_PRIVATE_KEY
1569
1603
  */
1570
- declare function McpOdos(config: McpServerConfig): McpToolset;
1604
+ declare function McpOdos(config?: McpServerConfig): McpToolset;
1571
1605
  /**
1572
1606
  * MCP Telegram - Interact with Telegram bots and channels
1573
1607
  *
1574
1608
  * Required env vars: TELEGRAM_BOT_TOKEN
1575
1609
  */
1576
- declare function McpTelegram(config: McpServerConfig): McpToolset;
1610
+ declare function McpTelegram(config?: McpServerConfig): McpToolset;
1577
1611
  /**
1578
1612
  * Popular third-party MCP servers
1579
1613
  * These can be added as we expand support for community MCP servers
@@ -1594,7 +1628,7 @@ declare function McpMemory(config?: McpServerConfig): McpToolset;
1594
1628
  * Generic MCP server function for any package
1595
1629
  *
1596
1630
  * @param packageName The npm package name of the MCP server
1597
- * @param config Configuration object with environment variables
1631
+ * @param config Configuration object with environment variables and optional sampling handler
1598
1632
  * @param name Optional custom name for the client
1599
1633
  */
1600
1634
  declare function McpGeneric(packageName: string, config?: McpServerConfig, name?: string): McpToolset;
package/dist/index.js CHANGED
@@ -5176,8 +5176,14 @@ var McpToolAdapter = (_class18 = class extends BaseTool {
5176
5176
  }, _class18);
5177
5177
 
5178
5178
  // src/tools/mcp/servers.ts
5179
- function createMcpConfig(name, packageName, config) {
5180
- const { debug, description, retryOptions, env: envVars = {} } = config;
5179
+ function createMcpConfig(name, packageName, config = {}) {
5180
+ const {
5181
+ debug,
5182
+ description,
5183
+ retryOptions,
5184
+ env: envVars = {},
5185
+ samplingHandler
5186
+ } = config;
5181
5187
  const env = {};
5182
5188
  for (const [key, value] of Object.entries(envVars)) {
5183
5189
  if (value !== void 0) {
@@ -5197,18 +5203,19 @@ function createMcpConfig(name, packageName, config) {
5197
5203
  command: "npx",
5198
5204
  args: ["-y", packageName],
5199
5205
  env
5200
- }
5206
+ },
5207
+ samplingHandler
5201
5208
  };
5202
5209
  }
5203
- function McpAbi(config) {
5210
+ function McpAbi(config = {}) {
5204
5211
  const mcpConfig = createMcpConfig("ABI MCP Client", "@iqai/mcp-abi", config);
5205
5212
  return new McpToolset(mcpConfig);
5206
5213
  }
5207
- function McpAtp(config) {
5214
+ function McpAtp(config = {}) {
5208
5215
  const mcpConfig = createMcpConfig("ATP MCP Client", "@iqai/mcp-atp", config);
5209
5216
  return new McpToolset(mcpConfig);
5210
5217
  }
5211
- function McpBamm(config) {
5218
+ function McpBamm(config = {}) {
5212
5219
  const mcpConfig = createMcpConfig(
5213
5220
  "BAMM MCP Client",
5214
5221
  "@iqai/mcp-bamm",
@@ -5216,7 +5223,7 @@ function McpBamm(config) {
5216
5223
  );
5217
5224
  return new McpToolset(mcpConfig);
5218
5225
  }
5219
- function McpFraxlend(config) {
5226
+ function McpFraxlend(config = {}) {
5220
5227
  const mcpConfig = createMcpConfig(
5221
5228
  "Fraxlend MCP Client",
5222
5229
  "@iqai/mcp-fraxlend",
@@ -5232,7 +5239,7 @@ function McpIqWiki(config = {}) {
5232
5239
  );
5233
5240
  return new McpToolset(mcpConfig);
5234
5241
  }
5235
- function McpNearAgent(config) {
5242
+ function McpNearAgent(config = {}) {
5236
5243
  const mcpConfig = createMcpConfig(
5237
5244
  "NEAR Agent MCP Client",
5238
5245
  "@iqai/mcp-near-agent",
@@ -5240,7 +5247,7 @@ function McpNearAgent(config) {
5240
5247
  );
5241
5248
  return new McpToolset(mcpConfig);
5242
5249
  }
5243
- function McpNearIntentSwaps(config) {
5250
+ function McpNearIntentSwaps(config = {}) {
5244
5251
  const mcpConfig = createMcpConfig(
5245
5252
  "NEAR Intent Swaps MCP Client",
5246
5253
  "@iqai/mcp-near-intent-swaps",
@@ -5248,7 +5255,7 @@ function McpNearIntentSwaps(config) {
5248
5255
  );
5249
5256
  return new McpToolset(mcpConfig);
5250
5257
  }
5251
- function McpOdos(config) {
5258
+ function McpOdos(config = {}) {
5252
5259
  const mcpConfig = createMcpConfig(
5253
5260
  "ODOS MCP Client",
5254
5261
  "@iqai/mcp-odos",
@@ -5256,7 +5263,7 @@ function McpOdos(config) {
5256
5263
  );
5257
5264
  return new McpToolset(mcpConfig);
5258
5265
  }
5259
- function McpTelegram(config) {
5266
+ function McpTelegram(config = {}) {
5260
5267
  const mcpConfig = createMcpConfig(
5261
5268
  "Telegram MCP Client",
5262
5269
  "@iqai/mcp-telegram",
package/dist/index.mjs CHANGED
@@ -5176,8 +5176,14 @@ var McpToolAdapter = class extends BaseTool {
5176
5176
  };
5177
5177
 
5178
5178
  // src/tools/mcp/servers.ts
5179
- function createMcpConfig(name, packageName, config) {
5180
- const { debug, description, retryOptions, env: envVars = {} } = config;
5179
+ function createMcpConfig(name, packageName, config = {}) {
5180
+ const {
5181
+ debug,
5182
+ description,
5183
+ retryOptions,
5184
+ env: envVars = {},
5185
+ samplingHandler
5186
+ } = config;
5181
5187
  const env = {};
5182
5188
  for (const [key, value] of Object.entries(envVars)) {
5183
5189
  if (value !== void 0) {
@@ -5197,18 +5203,19 @@ function createMcpConfig(name, packageName, config) {
5197
5203
  command: "npx",
5198
5204
  args: ["-y", packageName],
5199
5205
  env
5200
- }
5206
+ },
5207
+ samplingHandler
5201
5208
  };
5202
5209
  }
5203
- function McpAbi(config) {
5210
+ function McpAbi(config = {}) {
5204
5211
  const mcpConfig = createMcpConfig("ABI MCP Client", "@iqai/mcp-abi", config);
5205
5212
  return new McpToolset(mcpConfig);
5206
5213
  }
5207
- function McpAtp(config) {
5214
+ function McpAtp(config = {}) {
5208
5215
  const mcpConfig = createMcpConfig("ATP MCP Client", "@iqai/mcp-atp", config);
5209
5216
  return new McpToolset(mcpConfig);
5210
5217
  }
5211
- function McpBamm(config) {
5218
+ function McpBamm(config = {}) {
5212
5219
  const mcpConfig = createMcpConfig(
5213
5220
  "BAMM MCP Client",
5214
5221
  "@iqai/mcp-bamm",
@@ -5216,7 +5223,7 @@ function McpBamm(config) {
5216
5223
  );
5217
5224
  return new McpToolset(mcpConfig);
5218
5225
  }
5219
- function McpFraxlend(config) {
5226
+ function McpFraxlend(config = {}) {
5220
5227
  const mcpConfig = createMcpConfig(
5221
5228
  "Fraxlend MCP Client",
5222
5229
  "@iqai/mcp-fraxlend",
@@ -5232,7 +5239,7 @@ function McpIqWiki(config = {}) {
5232
5239
  );
5233
5240
  return new McpToolset(mcpConfig);
5234
5241
  }
5235
- function McpNearAgent(config) {
5242
+ function McpNearAgent(config = {}) {
5236
5243
  const mcpConfig = createMcpConfig(
5237
5244
  "NEAR Agent MCP Client",
5238
5245
  "@iqai/mcp-near-agent",
@@ -5240,7 +5247,7 @@ function McpNearAgent(config) {
5240
5247
  );
5241
5248
  return new McpToolset(mcpConfig);
5242
5249
  }
5243
- function McpNearIntentSwaps(config) {
5250
+ function McpNearIntentSwaps(config = {}) {
5244
5251
  const mcpConfig = createMcpConfig(
5245
5252
  "NEAR Intent Swaps MCP Client",
5246
5253
  "@iqai/mcp-near-intent-swaps",
@@ -5248,7 +5255,7 @@ function McpNearIntentSwaps(config) {
5248
5255
  );
5249
5256
  return new McpToolset(mcpConfig);
5250
5257
  }
5251
- function McpOdos(config) {
5258
+ function McpOdos(config = {}) {
5252
5259
  const mcpConfig = createMcpConfig(
5253
5260
  "ODOS MCP Client",
5254
5261
  "@iqai/mcp-odos",
@@ -5256,7 +5263,7 @@ function McpOdos(config) {
5256
5263
  );
5257
5264
  return new McpToolset(mcpConfig);
5258
5265
  }
5259
- function McpTelegram(config) {
5266
+ function McpTelegram(config = {}) {
5260
5267
  const mcpConfig = createMcpConfig(
5261
5268
  "Telegram MCP Client",
5262
5269
  "@iqai/mcp-telegram",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iqai/adk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Agent Development Kit for TypeScript with multi-provider LLM support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",