@mokoconsulting/mokomysql-mcp 2.5.4 → 2.6.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.
- package/LICENSE +696 -696
- package/README.md +122 -112
- package/config.example.json +27 -26
- package/dist/README.md +7 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +6 -0
- package/dist/config.js.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/migrate.d.ts +57 -0
- package/dist/migrate.d.ts.map +1 -0
- package/dist/migrate.js +224 -0
- package/dist/migrate.js.map +1 -0
- package/dist/secrets.d.ts.map +1 -1
- package/dist/secrets.js +8 -2
- package/dist/secrets.js.map +1 -1
- package/package.json +1 -1
- package/source/client.ts +210 -210
- package/source/config.ts +104 -97
- package/source/index.ts +1105 -1100
- package/source/migrate.ts +263 -0
- package/source/secrets.ts +78 -70
- package/source/state.ts +62 -62
- package/source/types.ts +91 -91
- package/tsconfig.json +19 -19
package/source/types.ts
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
2
|
-
*
|
|
3
|
-
* This file is part of a Moko Consulting project.
|
|
4
|
-
*
|
|
5
|
-
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
6
|
-
*
|
|
7
|
-
* FILE INFORMATION
|
|
8
|
-
* DEFGROUP: mokomysql.Types
|
|
9
|
-
* INGROUP: mokomysql
|
|
10
|
-
* REPO: https://git.mokoconsulting.tech/MokoConsulting/mokomysql-mcp
|
|
11
|
-
* PATH: /src/types.ts
|
|
12
|
-
* VERSION: 01.00.00
|
|
13
|
-
* BRIEF: TypeScript type definitions for MySQL MCP server
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export interface MySqlSslConfig {
|
|
17
|
-
/** Verify the server certificate against a CA. Defaults to true. */
|
|
18
|
-
rejectUnauthorized?: boolean;
|
|
19
|
-
/** PEM CA certificate(s) to trust. */
|
|
20
|
-
ca?: string;
|
|
21
|
-
/** PEM client certificate. */
|
|
22
|
-
cert?: string;
|
|
23
|
-
/** PEM client private key. */
|
|
24
|
-
key?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface MySqlConnection {
|
|
28
|
-
host: string;
|
|
29
|
-
port?: number;
|
|
30
|
-
user: string;
|
|
31
|
-
password: string;
|
|
32
|
-
database?: string;
|
|
33
|
-
/**
|
|
34
|
-
* TLS for the connection. `true` enables TLS with certificate verification
|
|
35
|
-
* (secure default). Pass an object to customize — e.g. `{ ca: '...' }` for a
|
|
36
|
-
* private CA, or `{ rejectUnauthorized: false }` to explicitly opt out of
|
|
37
|
-
* verification (insecure; only for trusted internal hosts with self-signed
|
|
38
|
-
* certs). A bare `true` is never silently downgraded.
|
|
39
|
-
*/
|
|
40
|
-
ssl?: boolean | MySqlSslConfig;
|
|
41
|
-
timezone?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Extra keyword shortcuts that resolve to this connection.
|
|
44
|
-
* Matched case-insensitively with all punctuation stripped, so
|
|
45
|
-
* "moko.live", "moko-live", "Moko Live" and "mokolive" are equivalent.
|
|
46
|
-
*/
|
|
47
|
-
tags?: string[];
|
|
48
|
-
/**
|
|
49
|
-
* Marks this connection as pointing at a Joomla database. Writes to a Joomla DB
|
|
50
|
-
* require the two-step `confirm_token` handshake (first call returns a token and
|
|
51
|
-
* does not execute; the same call repeated with the token runs it) on top of the
|
|
52
|
-
* usual `confirm: true` — reads stay unrestricted. Leave unset to auto-detect from
|
|
53
|
-
* the schema signature (presence of `<prefix>extensions` + `<prefix>assets`);
|
|
54
|
-
* set `true` to force the gate on, or `false` to force it off and skip detection.
|
|
55
|
-
*/
|
|
56
|
-
joomla?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* Joomla table prefix for this connection (e.g. "jos_", "vkw4n_"). Only used when
|
|
59
|
-
* `joomla: true` is set explicitly — it lets the nested-set guard recognize
|
|
60
|
-
* `#__assets`/`#__categories`/`#__menu` without a schema probe. When omitted, the
|
|
61
|
-
* prefix is derived from the detected signature tables.
|
|
62
|
-
*/
|
|
63
|
-
joomlaPrefix?: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface MySqlConfig {
|
|
67
|
-
connections: Record<string, MySqlConnection>;
|
|
68
|
-
defaultConnection: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* A learned Joomla verdict for one `host:port/database` target, persisted to the
|
|
73
|
-
* sidecar state file so the server knows the target is Joomla on future connects
|
|
74
|
-
* without re-probing the schema.
|
|
75
|
-
*/
|
|
76
|
-
export interface JoomlaMarker {
|
|
77
|
-
joomla: boolean;
|
|
78
|
-
/** Live table prefix (e.g. "jos_", "vkw4n_") when known. */
|
|
79
|
-
prefix: string | null;
|
|
80
|
-
/** ISO timestamp of when the verdict was learned. */
|
|
81
|
-
detectedAt: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Sidecar state the MCP manages itself (distinct from the user-authored config).
|
|
86
|
-
* Lives next to the config as `<config>.state.json`. Pure cache: delete it and
|
|
87
|
-
* the server re-detects; an explicit per-connection `joomla` flag overrides it.
|
|
88
|
-
*/
|
|
89
|
-
export interface MySqlState {
|
|
90
|
-
markers: Record<string, JoomlaMarker>;
|
|
91
|
-
}
|
|
1
|
+
/* Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
|
|
2
|
+
*
|
|
3
|
+
* This file is part of a Moko Consulting project.
|
|
4
|
+
*
|
|
5
|
+
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
6
|
+
*
|
|
7
|
+
* FILE INFORMATION
|
|
8
|
+
* DEFGROUP: mokomysql.Types
|
|
9
|
+
* INGROUP: mokomysql
|
|
10
|
+
* REPO: https://git.mokoconsulting.tech/MokoConsulting/mokomysql-mcp
|
|
11
|
+
* PATH: /src/types.ts
|
|
12
|
+
* VERSION: 01.00.00
|
|
13
|
+
* BRIEF: TypeScript type definitions for MySQL MCP server
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export interface MySqlSslConfig {
|
|
17
|
+
/** Verify the server certificate against a CA. Defaults to true. */
|
|
18
|
+
rejectUnauthorized?: boolean;
|
|
19
|
+
/** PEM CA certificate(s) to trust. */
|
|
20
|
+
ca?: string;
|
|
21
|
+
/** PEM client certificate. */
|
|
22
|
+
cert?: string;
|
|
23
|
+
/** PEM client private key. */
|
|
24
|
+
key?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface MySqlConnection {
|
|
28
|
+
host: string;
|
|
29
|
+
port?: number;
|
|
30
|
+
user: string;
|
|
31
|
+
password: string;
|
|
32
|
+
database?: string;
|
|
33
|
+
/**
|
|
34
|
+
* TLS for the connection. `true` enables TLS with certificate verification
|
|
35
|
+
* (secure default). Pass an object to customize — e.g. `{ ca: '...' }` for a
|
|
36
|
+
* private CA, or `{ rejectUnauthorized: false }` to explicitly opt out of
|
|
37
|
+
* verification (insecure; only for trusted internal hosts with self-signed
|
|
38
|
+
* certs). A bare `true` is never silently downgraded.
|
|
39
|
+
*/
|
|
40
|
+
ssl?: boolean | MySqlSslConfig;
|
|
41
|
+
timezone?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Extra keyword shortcuts that resolve to this connection.
|
|
44
|
+
* Matched case-insensitively with all punctuation stripped, so
|
|
45
|
+
* "moko.live", "moko-live", "Moko Live" and "mokolive" are equivalent.
|
|
46
|
+
*/
|
|
47
|
+
tags?: string[];
|
|
48
|
+
/**
|
|
49
|
+
* Marks this connection as pointing at a Joomla database. Writes to a Joomla DB
|
|
50
|
+
* require the two-step `confirm_token` handshake (first call returns a token and
|
|
51
|
+
* does not execute; the same call repeated with the token runs it) on top of the
|
|
52
|
+
* usual `confirm: true` — reads stay unrestricted. Leave unset to auto-detect from
|
|
53
|
+
* the schema signature (presence of `<prefix>extensions` + `<prefix>assets`);
|
|
54
|
+
* set `true` to force the gate on, or `false` to force it off and skip detection.
|
|
55
|
+
*/
|
|
56
|
+
joomla?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Joomla table prefix for this connection (e.g. "jos_", "vkw4n_"). Only used when
|
|
59
|
+
* `joomla: true` is set explicitly — it lets the nested-set guard recognize
|
|
60
|
+
* `#__assets`/`#__categories`/`#__menu` without a schema probe. When omitted, the
|
|
61
|
+
* prefix is derived from the detected signature tables.
|
|
62
|
+
*/
|
|
63
|
+
joomlaPrefix?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface MySqlConfig {
|
|
67
|
+
connections: Record<string, MySqlConnection>;
|
|
68
|
+
defaultConnection: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A learned Joomla verdict for one `host:port/database` target, persisted to the
|
|
73
|
+
* sidecar state file so the server knows the target is Joomla on future connects
|
|
74
|
+
* without re-probing the schema.
|
|
75
|
+
*/
|
|
76
|
+
export interface JoomlaMarker {
|
|
77
|
+
joomla: boolean;
|
|
78
|
+
/** Live table prefix (e.g. "jos_", "vkw4n_") when known. */
|
|
79
|
+
prefix: string | null;
|
|
80
|
+
/** ISO timestamp of when the verdict was learned. */
|
|
81
|
+
detectedAt: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Sidecar state the MCP manages itself (distinct from the user-authored config).
|
|
86
|
+
* Lives next to the config as `<config>.state.json`. Pure cache: delete it and
|
|
87
|
+
* the server re-detects; an explicit per-connection `joomla` flag overrides it.
|
|
88
|
+
*/
|
|
89
|
+
export interface MySqlState {
|
|
90
|
+
markers: Record<string, JoomlaMarker>;
|
|
91
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "Node16",
|
|
6
|
-
"outDir": "./dist",
|
|
7
|
-
"rootDir": "./source",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"forceConsistentCasingInFileNames": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"declaration": true,
|
|
14
|
-
"declarationMap": true,
|
|
15
|
-
"sourceMap": true
|
|
16
|
-
},
|
|
17
|
-
"include": ["source/**/*"],
|
|
18
|
-
"exclude": ["node_modules", "dist"]
|
|
19
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"moduleResolution": "Node16",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./source",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["source/**/*"],
|
|
18
|
+
"exclude": ["node_modules", "dist"]
|
|
19
|
+
}
|