@hypothesi/tauri-mcp-server 0.3.1 → 0.4.0

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.
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { getPluginClient, connectPlugin } from './plugin-client.js';
3
+ import { createMcpLogger } from '../logger.js';
3
4
  import { buildScreenshotScript, buildScreenshotCaptureScript, getHtml2CanvasSource, HTML2CANVAS_SCRIPT_ID, } from './scripts/html2canvas-loader.js';
4
5
  import { registerScript, isScriptRegistered } from './script-manager.js';
5
6
  /**
@@ -15,6 +16,7 @@ import { registerScript, isScriptRegistered } from './script-manager.js';
15
16
  // Auto-Initialization System
16
17
  // ============================================================================
17
18
  let isInitialized = false;
19
+ const driverLogger = createMcpLogger('DRIVER');
18
20
  /**
19
21
  * Ensures the MCP server is fully initialized and ready to use.
20
22
  * This is called automatically by all tool functions.
@@ -302,7 +304,7 @@ export async function captureScreenshot(options = {}) {
302
304
  catch (nativeError) {
303
305
  // Log the native error for debugging, then fall back
304
306
  const nativeMsg = nativeError instanceof Error ? nativeError.message : String(nativeError);
305
- console.error(`Native screenshot failed: ${nativeMsg}, falling back to html2canvas`);
307
+ driverLogger.error(`Native screenshot failed: ${nativeMsg}, falling back to html2canvas`);
306
308
  }
307
309
  // Fallback 1: Use html2canvas library for high-quality DOM rendering
308
310
  // Try to use the script manager to register html2canvas for persistence
package/dist/index.js CHANGED
@@ -9,11 +9,13 @@ import { dirname, join } from 'path';
9
9
  // Import the single source of truth for all tools and prompts
10
10
  import { TOOLS, TOOL_MAP } from './tools-registry.js';
11
11
  import { PROMPTS, PROMPT_MAP } from './prompts-registry.js';
12
+ import { createMcpLogger } from './logger.js';
12
13
  /* eslint-disable no-process-exit */
13
14
  // Read version from package.json
14
15
  const currentDir = dirname(fileURLToPath(import.meta.url));
15
16
  const packageJson = JSON.parse(readFileSync(join(currentDir, '..', 'package.json'), 'utf-8'));
16
17
  const VERSION = packageJson.version;
18
+ const serverLogger = createMcpLogger('SERVER');
17
19
  // Initialize server
18
20
  const server = new Server({
19
21
  name: 'mcp-server-tauri',
@@ -33,7 +35,7 @@ server.onerror = (error) => {
33
35
  process.exit(0);
34
36
  }
35
37
  // For other errors, log to stderr (will be captured by MCP client)
36
- console.error('[MCP Server Error]', message);
38
+ serverLogger.error(message);
37
39
  };
38
40
  // Handle connection close - exit gracefully
39
41
  server.onclose = () => {
package/dist/logger.js ADDED
@@ -0,0 +1,13 @@
1
+ export function createMcpLogger(scope) {
2
+ return {
3
+ info: (...args) => {
4
+ console.log('[MCP][' + scope + '][INFO]', ...args);
5
+ },
6
+ warn: (...args) => {
7
+ console.warn('[MCP][' + scope + '][WARN]', ...args);
8
+ },
9
+ error: (...args) => {
10
+ console.error('[MCP][' + scope + '][ERROR]', ...args);
11
+ },
12
+ };
13
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypothesi/tauri-mcp-server",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "A Model Context Protocol server for Tauri v2 development",
5
5
  "type": "module",
6
6
  "bin": {