chat-agent-toolkit 1.2.125 → 1.2.127

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.
@@ -9,4 +9,5 @@
9
9
  * @author ai-research-agent contributors
10
10
  */
11
11
  export { AGENT_TOOLS } from './qwksearch-api-tools';
12
+ export { QwkSearchMCPSession, getQwkSearchTools } from './qwksearch-mcp-tools';
12
13
  export * from './search';
@@ -0,0 +1,26 @@
1
+ import { ToolSet } from 'ai';
2
+ export interface QwkSearchMCPConfig {
3
+ command?: string;
4
+ args?: string[];
5
+ env?: Record<string, string>;
6
+ }
7
+ /**
8
+ * Long-lived MCP session for QwkSearch tools.
9
+ * Spawns a local MCP server process and keeps it alive across tool calls.
10
+ */
11
+ export declare class QwkSearchMCPSession {
12
+ private client;
13
+ private config;
14
+ constructor(config?: QwkSearchMCPConfig);
15
+ getTools(): Promise<ToolSet>;
16
+ close(): Promise<void>;
17
+ }
18
+ /**
19
+ * One-shot helper to get QwkSearch MCP tools.
20
+ * Creates a session, fetches tools, and returns them.
21
+ * Caller should close the returned session when done.
22
+ */
23
+ export declare function getQwkSearchTools(config?: QwkSearchMCPConfig): Promise<{
24
+ tools: ToolSet;
25
+ session: QwkSearchMCPSession;
26
+ }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chat-agent-toolkit",
3
- "version": "1.2.125",
3
+ "version": "1.2.127",
4
4
  "description": "Multi-provider AI agent toolkit: generate language responses, search the web, extract content, and manage memory across 10+ LLM providers.",
5
5
  "author": "vtempest <grokthiscontact@gmail.com>",
6
6
  "license": "rights.institute/PROSPER",
@@ -10,4 +10,5 @@
10
10
  */
11
11
 
12
12
  export { AGENT_TOOLS } from "./qwksearch-api-tools";
13
+ export { QwkSearchMCPSession, getQwkSearchTools } from "./qwksearch-mcp-tools";
13
14
  export * from "./search";
@@ -0,0 +1,57 @@
1
+ import { createMCPClient } from "@ai-sdk/mcp";
2
+ import { Experimental_StdioMCPTransport } from "@ai-sdk/mcp/mcp-stdio";
3
+ import type { MCPClient } from "@ai-sdk/mcp";
4
+ import type { ToolSet } from "ai";
5
+
6
+ export interface QwkSearchMCPConfig {
7
+ command?: string;
8
+ args?: string[];
9
+ env?: Record<string, string>;
10
+ }
11
+
12
+ /**
13
+ * Long-lived MCP session for QwkSearch tools.
14
+ * Spawns a local MCP server process and keeps it alive across tool calls.
15
+ */
16
+ export class QwkSearchMCPSession {
17
+ private client: MCPClient | null = null;
18
+ private config: QwkSearchMCPConfig;
19
+
20
+ constructor(config: QwkSearchMCPConfig = {}) {
21
+ this.config = config;
22
+ }
23
+
24
+ async getTools(): Promise<ToolSet> {
25
+ if (!this.client) {
26
+ this.client = await createMCPClient({
27
+ transport: new Experimental_StdioMCPTransport({
28
+ command: this.config.command || "bun",
29
+ args: this.config.args || ["run", "qwksearch-mcp-server/bin/qwksearch-mcp.ts"],
30
+ env: {
31
+ ...process.env as Record<string, string>,
32
+ ...this.config.env,
33
+ },
34
+ }),
35
+ });
36
+ }
37
+ return (await this.client.tools()) as ToolSet;
38
+ }
39
+
40
+ async close() {
41
+ await this.client?.close();
42
+ this.client = null;
43
+ }
44
+ }
45
+
46
+ /**
47
+ * One-shot helper to get QwkSearch MCP tools.
48
+ * Creates a session, fetches tools, and returns them.
49
+ * Caller should close the returned session when done.
50
+ */
51
+ export async function getQwkSearchTools(
52
+ config?: QwkSearchMCPConfig
53
+ ): Promise<{ tools: ToolSet; session: QwkSearchMCPSession }> {
54
+ const session = new QwkSearchMCPSession(config);
55
+ const tools = await session.getTools();
56
+ return { tools, session };
57
+ }