@zhihand/mcp 0.23.0 → 0.23.1

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.
@@ -7,6 +7,8 @@ import { DEFAULT_MODELS } from "../core/config.js";
7
7
  import { resolveGemini, resolveClaude, resolveCodex } from "../core/resolve-path.js";
8
8
  const CLI_TIMEOUT = 300_000; // 300s (5min) per prompt — MCP tool chains need multiple turns
9
9
  const SIGKILL_DELAY = 2_000; // 2s after SIGTERM
10
+ const MCP_PORT = parseInt(process.env.ZHIHAND_PORT ?? "", 10) || 18686;
11
+ const MCP_URL = `http://127.0.0.1:${MCP_PORT}/mcp`;
10
12
  const MAX_OUTPUT_BYTES = 100 * 1024; // 100KB (for one-shot backends)
11
13
  const MAX_HISTORY_TURNS = 20; // keep last N exchanges in conversation history
12
14
  // Gemini session file polling
@@ -540,11 +542,14 @@ async function dispatchClaudeWithHistory(prompt, startTime, log, model) {
540
542
  log(`[claude] One-shot dispatch (history: ${conversationHistory.length} turns)`);
541
543
  // Pass prompt via stdin (-p -) to avoid ARG_MAX limit with long conversation history
542
544
  // --permission-mode bypassPermissions: auto-approve all tool calls (like gemini's --approval-mode yolo)
545
+ // --mcp-config: explicitly pass MCP server URL so Claude finds it regardless of cwd
546
+ const mcpConfig = JSON.stringify({ mcpServers: { zhihand: { type: "http", url: MCP_URL } } });
543
547
  const child = spawn(claudePath, [
544
548
  "-p", "-",
545
549
  "--model", model,
546
550
  "--output-format", "json",
547
551
  "--permission-mode", "bypassPermissions",
552
+ "--mcp-config", mcpConfig,
548
553
  ], {
549
554
  env: process.env,
550
555
  stdio: ["pipe", "pipe", "pipe"],
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare const PACKAGE_VERSION = "0.23.0";
2
+ export declare const PACKAGE_VERSION = "0.23.1";
3
3
  export declare function createServer(deviceName?: string): McpServer;
4
4
  export declare function startStdioServer(deviceName?: string): Promise<void>;
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { controlSchema, screenshotSchema, pairSchema } from "./tools/schemas.js"
5
5
  import { executeControl } from "./tools/control.js";
6
6
  import { handleScreenshot } from "./tools/screenshot.js";
7
7
  import { handlePair } from "./tools/pair.js";
8
- export const PACKAGE_VERSION = "0.23.0";
8
+ export const PACKAGE_VERSION = "0.23.1";
9
9
  export function createServer(deviceName) {
10
10
  const server = new McpServer({
11
11
  name: "zhihand",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhihand/mcp",
3
- "version": "0.23.0",
3
+ "version": "0.23.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "ZhiHand MCP Server — phone control tools for Claude Code, Codex, Gemini CLI, and OpenClaw",