@exreve/exk 1.0.31 → 1.0.33

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.
@@ -512,7 +512,7 @@ export class AgentSessionManager {
512
512
  // Create a fresh MCP server for each query call (SDK connects transport internally, cannot reuse)
513
513
  ...(() => {
514
514
  const mcpServer = this.buildMcpServer(sessionId, attachmentDir);
515
- return mcpServer ? { mcpServers: [mcpServer] } : {};
515
+ return { mcpServers: { 'claude-voice-modules': mcpServer } };
516
516
  })(),
517
517
  ...(pathToClaudeCodeExecutable ? { pathToClaudeCodeExecutable } : {}),
518
518
  spawnClaudeCodeProcess: (spawnOptions) => {
@@ -1232,11 +1232,6 @@ export class AgentSessionManager {
1232
1232
  * reuse a single instance across multiple queries. This must be called fresh each time.
1233
1233
  */
1234
1234
  buildMcpServer(sessionId, attachmentDir) {
1235
- const session = this.sessions.get(sessionId);
1236
- if (!session) {
1237
- console.log(`[buildMcpServer] No session found for ${sessionId}`);
1238
- return undefined;
1239
- }
1240
1235
  console.log(`[buildMcpServer] Session ${sessionId}: attachmentDir=${attachmentDir || 'none'}`);
1241
1236
  return createModuleMcpServer({
1242
1237
  attachmentDir,
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Test: verify that a custom MCP tool is visible to the Claude Agent SDK.
3
+ * Usage: npx tsx test-mcp-tool.ts
4
+ */
5
+ import { query, createSdkMcpServer, tool } from '@anthropic-ai/claude-agent-sdk';
6
+ import { z } from 'zod';
7
+ import fs from 'fs';
8
+ import path from 'path';
9
+ import os from 'os';
10
+ const AI_CONFIG = JSON.parse(fs.readFileSync(path.join(os.homedir(), '.talk-to-code', 'ai-config.json'), 'utf-8'));
11
+ // Create a trivial test tool
12
+ const mcpServer = createSdkMcpServer({
13
+ name: 'test-tools',
14
+ version: '1.0.0',
15
+ tools: [
16
+ tool('analyze_image', 'Analyze an image file. Returns a text description.', {
17
+ image_path: z.string().describe('Path to image'),
18
+ question: z.string().describe('What to answer about the image'),
19
+ }, async (args) => ({
20
+ content: [{ type: 'text', text: `[TEST] Would analyze ${args.image_path} with question: ${args.question}` }],
21
+ })),
22
+ ],
23
+ });
24
+ console.log('=== MCP server created ===');
25
+ // Now run a query with the CORRECT format (Record<string, config>)
26
+ console.log('\n--- Running query (mcpServers as Record) ---');
27
+ const q = query({
28
+ prompt: 'List every tool you have available by name. Specifically, do you have an "analyze_image" tool? Just answer with the list.',
29
+ options: {
30
+ apiKey: AI_CONFIG.authToken,
31
+ model: AI_CONFIG.model,
32
+ cwd: '/tmp',
33
+ permissionMode: 'bypassPermissions',
34
+ allowDangerouslySkipPermissions: true,
35
+ disallowedTools: ['AskUserQuestion', 'analyze_image'],
36
+ mcpServers: { 'claude-voice-modules': mcpServer },
37
+ maxTurns: 2,
38
+ },
39
+ });
40
+ for await (const event of q) {
41
+ if (event.type === 'assistant') {
42
+ const text = event.message?.content
43
+ ?.filter((b) => b.type === 'text')
44
+ ?.map((b) => b.text)
45
+ ?.join('') || '';
46
+ if (text)
47
+ console.log('Agent:', text);
48
+ }
49
+ }
50
+ console.log('\n--- Done ---');
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exreve/exk",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "exk - Control Claude CLI with voice and programmable interfaces",
5
5
  "type": "module",
6
6
  "bin": {