@cainli/mcp-server-mysql 2.0.9 → 2.0.10

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.
Files changed (3) hide show
  1. package/README.md +65 -3
  2. package/dist/evals.js +0 -0
  3. package/package.json +27 -27
package/README.md CHANGED
@@ -49,6 +49,27 @@ A Model Context Protocol server that provides access to MySQL databases through
49
49
  - MySQL user with appropriate permissions for the operations you need
50
50
  - For write operations: MySQL user with INSERT, UPDATE, and/or DELETE privileges
51
51
 
52
+ ## Platform Support
53
+
54
+ This MCP server is fully compatible with:
55
+
56
+ - **macOS Big Sur (11.x) and later** - Full support including Unix Socket connections
57
+ - **Windows 10 and later** - Full support via TCP/IP connections
58
+ - **Linux** - Full support including Unix Socket connections
59
+
60
+ ### Platform-Specific Notes
61
+
62
+ #### macOS Big Sur
63
+ - Can use either TCP/IP or Unix Socket connections
64
+ - Unix Socket path example: `/tmp/mysql.sock` or `/var/run/mysql.sock`
65
+ - No additional configuration required
66
+
67
+ #### Windows 10
68
+ - Must use TCP/IP connections (Unix Sockets are not supported)
69
+ - Ensure MySQL is configured to accept TCP/IP connections
70
+ - Default connection: `MYSQL_HOST=127.0.0.1` and `MYSQL_PORT=3306`
71
+ - If using WSL2, you can connect to MySQL via Windows host IP (e.g., `MYSQL_HOST=172.x.x.x`)
72
+
52
73
  ## Installation
53
74
 
54
75
  ### Using Smithery
@@ -514,13 +535,54 @@ For more control over the MCP server's behavior, you can use these advanced conf
514
535
 
515
536
  ### Basic Connection
516
537
 
517
- - `MYSQL_SOCKET_PATH`: Unix socket path for local connections (e.g., "/tmp/mysql.sock")
518
- - `MYSQL_HOST`: MySQL server host (default: "127.0.0.1") - ignored if MYSQL_SOCKET_PATH is set
519
- - `MYSQL_PORT`: MySQL server port (default: "3306") - ignored if MYSQL_SOCKET_PATH is set
538
+ - `MYSQL_SOCKET_PATH`: Unix socket path for local connections (e.g., "/tmp/mysql.sock") - **macOS/Linux only**
539
+ - `MYSQL_HOST`: MySQL server host (default: "127.0.0.1") - **required for Windows**
540
+ - `MYSQL_PORT`: MySQL server port (default: "3306") - **required for Windows**
520
541
  - `MYSQL_USER`: MySQL username (default: "root")
521
542
  - `MYSQL_PASS`: MySQL password
522
543
  - `MYSQL_DB`: Target database name (leave empty for multi-DB mode)
523
544
 
545
+ ### Platform-Specific Configuration
546
+
547
+ #### macOS Big Sur
548
+
549
+ On macOS, you can use either Unix sockets or TCP/IP:
550
+
551
+ **Option 1: Unix Socket (Recommended for local MySQL)**
552
+ ```bash
553
+ MYSQL_SOCKET_PATH="/tmp/mysql.sock"
554
+ MYSQL_USER="root"
555
+ MYSQL_PASS="your_password"
556
+ MYSQL_DB="your_database"
557
+ ```
558
+
559
+ **Option 2: TCP/IP**
560
+ ```bash
561
+ MYSQL_HOST="127.0.0.1"
562
+ MYSQL_PORT="3306"
563
+ MYSQL_USER="root"
564
+ MYSQL_PASS="your_password"
565
+ MYSQL_DB="your_database"
566
+ ```
567
+
568
+ #### Windows 10
569
+
570
+ On Windows, you must use TCP/IP connections:
571
+
572
+ ```bash
573
+ MYSQL_HOST="127.0.0.1"
574
+ MYSQL_PORT="3306"
575
+ MYSQL_USER="root"
576
+ MYSQL_PASS="your_password"
577
+ MYSQL_DB="your_database"
578
+ ```
579
+
580
+ **Windows-Specific Notes:**
581
+ - If MySQL is running in WSL2, you may need to use the Windows host IP instead of `127.0.0.1`
582
+ - To find WSL2 IP: Run `wsl hostname -I` in Windows Command Prompt or PowerShell
583
+ - Ensure MySQL is configured to accept TCP/IP connections (check `bind-address` in `my.cnf` or `my.ini`)
584
+ - Windows Firewall may block connections - ensure port 3306 is allowed
585
+
524
586
  #### Alternative: Connection String
