@paretools/db 0.11.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 +21 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/db-runner.d.ts +10 -0
- package/dist/lib/db-runner.d.ts.map +1 -0
- package/dist/lib/db-runner.js +19 -0
- package/dist/lib/db-runner.js.map +1 -0
- package/dist/lib/formatters.d.ts +108 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +258 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/parsers.d.ts +107 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +333 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/schemas/index.d.ts +128 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +111 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/tools/index.d.ts +4 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +33 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mongosh-eval.d.ts +4 -0
- package/dist/tools/mongosh-eval.d.ts.map +1 -0
- package/dist/tools/mongosh-eval.js +40 -0
- package/dist/tools/mongosh-eval.js.map +1 -0
- package/dist/tools/mongosh-stats.d.ts +4 -0
- package/dist/tools/mongosh-stats.d.ts.map +1 -0
- package/dist/tools/mongosh-stats.js +35 -0
- package/dist/tools/mongosh-stats.js.map +1 -0
- package/dist/tools/mysql-list-databases.d.ts +4 -0
- package/dist/tools/mysql-list-databases.d.ts.map +1 -0
- package/dist/tools/mysql-list-databases.js +39 -0
- package/dist/tools/mysql-list-databases.js.map +1 -0
- package/dist/tools/mysql-query.d.ts +4 -0
- package/dist/tools/mysql-query.d.ts.map +1 -0
- package/dist/tools/mysql-query.js +50 -0
- package/dist/tools/mysql-query.js.map +1 -0
- package/dist/tools/psql-list-databases.d.ts +4 -0
- package/dist/tools/psql-list-databases.d.ts.map +1 -0
- package/dist/tools/psql-list-databases.js +39 -0
- package/dist/tools/psql-list-databases.js.map +1 -0
- package/dist/tools/psql-query.d.ts +4 -0
- package/dist/tools/psql-query.d.ts.map +1 -0
- package/dist/tools/psql-query.js +50 -0
- package/dist/tools/psql-query.js.map +1 -0
- package/dist/tools/redis-command.d.ts +4 -0
- package/dist/tools/redis-command.d.ts.map +1 -0
- package/dist/tools/redis-command.js +57 -0
- package/dist/tools/redis-command.js.map +1 -0
- package/dist/tools/redis-info.d.ts +4 -0
- package/dist/tools/redis-info.d.ts.map +1 -0
- package/dist/tools/redis-info.js +51 -0
- package/dist/tools/redis-info.js.map +1 -0
- package/dist/tools/redis-ping.d.ts +4 -0
- package/dist/tools/redis-ping.d.ts.map +1 -0
- package/dist/tools/redis-ping.js +42 -0
- package/dist/tools/redis-ping.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { mongoshCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseMongoshEval } from "../lib/parsers.js";
|
|
5
|
+
import { formatMongoshEval, compactMongoshEvalMap, formatMongoshEvalCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { MongoshEvalResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `mongosh-eval` tool on the given MCP server. */
|
|
8
|
+
export function registerMongoshEvalTool(server) {
|
|
9
|
+
server.registerTool("mongosh-eval", {
|
|
10
|
+
title: "MongoDB Eval",
|
|
11
|
+
description: "Evaluates a MongoDB expression via mongosh and returns the output. " +
|
|
12
|
+
"WARNING: The expression is executed as-is — do not pass untrusted input.",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
expression: z
|
|
15
|
+
.string()
|
|
16
|
+
.max(INPUT_LIMITS.STRING_MAX)
|
|
17
|
+
.describe("JavaScript expression to evaluate in mongosh"),
|
|
18
|
+
uri: z
|
|
19
|
+
.string()
|
|
20
|
+
.max(INPUT_LIMITS.STRING_MAX)
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("MongoDB connection URI (e.g., mongodb://localhost:27017/mydb)"),
|
|
23
|
+
compact: compactInput,
|
|
24
|
+
},
|
|
25
|
+
outputSchema: MongoshEvalResultSchema,
|
|
26
|
+
}, async ({ expression, uri, compact }) => {
|
|
27
|
+
if (uri)
|
|
28
|
+
assertNoFlagInjection(uri, "uri");
|
|
29
|
+
const args = ["--quiet", "--eval", expression];
|
|
30
|
+
if (uri)
|
|
31
|
+
args.push(uri);
|
|
32
|
+
const start = Date.now();
|
|
33
|
+
const result = await mongoshCmd(args);
|
|
34
|
+
const duration = Date.now() - start;
|
|
35
|
+
const data = parseMongoshEval(result.stdout, result.stderr, result.exitCode, duration);
|
|
36
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
37
|
+
return compactDualOutput(data, rawOutput, formatMongoshEval, compactMongoshEvalMap, formatMongoshEvalCompact, compact === false);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=mongosh-eval.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongosh-eval.js","sourceRoot":"","sources":["../../src/tools/mongosh-eval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,u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AAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongosh-stats.d.ts","sourceRoot":"","sources":["../../src/tools/mongosh-stats.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,kEAAkE;AAClE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,QAuCzD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { mongoshCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseMongoshStats } from "../lib/parsers.js";
|
|
5
|
+
import { formatMongoshStats, compactMongoshStatsMap, formatMongoshStatsCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { MongoshStatsResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `mongosh-stats` tool on the given MCP server. */
|
|
8
|
+
export function registerMongoshStatsTool(server) {
|
|
9
|
+
server.registerTool("mongosh-stats", {
|
|
10
|
+
title: "MongoDB Stats",
|
|
11
|
+
description: "Gets MongoDB database statistics (collections, objects, data size, storage, indexes) via mongosh.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
uri: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(INPUT_LIMITS.STRING_MAX)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("MongoDB connection URI (e.g., mongodb://localhost:27017/mydb)"),
|
|
18
|
+
compact: compactInput,
|
|
19
|
+
},
|
|
20
|
+
outputSchema: MongoshStatsResultSchema,
|
|
21
|
+
}, async ({ uri, compact }) => {
|
|
22
|
+
if (uri)
|
|
23
|
+
assertNoFlagInjection(uri, "uri");
|
|
24
|
+
const args = ["--quiet", "--eval", "JSON.stringify(db.stats())"];
|
|
25
|
+
if (uri)
|
|
26
|
+
args.push(uri);
|
|
27
|
+
const start = Date.now();
|
|
28
|
+
const result = await mongoshCmd(args);
|
|
29
|
+
const duration = Date.now() - start;
|
|
30
|
+
const data = parseMongoshStats(result.stdout, result.stderr, result.exitCode, duration);
|
|
31
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
32
|
+
return compactDualOutput(data, rawOutput, formatMongoshStats, compactMongoshStatsMap, formatMongoshStatsCompact, compact === false);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=mongosh-stats.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mongosh-stats.js","sourceRoot":"","sources":["../../src/tools/mongosh-stats.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAE/D,kEAAkE;AAClE,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,MAAM,CAAC,YAAY,CACjB,eAAe,EACf;QACE,KAAK,EAAE,eAAe;QACtB,WAAW,EACT,mGAAmG;QACrG,WAAW,EAAE;YACX,GAAG,EAAE,CAAC;iBACH,MAAM,EAAE;iBACR,GAAG,CAAC,YAAY,CAAC,UAAU,CAAC;iBAC5B,QAAQ,EAAE;iBACV,QAAQ,CAAC,+DAA+D,CAAC;YAC5E,OAAO,EAAE,YAAY;SACtB;QACD,YAAY,EAAE,wBAAwB;KACvC,EACD,KAAK,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE;QACzB,IAAI,GAAG;YAAE,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE3C,MAAM,IAAI,GAAa,CAAC,SAAS,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;QAC3E,IAAI,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAExB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAEpC,MAAM,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACxF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/** Registers the `mysql-list-databases` tool on the given MCP server. */
|
|
3
|
+
export declare function registerMysqlListDatabasesTool(server: McpServer): void;
|
|
4
|
+
//# sourceMappingURL=mysql-list-databases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql-list-databases.d.ts","sourceRoot":"","sources":["../../src/tools/mysql-list-databases.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,yEAAyE;AACzE,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,SAAS,QAuC/D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { mysqlCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseMysqlListDatabases } from "../lib/parsers.js";
|
|
5
|
+
import { formatMysqlListDatabases, compactMysqlListDatabasesMap, formatMysqlListDatabasesCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { MysqlListDatabasesResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `mysql-list-databases` tool on the given MCP server. */
|
|
8
|
+
export function registerMysqlListDatabasesTool(server) {
|
|
9
|
+
server.registerTool("mysql-list-databases", {
|
|
10
|
+
title: "MySQL List Databases",
|
|
11
|
+
description: "Lists all MySQL databases with structured output.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database host"),
|
|
14
|
+
port: z.number().optional().describe("Database port (default: 3306)"),
|
|
15
|
+
user: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database user"),
|
|
16
|
+
compact: compactInput,
|
|
17
|
+
},
|
|
18
|
+
outputSchema: MysqlListDatabasesResultSchema,
|
|
19
|
+
}, async ({ host, port, user, compact }) => {
|
|
20
|
+
if (host)
|
|
21
|
+
assertNoFlagInjection(host, "host");
|
|
22
|
+
if (user)
|
|
23
|
+
assertNoFlagInjection(user, "user");
|
|
24
|
+
const args = ["--batch", "-e", "SHOW DATABASES"];
|
|
25
|
+
if (host)
|
|
26
|
+
args.push("-h", host);
|
|
27
|
+
if (port !== undefined)
|
|
28
|
+
args.push("-P", String(port));
|
|
29
|
+
if (user)
|
|
30
|
+
args.push("-u", user);
|
|
31
|
+
const start = Date.now();
|
|
32
|
+
const result = await mysqlCmd(args);
|
|
33
|
+
const duration = Date.now() - start;
|
|
34
|
+
const data = parseMysqlListDatabases(result.stdout, result.stderr, result.exitCode, duration);
|
|
35
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
36
|
+
return compactDualOutput(data, rawOutput, formatMysqlListDatabases, compactMysqlListDatabasesMap, formatMysqlListDatabasesCompact, compact === false);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=mysql-list-databases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql-list-databases.js","sourceRoot":"","sources":["../../src/tools/mysql-list-databases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAErE,yEAAyE;AACzE,MAAM,UAAU,8BAA8B,CAAC,MAAiB;IAC9D,MAAM,CAAC,YAAY,CACjB,sBAAsB,EACtB;QACE,KAAK,EAAE,sBAAsB;QAC7B,WAAW,EAAE,mDAAmD;QAChE,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;YACxF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,C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I,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,wBAAwB,EACxB,4BAA4B,EAC5B,+BAA+B,EAC/B,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql-query.d.ts","sourceRoot":"","sources":["../../src/tools/mysql-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,gEAAgE;AAChE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QAiDvD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { mysqlCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseMysqlQuery } from "../lib/parsers.js";
|
|
5
|
+
import { formatMysqlQuery, compactMysqlQueryMap, formatMysqlQueryCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { MysqlQueryResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `mysql-query` tool on the given MCP server. */
|
|
8
|
+
export function registerMysqlQueryTool(server) {
|
|
9
|
+
server.registerTool("mysql-query", {
|
|
10
|
+
title: "MySQL Query",
|
|
11
|
+
description: "Executes a MySQL query and returns structured tabular output. " +
|
|
12
|
+
"WARNING: The query is executed as-is against the target database — do not pass untrusted input.",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
query: z.string().max(INPUT_LIMITS.STRING_MAX).describe("SQL query to execute"),
|
|
15
|
+
database: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Database name to connect to"),
|
|
20
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database host"),
|
|
21
|
+
port: z.number().optional().describe("Database port (default: 3306)"),
|
|
22
|
+
user: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database user"),
|
|
23
|
+
compact: compactInput,
|
|
24
|
+
},
|
|
25
|
+
outputSchema: MysqlQueryResultSchema,
|
|
26
|
+
}, async ({ query, database, host, port, user, compact }) => {
|
|
27
|
+
if (database)
|
|
28
|
+
assertNoFlagInjection(database, "database");
|
|
29
|
+
if (host)
|
|
30
|
+
assertNoFlagInjection(host, "host");
|
|
31
|
+
if (user)
|
|
32
|
+
assertNoFlagInjection(user, "user");
|
|
33
|
+
const args = ["--batch", "--raw", "-e", query];
|
|
34
|
+
if (database)
|
|
35
|
+
args.push(database);
|
|
36
|
+
if (host)
|
|
37
|
+
args.push("-h", host);
|
|
38
|
+
if (port !== undefined)
|
|
39
|
+
args.push("-P", String(port));
|
|
40
|
+
if (user)
|
|
41
|
+
args.push("-u", user);
|
|
42
|
+
const start = Date.now();
|
|
43
|
+
const result = await mysqlCmd(args);
|
|
44
|
+
const duration = Date.now() - start;
|
|
45
|
+
const data = parseMysqlQuery(result.stdout, result.stderr, result.exitCode, duration);
|
|
46
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
47
|
+
return compactDualOutput(data, rawOutput, formatMysqlQuery, compactMysqlQueryMap, formatMysqlQueryCompact, compact === false);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=mysql-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql-query.js","sourceRoot":"","sources":["../../src/tools/mysql-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE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ql-list-databases` tool on the given MCP server. */
|
|
3
|
+
export declare function registerPsqlListDatabasesTool(server: McpServer): void;
|
|
4
|
+
//# sourceMappingURL=psql-list-databases.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psql-list-databases.d.ts","sourceRoot":"","sources":["../../src/tools/psql-list-databases.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,wEAAwE;AACxE,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,SAAS,QAuC9D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { psqlCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parsePsqlListDatabases } from "../lib/parsers.js";
|
|
5
|
+
import { formatPsqlListDatabases, compactPsqlListDatabasesMap, formatPsqlListDatabasesCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { PsqlListDatabasesResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `psql-list-databases` tool on the given MCP server. */
|
|
8
|
+
export function registerPsqlListDatabasesTool(server) {
|
|
9
|
+
server.registerTool("psql-list-databases", {
|
|
10
|
+
title: "PostgreSQL List Databases",
|
|
11
|
+
description: "Lists all PostgreSQL databases via psql with owner, encoding, and size info.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database host"),
|
|
14
|
+
port: z.number().optional().describe("Database port (default: 5432)"),
|
|
15
|
+
user: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database user"),
|
|
16
|
+
compact: compactInput,
|
|
17
|
+
},
|
|
18
|
+
outputSchema: PsqlListDatabasesResultSchema,
|
|
19
|
+
}, async ({ host, port, user, compact }) => {
|
|
20
|
+
if (host)
|
|
21
|
+
assertNoFlagInjection(host, "host");
|
|
22
|
+
if (user)
|
|
23
|
+
assertNoFlagInjection(user, "user");
|
|
24
|
+
const args = ["-l", "-A"];
|
|
25
|
+
if (host)
|
|
26
|
+
args.push("-h", host);
|
|
27
|
+
if (port !== undefined)
|
|
28
|
+
args.push("-p", String(port));
|
|
29
|
+
if (user)
|
|
30
|
+
args.push("-U", user);
|
|
31
|
+
const start = Date.now();
|
|
32
|
+
const result = await psqlCmd(args);
|
|
33
|
+
const duration = Date.now() - start;
|
|
34
|
+
const data = parsePsqlListDatabases(result.stdout, result.stderr, result.exitCode, duration);
|
|
35
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
36
|
+
return compactDualOutput(data, rawOutput, formatPsqlListDatabases, compactPsqlListDatabasesMap, formatPsqlListDatabasesCompact, compact === false);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=psql-list-databases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psql-list-databases.js","sourceRoot":"","sources":["../../src/tools/psql-list-databases.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEpE,wEAAwE;AACxE,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAC7D,MAAM,CAAC,YAAY,CACjB,qBAAqB,EACrB;QACE,KAAK,EAAE,2BAA2B;QAClC,WAAW,EAAE,8EAA8E;QAC3F,WAA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,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAC7F,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,8BAA8B,EAC9B,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psql-query.d.ts","sourceRoot":"","sources":["../../src/tools/psql-query.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,+DAA+D;AAC/D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QAiDtD"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { psqlCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parsePsqlQuery } from "../lib/parsers.js";
|
|
5
|
+
import { formatPsqlQuery, compactPsqlQueryMap, formatPsqlQueryCompact } from "../lib/formatters.js";
|
|
6
|
+
import { PsqlQueryResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `psql-query` tool on the given MCP server. */
|
|
8
|
+
export function registerPsqlQueryTool(server) {
|
|
9
|
+
server.registerTool("psql-query", {
|
|
10
|
+
title: "PostgreSQL Query",
|
|
11
|
+
description: "Executes a PostgreSQL query via psql and returns structured tabular output. " +
|
|
12
|
+
"WARNING: The query is executed as-is against the target database — do not pass untrusted input.",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
query: z.string().max(INPUT_LIMITS.STRING_MAX).describe("SQL query to execute"),
|
|
15
|
+
database: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Database name to connect to"),
|
|
20
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database host"),
|
|
21
|
+
port: z.number().optional().describe("Database port (default: 5432)"),
|
|
22
|
+
user: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Database user"),
|
|
23
|
+
compact: compactInput,
|
|
24
|
+
},
|
|
25
|
+
outputSchema: PsqlQueryResultSchema,
|
|
26
|
+
}, async ({ query, database, host, port, user, compact }) => {
|
|
27
|
+
if (database)
|
|
28
|
+
assertNoFlagInjection(database, "database");
|
|
29
|
+
if (host)
|
|
30
|
+
assertNoFlagInjection(host, "host");
|
|
31
|
+
if (user)
|
|
32
|
+
assertNoFlagInjection(user, "user");
|
|
33
|
+
const args = ["-A", "-c", query];
|
|
34
|
+
if (database)
|
|
35
|
+
args.push("-d", database);
|
|
36
|
+
if (host)
|
|
37
|
+
args.push("-h", host);
|
|
38
|
+
if (port !== undefined)
|
|
39
|
+
args.push("-p", String(port));
|
|
40
|
+
if (user)
|
|
41
|
+
args.push("-U", user);
|
|
42
|
+
const start = Date.now();
|
|
43
|
+
const result = await psqlCmd(args);
|
|
44
|
+
const duration = Date.now() - start;
|
|
45
|
+
const data = parsePsqlQuery(result.stdout, result.stderr, result.exitCode, duration);
|
|
46
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
47
|
+
return compactDualOutput(data, rawOutput, formatPsqlQuery, compactPsqlQueryMap, formatPsqlQueryCompact, compact === false);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=psql-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psql-query.js","sourceRoot":"","sources":["../../src/tools/psql-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,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O,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-command.d.ts","sourceRoot":"","sources":["../../src/tools/redis-command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAgBzE,kEAAkE;AAClE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,QA4DzD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { redisCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseRedisCommand } from "../lib/parsers.js";
|
|
5
|
+
import { formatRedisCommand, compactRedisCommandMap, formatRedisCommandCompact, } from "../lib/formatters.js";
|
|
6
|
+
import { RedisCommandResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `redis-command` tool on the given MCP server. */
|
|
8
|
+
export function registerRedisCommandTool(server) {
|
|
9
|
+
server.registerTool("redis-command", {
|
|
10
|
+
title: "Redis Command",
|
|
11
|
+
description: "Executes a Redis command via redis-cli and returns the response. " +
|
|
12
|
+
"WARNING: The command is executed as-is — do not pass untrusted input.",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
command: z
|
|
15
|
+
.string()
|
|
16
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
17
|
+
.describe("Redis command to execute (e.g., GET, SET, KEYS, DBSIZE)"),
|
|
18
|
+
args: z
|
|
19
|
+
.array(z.string().max(INPUT_LIMITS.STRING_MAX))
|
|
20
|
+
.max(INPUT_LIMITS.ARRAY_MAX)
|
|
21
|
+
.optional()
|
|
22
|
+
.default([])
|
|
23
|
+
.describe("Arguments for the Redis command"),
|
|
24
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Redis host"),
|
|
25
|
+
port: z.number().optional().describe("Redis port (default: 6379)"),
|
|
26
|
+
password: z
|
|
27
|
+
.string()
|
|
28
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Redis password (AUTH)"),
|
|
31
|
+
db: z.number().optional().describe("Redis database number"),
|
|
32
|
+
compact: compactInput,
|
|
33
|
+
},
|
|
34
|
+
outputSchema: RedisCommandResultSchema,
|
|
35
|
+
}, async ({ command, args, host, port, password, db, compact }) => {
|
|
36
|
+
assertNoFlagInjection(command, "command");
|
|
37
|
+
const cliArgs = [];
|
|
38
|
+
if (host) {
|
|
39
|
+
assertNoFlagInjection(host, "host");
|
|
40
|
+
cliArgs.push("-h", host);
|
|
41
|
+
}
|
|
42
|
+
if (port !== undefined)
|
|
43
|
+
cliArgs.push("-p", String(port));
|
|
44
|
+
if (password)
|
|
45
|
+
cliArgs.push("-a", password);
|
|
46
|
+
if (db !== undefined)
|
|
47
|
+
cliArgs.push("-n", String(db));
|
|
48
|
+
cliArgs.push(command, ...(args || []));
|
|
49
|
+
const start = Date.now();
|
|
50
|
+
const result = await redisCmd(cliArgs);
|
|
51
|
+
const duration = Date.now() - start;
|
|
52
|
+
const data = parseRedisCommand(result.stdout, result.stderr, result.exitCode, duration);
|
|
53
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
54
|
+
return compactDualOutput(data, rawOutput, formatRedisCommand, compactRedisCommandMap, formatRedisCommandCompact, compact === false);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=redis-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-command.js","sourceRoot":"","sources":["../../src/tools/redis-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;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MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-info.d.ts","sourceRoot":"","sources":["../../src/tools/redis-info.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,+DAA+D;AAC/D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QAmDtD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { redisCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseRedisInfo } from "../lib/parsers.js";
|
|
5
|
+
import { formatRedisInfo, compactRedisInfoMap, formatRedisInfoCompact } from "../lib/formatters.js";
|
|
6
|
+
import { RedisInfoResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `redis-info` tool on the given MCP server. */
|
|
8
|
+
export function registerRedisInfoTool(server) {
|
|
9
|
+
server.registerTool("redis-info", {
|
|
10
|
+
title: "Redis Info",
|
|
11
|
+
description: "Gets Redis server info with structured sections (server, clients, memory, etc.).",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
section: z
|
|
14
|
+
.string()
|
|
15
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Specific info section to retrieve (e.g., server, clients, memory, stats)"),
|
|
18
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Redis host"),
|
|
19
|
+
port: z.number().optional().describe("Redis port (default: 6379)"),
|
|
20
|
+
password: z
|
|
21
|
+
.string()
|
|
22
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
23
|
+
.optional()
|
|
24
|
+
.describe("Redis password (AUTH)"),
|
|
25
|
+
compact: compactInput,
|
|
26
|
+
},
|
|
27
|
+
outputSchema: RedisInfoResultSchema,
|
|
28
|
+
}, async ({ section, host, port, password, compact }) => {
|
|
29
|
+
if (section)
|
|
30
|
+
assertNoFlagInjection(section, "section");
|
|
31
|
+
if (host)
|
|
32
|
+
assertNoFlagInjection(host, "host");
|
|
33
|
+
const args = [];
|
|
34
|
+
if (host)
|
|
35
|
+
args.push("-h", host);
|
|
36
|
+
if (port !== undefined)
|
|
37
|
+
args.push("-p", String(port));
|
|
38
|
+
if (password)
|
|
39
|
+
args.push("-a", password);
|
|
40
|
+
args.push("INFO");
|
|
41
|
+
if (section)
|
|
42
|
+
args.push(section);
|
|
43
|
+
const start = Date.now();
|
|
44
|
+
const result = await redisCmd(args);
|
|
45
|
+
const duration = Date.now() - start;
|
|
46
|
+
const data = parseRedisInfo(result.stdout, result.stderr, result.exitCode, duration);
|
|
47
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
48
|
+
return compactDualOutput(data, rawOutput, formatRedisInfo, compactRedisInfoMap, formatRedisInfoCompact, compact === false);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=redis-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-info.js","sourceRoot":"","sources":["../../src/tools/redis-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,YAAY,EACZ,YAAY,GACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,mBAAm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C,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,IAAI,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,IAAI,OAAO;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAEpC,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis-ping.d.ts","sourceRoot":"","sources":["../../src/tools/redis-ping.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAYzE,+DAA+D;AAC/D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QA2CtD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { compactDualOutput, assertNoFlagInjection, INPUT_LIMITS, compactInput, } from "@paretools/shared";
|
|
3
|
+
import { redisCmd } from "../lib/db-runner.js";
|
|
4
|
+
import { parseRedisPing } from "../lib/parsers.js";
|
|
5
|
+
import { formatRedisPing, compactRedisPingMap, formatRedisPingCompact } from "../lib/formatters.js";
|
|
6
|
+
import { RedisPingResultSchema } from "../schemas/index.js";
|
|
7
|
+
/** Registers the `redis-ping` tool on the given MCP server. */
|
|
8
|
+
export function registerRedisPingTool(server) {
|
|
9
|
+
server.registerTool("redis-ping", {
|
|
10
|
+
title: "Redis Ping",
|
|
11
|
+
description: "Tests Redis connectivity by sending a PING command.",
|
|
12
|
+
inputSchema: {
|
|
13
|
+
host: z.string().max(INPUT_LIMITS.SHORT_STRING_MAX).optional().describe("Redis host"),
|
|
14
|
+
port: z.number().optional().describe("Redis port (default: 6379)"),
|
|
15
|
+
password: z
|
|
16
|
+
.string()
|
|
17
|
+
.max(INPUT_LIMITS.SHORT_STRING_MAX)
|
|
18
|
+
.optional()
|
|
19
|
+
.describe("Redis password (AUTH)"),
|
|
20
|
+
compact: compactInput,
|
|
21
|
+
},
|
|
22
|
+
outputSchema: RedisPingResultSchema,
|
|
23
|
+
}, async ({ host, port, password, compact }) => {
|
|
24
|
+
if (host)
|
|
25
|
+
assertNoFlagInjection(host, "host");
|
|
26
|
+
const args = [];
|
|
27
|
+
if (host)
|
|
28
|
+
args.push("-h", host);
|
|
29
|
+
if (port !== undefined)
|
|
30
|
+
args.push("-p", String(port));
|
|
31
|
+
if (password)
|
|
32
|
+
args.push("-a", password);
|
|
33
|
+
args.push("PING");
|
|
34
|
+
const start = Date.now();
|
|
35
|
+
const result = await redisCmd(args);
|
|
36
|
+
const duration = Date.now() - start;
|
|
37
|
+
const data = parseRedisPing(result.stdout, result.stderr, result.exitCode, duration);
|
|
38
|
+
const rawOutput = (result.stdout + "\n" + result.stderr).trim();
|
|
39
|
+
return compactDualOutput(data, rawOutput, formatRedisPing, compactRedisPingMap, formatRedisPingCompact, compact === false);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=redis-ping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AC,CAAC;QAE9C,MAAM,IAAI,GAAa,EAAE,CAAC;QAC1B,IAAI,IAAI;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAChC,IAAI,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACtD,IAAI,QAAQ;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QAEpC,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACrF,MAAM,SAAS,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAChE,OAAO,iBAAiB,CACtB,IAAI,EACJ,SAAS,EACT,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,OAAO,KAAK,KAAK,CAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paretools/db",
|
|
3
|
+
"version": "0.11.0",
|
|
4
|
+
"mcpName": "io.github.Dave-London/pare-db",
|
|
5
|
+
"description": "MCP server for database CLI operations with structured, token-efficient output",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"mcp",
|
|
9
|
+
"mcp-server",
|
|
10
|
+
"model-context-protocol",
|
|
11
|
+
"structured-output",
|
|
12
|
+
"ai",
|
|
13
|
+
"ai-agent",
|
|
14
|
+
"claude",
|
|
15
|
+
"cursor",
|
|
16
|
+
"copilot",
|
|
17
|
+
"token-efficient",
|
|
18
|
+
"devtools",
|
|
19
|
+
"cli",
|
|
20
|
+
"database",
|
|
21
|
+
"postgresql",
|
|
22
|
+
"mysql",
|
|
23
|
+
"redis",
|
|
24
|
+
"mongodb"
|
|
25
|
+
],
|
|
26
|
+
"homepage": "https://github.com/Dave-London/Pare/tree/main/packages/server-db",
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=20"
|
|
29
|
+
},
|
|
30
|
+
"type": "module",
|
|
31
|
+
"bin": {
|
|
32
|
+
"pare-db": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/Dave-London/Pare.git",
|
|
46
|
+
"directory": "packages/server-db"
|
|
47
|
+
},
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/Dave-London/Pare/issues"
|
|
50
|
+
},
|
|
51
|
+
"files": [
|
|
52
|
+
"dist"
|
|
53
|
+
],
|
|
54
|
+
"dependencies": {
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
56
|
+
"zod": "^4.3.6",
|
|
57
|
+
"@paretools/shared": "0.11.0"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@types/node": "^25.2.3",
|
|
61
|
+
"typescript": "^5.7.0",
|
|
62
|
+
"vitest": "^4.0.18",
|
|
63
|
+
"@paretools/tsconfig": "0.0.0"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "tsc",
|
|
67
|
+
"test": "vitest run",
|
|
68
|
+
"test:watch": "vitest",
|
|
69
|
+
"coverage": "vitest run --coverage",
|
|
70
|
+
"lint": "eslint src/"
|
|
71
|
+
}
|
|
72
|
+
}
|