@cemalturkcann/mariadb-mcp-server 1.1.1 → 1.1.2
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.
- package/README.md +5 -9
- package/package.json +1 -1
- package/src/db.js +8 -8
package/README.md
CHANGED
|
@@ -96,6 +96,8 @@ Example config:
|
|
|
96
96
|
|
|
97
97
|
## MCP Client Setup
|
|
98
98
|
|
|
99
|
+
On first run, a default config is created automatically at `~/.config/mariadb-mcp/config.json` (Linux/macOS) or `%APPDATA%\mariadb-mcp\config.json` (Windows). Edit it to add your connections.
|
|
100
|
+
|
|
99
101
|
### Claude Code
|
|
100
102
|
|
|
101
103
|
Add to `~/.claude.json`:
|
|
@@ -105,10 +107,7 @@ Add to `~/.claude.json`:
|
|
|
105
107
|
"mcpServers": {
|
|
106
108
|
"mariadb": {
|
|
107
109
|
"command": "npx",
|
|
108
|
-
"args": ["-y", "@cemalturkcann/mariadb-mcp-server"]
|
|
109
|
-
"env": {
|
|
110
|
-
"DB_MCP_CONFIG_PATH": "/path/to/config.json"
|
|
111
|
-
}
|
|
110
|
+
"args": ["-y", "@cemalturkcann/mariadb-mcp-server"]
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
}
|
|
@@ -123,10 +122,7 @@ Add to your `opencode.json`:
|
|
|
123
122
|
"mcp": {
|
|
124
123
|
"mariadb": {
|
|
125
124
|
"type": "local",
|
|
126
|
-
"command": ["npx", "-y", "@cemalturkcann/mariadb-mcp-server"]
|
|
127
|
-
"environment": {
|
|
128
|
-
"DB_MCP_CONFIG_PATH": "/path/to/config.json"
|
|
129
|
-
}
|
|
125
|
+
"command": ["npx", "-y", "@cemalturkcann/mariadb-mcp-server"]
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
}
|
|
@@ -134,7 +130,7 @@ Add to your `opencode.json`:
|
|
|
134
130
|
|
|
135
131
|
### Other MCP Clients
|
|
136
132
|
|
|
137
|
-
Any MCP-compatible client can use this server. The binary name is `mariadb-mcp-server` and it communicates over stdio.
|
|
133
|
+
Any MCP-compatible client can use this server. The binary name is `mariadb-mcp-server` and it communicates over stdio. To use a custom config path, set `DB_MCP_CONFIG_PATH`.
|
|
138
134
|
|
|
139
135
|
## License
|
|
140
136
|
|
package/package.json
CHANGED
package/src/db.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createPool } from "mariadb";
|
|
2
2
|
|
|
3
3
|
export class DbManager {
|
|
4
4
|
constructor(config) {
|
|
@@ -12,13 +12,13 @@ export class DbManager {
|
|
|
12
12
|
|
|
13
13
|
getReadableConnections() {
|
|
14
14
|
return this.getConnectionNames().filter(
|
|
15
|
-
(name) => this.config.connections[name].read
|
|
15
|
+
(name) => this.config.connections[name].read,
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
getWritableConnections() {
|
|
20
20
|
return this.getConnectionNames().filter(
|
|
21
|
-
(name) => this.config.connections[name].write
|
|
21
|
+
(name) => this.config.connections[name].write,
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ export class DbManager {
|
|
|
27
27
|
if (!cfg) {
|
|
28
28
|
const available = this.getConnectionNames().join(", ");
|
|
29
29
|
throw new Error(
|
|
30
|
-
`Baglanti bulunamadi: '${name}'. Mevcut baglantilar: ${available}
|
|
30
|
+
`Baglanti bulunamadi: '${name}'. Mevcut baglantilar: ${available}`,
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
return cfg;
|
|
@@ -59,7 +59,7 @@ export class DbManager {
|
|
|
59
59
|
typeof c.ssl === "object" ? c.ssl : { rejectUnauthorized: false };
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
this.pools.set(poolKey,
|
|
62
|
+
this.pools.set(poolKey, createPool(poolOptions));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return this.pools.get(poolKey);
|
|
@@ -69,7 +69,7 @@ export class DbManager {
|
|
|
69
69
|
const cfg = this.getConnectionConfig(connectionName);
|
|
70
70
|
if (!cfg.read) {
|
|
71
71
|
throw new Error(
|
|
72
|
-
`'${connectionName}' baglantisi read (okuma) izni vermiyor
|
|
72
|
+
`'${connectionName}' baglantisi read (okuma) izni vermiyor.`,
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -78,7 +78,7 @@ export class DbManager {
|
|
|
78
78
|
const cfg = this.getConnectionConfig(connectionName);
|
|
79
79
|
if (!cfg.write) {
|
|
80
80
|
throw new Error(
|
|
81
|
-
`'${connectionName}' baglantisi write (yazma) izni vermiyor
|
|
81
|
+
`'${connectionName}' baglantisi write (yazma) izni vermiyor.`,
|
|
82
82
|
);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -134,7 +134,7 @@ export class DbManager {
|
|
|
134
134
|
/* asil hatayi koruyoruz */
|
|
135
135
|
}
|
|
136
136
|
throw new Error(
|
|
137
|
-
`Transaction basarisiz, rollback yapildi: ${error.message}
|
|
137
|
+
`Transaction basarisiz, rollback yapildi: ${error.message}`,
|
|
138
138
|
);
|
|
139
139
|
} finally {
|
|
140
140
|
conn.release();
|