525
587
 
526
588
  For scenarios requiring frequent credential rotation or temporary connections, you can use a MySQL connection string instead of individual environment variables:
package/dist/evals.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cainli/mcp-server-mysql",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "MCP server for interacting with MySQL databases with write operations support",
5
5
  "license": "MIT",
6
6
  "author": "cainli (https://github.com/cainli)",
@@ -16,30 +16,6 @@
16
16
  "README.md",
17
17
  "assets"
18
18
  ],
19
- "scripts": {
20
- "start": "node dist/index.js",
21
- "dev": "ts-node index.ts",
22
- "build": "tsc && shx chmod +x dist/*.js",
23
- "prepare": "npm run build",
24
- "watch": "tsc --watch",
25
- "setup:test:db": "tsx scripts/setup-test-db.ts",
26
- "pretest": "pnpm run setup:test:db",
27
- "test": "pnpm run setup:test:db && vitest run",
28
- "test:socket": "pnpm run setup:test:db && vitest run tests/integration/socket-connection.test.ts",
29
- "test:watch": "pnpm run setup:test:db && vitest",
30
- "test:coverage": "vitest run --coverage",
31
- "test:unit": "vitest run --config vitest.unit.config.ts",
32
- "test:integration": "vitest run --config vitest.integration.config.ts",
33
- "test:e2e": "vitest run --config vitest.e2e.config.ts",
34
- "stdio": "node dist/index.js --stdio",
35
- "exec": " pnpm build && npx node --env-file=.env dist/index.js",
36
- "lint": "npm run lint:eslint && npm run lint:markdown",
37
- "lint:eslint": "eslint .",
38
- "lint:markdown": "markdownlint .",
39
- "lint:fix": "npm run lint:eslint:fix && npm run lint:markdown:fix",
40
- "lint:eslint:fix": "eslint . --fix",
41
- "lint:markdown:fix": "markdownlint . --fix"
42
- },
43
19
  "dependencies": {
44
20
  "@ai-sdk/openai": "^1.3.22",
45
21
  "@modelcontextprotocol/sdk": "1.15.1",
@@ -83,5 +59,29 @@
83
59
  "mcp-patch",
84
60
  "mcp-options",
85
61
  "mcp-head"
86
- ]
87
- }
62
+ ],
63
+ "scripts": {
64
+ "start": "node dist/index.js",
65
+ "dev": "ts-node index.ts",
66
+ "build": "tsc && npm run chmod:win",
67
+ "chmod:win": "node -e \"const os=require('os');if(os.platform()!=='win32'){const fs=require('fs');const dist='dist';const files=fs.readdirSync(dist).filter(f=>f.endsWith('.js'));files.forEach(f=>fs.chmodSync(dist+'/'+f,0o755));console.log('Made executable:',files.join(', '))}\"",
68
+ "watch": "tsc --watch",
69
+ "setup:test:db": "tsx scripts/setup-test-db.ts",
70
+ "pretest": "pnpm run setup:test:db",
71
+ "test": "pnpm run setup:test:db && vitest run",
72
+ "test:socket": "pnpm run setup:test:db && vitest run tests/integration/socket-connection.test.ts",
73
+ "test:watch": "pnpm run setup:test:db && vitest",
74
+ "test:coverage": "vitest run --coverage",
75
+ "test:unit": "vitest run --config vitest.unit.config.ts",
76
+ "test:integration": "vitest run --config vitest.integration.config.ts",
77
+ "test:e2e": "vitest run --config vitest.e2e.config.ts",
78
+ "stdio": "node dist/index.js --stdio",
79
+ "exec": " pnpm build && npx node --env-file=.env dist/index.js",
80
+ "lint": "npm run lint:eslint && npm run lint:markdown",
81
+ "lint:eslint": "eslint .",
82
+ "lint:markdown": "markdownlint .",
83
+ "lint:fix": "npm run lint:eslint:fix && npm run lint:markdown:fix",
84
+ "lint:eslint:fix": "eslint . --fix",
85
+ "lint:markdown:fix": "markdownlint . --fix"
86
+ }
87
+ }