@paretools/python 0.2.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 +12 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/formatters.d.ts +6 -0
- package/dist/lib/formatters.d.ts.map +1 -0
- package/dist/lib/formatters.js +42 -0
- package/dist/lib/formatters.js.map +1 -0
- package/dist/lib/parsers.d.ts +6 -0
- package/dist/lib/parsers.d.ts.map +1 -0
- package/dist/lib/parsers.js +94 -0
- package/dist/lib/parsers.js.map +1 -0
- package/dist/lib/python-runner.d.ts +5 -0
- package/dist/lib/python-runner.d.ts.map +1 -0
- package/dist/lib/python-runner.js +11 -0
- package/dist/lib/python-runner.js.map +1 -0
- package/dist/schemas/index.d.ts +258 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +56 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/tools/index.d.ts +3 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +11 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/mypy.d.ts +3 -0
- package/dist/tools/mypy.d.ts.map +1 -0
- package/dist/tools/mypy.js +28 -0
- package/dist/tools/mypy.js.map +1 -0
- package/dist/tools/pip-audit.d.ts +3 -0
- package/dist/tools/pip-audit.d.ts.map +1 -0
- package/dist/tools/pip-audit.js +27 -0
- package/dist/tools/pip-audit.js.map +1 -0
- package/dist/tools/pip-install.d.ts +3 -0
- package/dist/tools/pip-install.d.ts.map +1 -0
- package/dist/tools/pip-install.js +38 -0
- package/dist/tools/pip-install.js.map +1 -0
- package/dist/tools/ruff.d.ts +3 -0
- package/dist/tools/ruff.d.ts.map +1 -0
- package/dist/tools/ruff.js +31 -0
- package/dist/tools/ruff.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dave London
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { registerAllTools } from "./tools/index.js";
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: "@paretools/python",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
});
|
|
9
|
+
registerAllTools(server);
|
|
10
|
+
const transport = new StdioServerTransport();
|
|
11
|
+
await server.connect(transport);
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,mBAAmB;IACzB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,gBAAgB,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PipInstall, MypyResult, RuffResult, PipAuditResult } from "../schemas/index.js";
|
|
2
|
+
export declare function formatPipInstall(data: PipInstall): string;
|
|
3
|
+
export declare function formatMypy(data: MypyResult): string;
|
|
4
|
+
export declare function formatRuff(data: RuffResult): string;
|
|
5
|
+
export declare function formatPipAudit(data: PipAuditResult): string;
|
|
6
|
+
//# sourceMappingURL=formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.d.ts","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE9F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CASzD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAUnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAQnD;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAS3D"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export function formatPipInstall(data) {
|
|
2
|
+
if (data.alreadySatisfied && data.total === 0)
|
|
3
|
+
return "All requirements already satisfied.";
|
|
4
|
+
if (!data.success)
|
|
5
|
+
return "pip install failed.";
|
|
6
|
+
const lines = [`Installed ${data.total} packages:`];
|
|
7
|
+
for (const pkg of data.installed) {
|
|
8
|
+
lines.push(` ${pkg.name}==${pkg.version}`);
|
|
9
|
+
}
|
|
10
|
+
return lines.join("\n");
|
|
11
|
+
}
|
|
12
|
+
export function formatMypy(data) {
|
|
13
|
+
if (data.success && data.total === 0)
|
|
14
|
+
return "mypy: no errors found.";
|
|
15
|
+
const lines = [`mypy: ${data.errors} errors, ${data.warnings} warnings/notes`];
|
|
16
|
+
for (const d of data.diagnostics) {
|
|
17
|
+
const col = d.column ? `:${d.column}` : "";
|
|
18
|
+
const code = d.code ? ` [${d.code}]` : "";
|
|
19
|
+
lines.push(` ${d.file}:${d.line}${col} ${d.severity}: ${d.message}${code}`);
|
|
20
|
+
}
|
|
21
|
+
return lines.join("\n");
|
|
22
|
+
}
|
|
23
|
+
export function formatRuff(data) {
|
|
24
|
+
if (data.total === 0)
|
|
25
|
+
return "ruff: no issues found.";
|
|
26
|
+
const lines = [`ruff: ${data.total} issues (${data.fixable} fixable)`];
|
|
27
|
+
for (const d of data.diagnostics) {
|
|
28
|
+
lines.push(` ${d.file}:${d.line}:${d.column} ${d.code}: ${d.message}`);
|
|
29
|
+
}
|
|
30
|
+
return lines.join("\n");
|
|
31
|
+
}
|
|
32
|
+
export function formatPipAudit(data) {
|
|
33
|
+
if (data.total === 0)
|
|
34
|
+
return "No vulnerabilities found.";
|
|
35
|
+
const lines = [`${data.total} vulnerabilities:`];
|
|
36
|
+
for (const v of data.vulnerabilities) {
|
|
37
|
+
const fix = v.fixVersions.length ? ` (fix: ${v.fixVersions.join(", ")})` : "";
|
|
38
|
+
lines.push(` ${v.name}==${v.version} ${v.id}: ${v.description}${fix}`);
|
|
39
|
+
}
|
|
40
|
+
return lines.join("\n");
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatters.js","sourceRoot":"","sources":["../../src/lib/formatters.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAAC,IAAgB;IAC/C,IAAI,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,qCAAqC,CAAC;IAC5F,IAAI,CAAC,IAAI,CAAC,OAAO;QAAE,OAAO,qBAAqB,CAAC;IAEhD,MAAM,KAAK,GAAG,CAAC,aAAa,IAAI,CAAC,KAAK,YAAY,CAAC,CAAC;IACpD,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,IAAgB;IACzC,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,CAAC;QAAE,OAAO,wBAAwB,CAAC;IAEtE,MAAM,KAAK,GAAG,CAAC,SAAS,IAAI,CAAC,MAAM,YAAY,IAAI,CAAC,QAAQ,iBAAiB,CAAC,CAAC;IAC/E,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACjC,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAA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,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9E,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,WAAW,GAAG,GAAG,EAAE,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PipInstall, MypyResult, RuffResult, PipAuditResult } from "../schemas/index.js";
|
|
2
|
+
export declare function parsePipInstall(stdout: string, stderr: string, exitCode: number): PipInstall;
|
|
3
|
+
export declare function parseMypyOutput(stdout: string, exitCode: number): MypyResult;
|
|
4
|
+
export declare function parseRuffJson(stdout: string): RuffResult;
|
|
5
|
+
export declare function parsePipAuditJson(stdout: string): PipAuditResult;
|
|
6
|
+
//# sourceMappingURL=parsers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parsers.d.ts","sourceRoot":"","sources":["../../src/lib/parsers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EAEV,UAAU,EACV,cAAc,EACf,MAAM,qBAAqB,CAAC;AAM7B,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAyB5F;AAKD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CA8B5E;AAGD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAsBxD;AAYD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAmBhE"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// pip install output: "Successfully installed pkg1-1.0 pkg2-2.0" or "Requirement already satisfied"
|
|
2
|
+
export function parsePipInstall(stdout, stderr, exitCode) {
|
|
3
|
+
const output = stdout + "\n" + stderr;
|
|
4
|
+
const alreadySatisfied = output.includes("already satisfied");
|
|
5
|
+
const installed = [];
|
|
6
|
+
const installMatch = output.match(/Successfully installed (.+)/);
|
|
7
|
+
if (installMatch) {
|
|
8
|
+
const packages = installMatch[1].trim().split(/\s+/);
|
|
9
|
+
for (const pkg of packages) {
|
|
10
|
+
const lastDash = pkg.lastIndexOf("-");
|
|
11
|
+
if (lastDash > 0) {
|
|
12
|
+
installed.push({
|
|
13
|
+
name: pkg.slice(0, lastDash),
|
|
14
|
+
version: pkg.slice(lastDash + 1),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
success: exitCode === 0,
|
|
21
|
+
installed,
|
|
22
|
+
alreadySatisfied,
|
|
23
|
+
total: installed.length,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
// mypy output: file:line: severity: message [code]
|
|
27
|
+
const MYPY_RE = /^(.+?):(\d+)(?::(\d+))?: (error|warning|note): (.+?)(?:\s+\[([^\]]+)\])?$/;
|
|
28
|
+
export function parseMypyOutput(stdout, exitCode) {
|
|
29
|
+
const lines = stdout.split("\n");
|
|
30
|
+
const diagnostics = [];
|
|
31
|
+
for (const line of lines) {
|
|
32
|
+
const match = line.match(MYPY_RE);
|
|
33
|
+
if (match) {
|
|
34
|
+
diagnostics.push({
|
|
35
|
+
file: match[1],
|
|
36
|
+
line: parseInt(match[2], 10),
|
|
37
|
+
column: match[3] ? parseInt(match[3], 10) : undefined,
|
|
38
|
+
severity: match[4],
|
|
39
|
+
message: match[5],
|
|
40
|
+
code: match[6] || undefined,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const errors = diagnostics.filter((d) => d.severity === "error").length;
|
|
45
|
+
const warnings = diagnostics.filter((d) => d.severity === "warning" || d.severity === "note").length;
|
|
46
|
+
return {
|
|
47
|
+
success: exitCode === 0,
|
|
48
|
+
diagnostics,
|
|
49
|
+
total: diagnostics.length,
|
|
50
|
+
errors,
|
|
51
|
+
warnings,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
// ruff check --output-format json returns JSON array
|
|
55
|
+
export function parseRuffJson(stdout) {
|
|
56
|
+
let entries;
|
|
57
|
+
try {
|
|
58
|
+
entries = JSON.parse(stdout);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return { diagnostics: [], total: 0, fixable: 0 };
|
|
62
|
+
}
|
|
63
|
+
const diagnostics = entries.map((e) => ({
|
|
64
|
+
file: e.filename,
|
|
65
|
+
line: e.location.row,
|
|
66
|
+
column: e.location.column,
|
|
67
|
+
endLine: e.end_location?.row,
|
|
68
|
+
endColumn: e.end_location?.column,
|
|
69
|
+
code: e.code,
|
|
70
|
+
message: e.message,
|
|
71
|
+
fixable: !!e.fix,
|
|
72
|
+
}));
|
|
73
|
+
const fixable = diagnostics.filter((d) => d.fixable).length;
|
|
74
|
+
return { diagnostics, total: diagnostics.length, fixable };
|
|
75
|
+
}
|
|
76
|
+
// pip-audit --format json
|
|
77
|
+
export function parsePipAuditJson(stdout) {
|
|
78
|
+
let data;
|
|
79
|
+
try {
|
|
80
|
+
data = JSON.parse(stdout);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return { vulnerabilities: [], total: 0 };
|
|
84
|
+
}
|
|
85
|
+
const vulnerabilities = (data.dependencies ?? []).flatMap((dep) => (dep.vulns ?? []).map((v) => ({
|
|
86
|
+
name: dep.name,
|
|
87
|
+
version: dep.version,
|
|
88
|
+
id: v.id,
|
|
89
|
+
description: v.description ?? "",
|
|
90
|
+
fixVersions: v.fix_versions ?? [],
|
|
91
|
+
})));
|
|
92
|
+
return { vulnerabilities, total: vulnerabilities.length };
|
|
93
|
+
}
|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AC,CAAC,GAAG,EAAE,EAAE,CAChE,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,EAAE,EAAE,CAAC,CAAC,EAAE;QACR,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,EAAE;QAChC,WAAW,EAAE,CAAC,CAAC,YAAY,IAAI,EAAE;KAClC,CAAC,CAAC,CACJ,CAAC;IAEF,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type RunResult } from "@paretools/shared";
|
|
2
|
+
export declare function pip(args: string[], cwd?: string): Promise<RunResult>;
|
|
3
|
+
export declare function mypy(args: string[], cwd?: string): Promise<RunResult>;
|
|
4
|
+
export declare function ruff(args: string[], cwd?: string): Promise<RunResult>;
|
|
5
|
+
//# sourceMappingURL=python-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-runner.d.ts","sourceRoot":"","sources":["../../src/lib/python-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE1E;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE3E;AAED,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAE3E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { run } from "@paretools/shared";
|
|
2
|
+
export async function pip(args, cwd) {
|
|
3
|
+
return run("pip", args, { cwd });
|
|
4
|
+
}
|
|
5
|
+
export async function mypy(args, cwd) {
|
|
6
|
+
return run("mypy", args, { cwd });
|
|
7
|
+
}
|
|
8
|
+
export async function ruff(args, cwd) {
|
|
9
|
+
return run("ruff", args, { cwd });
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=python-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-runner.js","sourceRoot":"","sources":["../../src/lib/python-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAkB,MAAM,mBAAmB,CAAC;AAExD,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc,EAAE,GAAY;IACpD,OAAO,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAc,EAAE,GAAY;IACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAc,EAAE,GAAY;IACrD,OAAO,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PipInstallSchema: z.ZodObject<{
|
|
3
|
+
success: z.ZodBoolean;
|
|
4
|
+
installed: z.ZodArray<z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
version: z.ZodString;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
name: string;
|
|
9
|
+
version: string;
|
|
10
|
+
}, {
|
|
11
|
+
name: string;
|
|
12
|
+
version: string;
|
|
13
|
+
}>, "many">;
|
|
14
|
+
alreadySatisfied: z.ZodBoolean;
|
|
15
|
+
total: z.ZodNumber;
|
|
16
|
+
}, "strip", z.ZodTypeAny, {
|
|
17
|
+
success: boolean;
|
|
18
|
+
installed: {
|
|
19
|
+
name: string;
|
|
20
|
+
version: string;
|
|
21
|
+
}[];
|
|
22
|
+
alreadySatisfied: boolean;
|
|
23
|
+
total: number;
|
|
24
|
+
}, {
|
|
25
|
+
success: boolean;
|
|
26
|
+
installed: {
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
}[];
|
|
30
|
+
alreadySatisfied: boolean;
|
|
31
|
+
total: number;
|
|
32
|
+
}>;
|
|
33
|
+
export type PipInstall = z.infer<typeof PipInstallSchema>;
|
|
34
|
+
export declare const MypyDiagnosticSchema: z.ZodObject<{
|
|
35
|
+
file: z.ZodString;
|
|
36
|
+
line: z.ZodNumber;
|
|
37
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
severity: z.ZodEnum<["error", "warning", "note"]>;
|
|
39
|
+
message: z.ZodString;
|
|
40
|
+
code: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
message: string;
|
|
43
|
+
file: string;
|
|
44
|
+
line: number;
|
|
45
|
+
severity: "error" | "warning" | "note";
|
|
46
|
+
code?: string | undefined;
|
|
47
|
+
column?: number | undefined;
|
|
48
|
+
}, {
|
|
49
|
+
message: string;
|
|
50
|
+
file: string;
|
|
51
|
+
line: number;
|
|
52
|
+
severity: "error" | "warning" | "note";
|
|
53
|
+
code?: string | undefined;
|
|
54
|
+
column?: number | undefined;
|
|
55
|
+
}>;
|
|
56
|
+
export declare const MypyResultSchema: z.ZodObject<{
|
|
57
|
+
success: z.ZodBoolean;
|
|
58
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
59
|
+
file: z.ZodString;
|
|
60
|
+
line: z.ZodNumber;
|
|
61
|
+
column: z.ZodOptional<z.ZodNumber>;
|
|
62
|
+
severity: z.ZodEnum<["error", "warning", "note"]>;
|
|
63
|
+
message: z.ZodString;
|
|
64
|
+
code: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, "strip", z.ZodTypeAny, {
|
|
66
|
+
message: string;
|
|
67
|
+
file: string;
|
|
68
|
+
line: number;
|
|
69
|
+
severity: "error" | "warning" | "note";
|
|
70
|
+
code?: string | undefined;
|
|
71
|
+
column?: number | undefined;
|
|
72
|
+
}, {
|
|
73
|
+
message: string;
|
|
74
|
+
file: string;
|
|
75
|
+
line: number;
|
|
76
|
+
severity: "error" | "warning" | "note";
|
|
77
|
+
code?: string | undefined;
|
|
78
|
+
column?: number | undefined;
|
|
79
|
+
}>, "many">;
|
|
80
|
+
total: z.ZodNumber;
|
|
81
|
+
errors: z.ZodNumber;
|
|
82
|
+
warnings: z.ZodNumber;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
success: boolean;
|
|
85
|
+
total: number;
|
|
86
|
+
diagnostics: {
|
|
87
|
+
message: string;
|
|
88
|
+
file: string;
|
|
89
|
+
line: number;
|
|
90
|
+
severity: "error" | "warning" | "note";
|
|
91
|
+
code?: string | undefined;
|
|
92
|
+
column?: number | undefined;
|
|
93
|
+
}[];
|
|
94
|
+
errors: number;
|
|
95
|
+
warnings: number;
|
|
96
|
+
}, {
|
|
97
|
+
success: boolean;
|
|
98
|
+
total: number;
|
|
99
|
+
diagnostics: {
|
|
100
|
+
message: string;
|
|
101
|
+
file: string;
|
|
102
|
+
line: number;
|
|
103
|
+
severity: "error" | "warning" | "note";
|
|
104
|
+
code?: string | undefined;
|
|
105
|
+
column?: number | undefined;
|
|
106
|
+
}[];
|
|
107
|
+
errors: number;
|
|
108
|
+
warnings: number;
|
|
109
|
+
}>;
|
|
110
|
+
export type MypyResult = z.infer<typeof MypyResultSchema>;
|
|
111
|
+
export declare const RuffDiagnosticSchema: z.ZodObject<{
|
|
112
|
+
file: z.ZodString;
|
|
113
|
+
line: z.ZodNumber;
|
|
114
|
+
column: z.ZodNumber;
|
|
115
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
117
|
+
code: z.ZodString;
|
|
118
|
+
message: z.ZodString;
|
|
119
|
+
fixable: z.ZodBoolean;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
code: string;
|
|
122
|
+
message: string;
|
|
123
|
+
file: string;
|
|
124
|
+
line: number;
|
|
125
|
+
column: number;
|
|
126
|
+
fixable: boolean;
|
|
127
|
+
endLine?: number | undefined;
|
|
128
|
+
endColumn?: number | undefined;
|
|
129
|
+
}, {
|
|
130
|
+
code: string;
|
|
131
|
+
message: string;
|
|
132
|
+
file: string;
|
|
133
|
+
line: number;
|
|
134
|
+
column: number;
|
|
135
|
+
fixable: boolean;
|
|
136
|
+
endLine?: number | undefined;
|
|
137
|
+
endColumn?: number | undefined;
|
|
138
|
+
}>;
|
|
139
|
+
export declare const RuffResultSchema: z.ZodObject<{
|
|
140
|
+
diagnostics: z.ZodArray<z.ZodObject<{
|
|
141
|
+
file: z.ZodString;
|
|
142
|
+
line: z.ZodNumber;
|
|
143
|
+
column: z.ZodNumber;
|
|
144
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
145
|
+
endColumn: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
code: z.ZodString;
|
|
147
|
+
message: z.ZodString;
|
|
148
|
+
fixable: z.ZodBoolean;
|
|
149
|
+
}, "strip", z.ZodTypeAny, {
|
|
150
|
+
code: string;
|
|
151
|
+
message: string;
|
|
152
|
+
file: string;
|
|
153
|
+
line: number;
|
|
154
|
+
column: number;
|
|
155
|
+
fixable: boolean;
|
|
156
|
+
endLine?: number | undefined;
|
|
157
|
+
endColumn?: number | undefined;
|
|
158
|
+
}, {
|
|
159
|
+
code: string;
|
|
160
|
+
message: string;
|
|
161
|
+
file: string;
|
|
162
|
+
line: number;
|
|
163
|
+
column: number;
|
|
164
|
+
fixable: boolean;
|
|
165
|
+
endLine?: number | undefined;
|
|
166
|
+
endColumn?: number | undefined;
|
|
167
|
+
}>, "many">;
|
|
168
|
+
total: z.ZodNumber;
|
|
169
|
+
fixable: z.ZodNumber;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
total: number;
|
|
172
|
+
diagnostics: {
|
|
173
|
+
code: string;
|
|
174
|
+
message: string;
|
|
175
|
+
file: string;
|
|
176
|
+
line: number;
|
|
177
|
+
column: number;
|
|
178
|
+
fixable: boolean;
|
|
179
|
+
endLine?: number | undefined;
|
|
180
|
+
endColumn?: number | undefined;
|
|
181
|
+
}[];
|
|
182
|
+
fixable: number;
|
|
183
|
+
}, {
|
|
184
|
+
total: number;
|
|
185
|
+
diagnostics: {
|
|
186
|
+
code: string;
|
|
187
|
+
message: string;
|
|
188
|
+
file: string;
|
|
189
|
+
line: number;
|
|
190
|
+
column: number;
|
|
191
|
+
fixable: boolean;
|
|
192
|
+
endLine?: number | undefined;
|
|
193
|
+
endColumn?: number | undefined;
|
|
194
|
+
}[];
|
|
195
|
+
fixable: number;
|
|
196
|
+
}>;
|
|
197
|
+
export type RuffResult = z.infer<typeof RuffResultSchema>;
|
|
198
|
+
export declare const PipAuditVulnSchema: z.ZodObject<{
|
|
199
|
+
name: z.ZodString;
|
|
200
|
+
version: z.ZodString;
|
|
201
|
+
id: z.ZodString;
|
|
202
|
+
description: z.ZodString;
|
|
203
|
+
fixVersions: z.ZodArray<z.ZodString, "many">;
|
|
204
|
+
}, "strip", z.ZodTypeAny, {
|
|
205
|
+
name: string;
|
|
206
|
+
version: string;
|
|
207
|
+
id: string;
|
|
208
|
+
description: string;
|
|
209
|
+
fixVersions: string[];
|
|
210
|
+
}, {
|
|
211
|
+
name: string;
|
|
212
|
+
version: string;
|
|
213
|
+
id: string;
|
|
214
|
+
description: string;
|
|
215
|
+
fixVersions: string[];
|
|
216
|
+
}>;
|
|
217
|
+
export declare const PipAuditResultSchema: z.ZodObject<{
|
|
218
|
+
vulnerabilities: z.ZodArray<z.ZodObject<{
|
|
219
|
+
name: z.ZodString;
|
|
220
|
+
version: z.ZodString;
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
description: z.ZodString;
|
|
223
|
+
fixVersions: z.ZodArray<z.ZodString, "many">;
|
|
224
|
+
}, "strip", z.ZodTypeAny, {
|
|
225
|
+
name: string;
|
|
226
|
+
version: string;
|
|
227
|
+
id: string;
|
|
228
|
+
description: string;
|
|
229
|
+
fixVersions: string[];
|
|
230
|
+
}, {
|
|
231
|
+
name: string;
|
|
232
|
+
version: string;
|
|
233
|
+
id: string;
|
|
234
|
+
description: string;
|
|
235
|
+
fixVersions: string[];
|
|
236
|
+
}>, "many">;
|
|
237
|
+
total: z.ZodNumber;
|
|
238
|
+
}, "strip", z.ZodTypeAny, {
|
|
239
|
+
total: number;
|
|
240
|
+
vulnerabilities: {
|
|
241
|
+
name: string;
|
|
242
|
+
version: string;
|
|
243
|
+
id: string;
|
|
244
|
+
description: string;
|
|
245
|
+
fixVersions: string[];
|
|
246
|
+
}[];
|
|
247
|
+
}, {
|
|
248
|
+
total: number;
|
|
249
|
+
vulnerabilities: {
|
|
250
|
+
name: string;
|
|
251
|
+
version: string;
|
|
252
|
+
id: string;
|
|
253
|
+
description: string;
|
|
254
|
+
fixVersions: string[];
|
|
255
|
+
}[];
|
|
256
|
+
}>;
|
|
257
|
+
export type PipAuditResult = z.infer<typeof PipAuditResultSchema>;
|
|
258
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAU3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;EAO/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAM3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS/B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAG1D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;EAM7B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// pip install
|
|
3
|
+
export const PipInstallSchema = z.object({
|
|
4
|
+
success: z.boolean(),
|
|
5
|
+
installed: z.array(z.object({
|
|
6
|
+
name: z.string(),
|
|
7
|
+
version: z.string(),
|
|
8
|
+
})),
|
|
9
|
+
alreadySatisfied: z.boolean(),
|
|
10
|
+
total: z.number(),
|
|
11
|
+
});
|
|
12
|
+
// mypy
|
|
13
|
+
export const MypyDiagnosticSchema = z.object({
|
|
14
|
+
file: z.string(),
|
|
15
|
+
line: z.number(),
|
|
16
|
+
column: z.number().optional(),
|
|
17
|
+
severity: z.enum(["error", "warning", "note"]),
|
|
18
|
+
message: z.string(),
|
|
19
|
+
code: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
export const MypyResultSchema = z.object({
|
|
22
|
+
success: z.boolean(),
|
|
23
|
+
diagnostics: z.array(MypyDiagnosticSchema),
|
|
24
|
+
total: z.number(),
|
|
25
|
+
errors: z.number(),
|
|
26
|
+
warnings: z.number(),
|
|
27
|
+
});
|
|
28
|
+
// ruff check
|
|
29
|
+
export const RuffDiagnosticSchema = z.object({
|
|
30
|
+
file: z.string(),
|
|
31
|
+
line: z.number(),
|
|
32
|
+
column: z.number(),
|
|
33
|
+
endLine: z.number().optional(),
|
|
34
|
+
endColumn: z.number().optional(),
|
|
35
|
+
code: z.string(),
|
|
36
|
+
message: z.string(),
|
|
37
|
+
fixable: z.boolean(),
|
|
38
|
+
});
|
|
39
|
+
export const RuffResultSchema = z.object({
|
|
40
|
+
diagnostics: z.array(RuffDiagnosticSchema),
|
|
41
|
+
total: z.number(),
|
|
42
|
+
fixable: z.number(),
|
|
43
|
+
});
|
|
44
|
+
// pip audit
|
|
45
|
+
export const PipAuditVulnSchema = z.object({
|
|
46
|
+
name: z.string(),
|
|
47
|
+
version: z.string(),
|
|
48
|
+
id: z.string(),
|
|
49
|
+
description: z.string(),
|
|
50
|
+
fixVersions: z.array(z.string()),
|
|
51
|
+
});
|
|
52
|
+
export const PipAuditResultSchema = z.object({
|
|
53
|
+
vulnerabilities: z.array(PipAuditVulnSchema),
|
|
54
|
+
total: z.number(),
|
|
55
|
+
});
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,cAAc;AACd,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,KA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ip-install.js";
|
|
2
|
+
import { registerMypyTool } from "./mypy.js";
|
|
3
|
+
import { registerRuffTool } from "./ruff.js";
|
|
4
|
+
import { registerPipAuditTool } from "./pip-audit.js";
|
|
5
|
+
export function registerAllTools(server) {
|
|
6
|
+
registerPipInstallTool(server);
|
|
7
|
+
registerMypyTool(server);
|
|
8
|
+
registerRuffTool(server);
|
|
9
|
+
registerPipAuditTool(server);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACzB,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mypy.d.ts","sourceRoot":"","sources":["../../src/tools/mypy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QA0BjD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { mypy } from "../lib/python-runner.js";
|
|
4
|
+
import { parseMypyOutput } from "../lib/parsers.js";
|
|
5
|
+
import { formatMypy } from "../lib/formatters.js";
|
|
6
|
+
import { MypyResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerMypyTool(server) {
|
|
8
|
+
server.registerTool("mypy", {
|
|
9
|
+
title: "mypy Type Check",
|
|
10
|
+
description: "Runs mypy and returns structured type-check diagnostics (file, line, severity, message, code)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
targets: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["."])
|
|
17
|
+
.describe("Files or directories to check (default: ['.'])"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: MypyResultSchema,
|
|
20
|
+
}, async ({ path, targets }) => {
|
|
21
|
+
const cwd = path || process.cwd();
|
|
22
|
+
const args = [...(targets || ["."])];
|
|
23
|
+
const result = await mypy(args, cwd);
|
|
24
|
+
const data = parseMypyOutput(result.stdout, result.exitCode);
|
|
25
|
+
return dualOutput(data, formatMypy);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mypy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mypy.js","sourceRoot":"","sources":["../../src/tools/mypy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,MAAM,EACN;QACE,KAAK,EAAE,iBAAiB;QACxB,WAAW,EACT,+FAA+F;QACjG,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,OAAO,EAAE,CAAC;iBACP,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;iBACd,QAAQ,CAAC,gDAAgD,CAAC;SAC9D;QACD,YAAY,EAAE,gBAAgB;KAC/B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;QAC1B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAErC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7D,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-audit.d.ts","sourceRoot":"","sources":["../../src/tools/pip-audit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,QAwBrD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { parsePipAuditJson } from "../lib/parsers.js";
|
|
4
|
+
import { formatPipAudit } from "../lib/formatters.js";
|
|
5
|
+
import { PipAuditResultSchema } from "../schemas/index.js";
|
|
6
|
+
export function registerPipAuditTool(server) {
|
|
7
|
+
server.registerTool("pip-audit", {
|
|
8
|
+
title: "pip Audit",
|
|
9
|
+
description: "Runs pip-audit and returns a structured vulnerability report",
|
|
10
|
+
inputSchema: {
|
|
11
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
12
|
+
requirements: z.string().optional().describe("Path to requirements file"),
|
|
13
|
+
},
|
|
14
|
+
outputSchema: PipAuditResultSchema,
|
|
15
|
+
}, async ({ path, requirements }) => {
|
|
16
|
+
const cwd = path || process.cwd();
|
|
17
|
+
const args = ["audit", "--format", "json"];
|
|
18
|
+
if (requirements)
|
|
19
|
+
args.push("-r", requirements);
|
|
20
|
+
// pip-audit is a separate tool: pip-audit (not pip audit)
|
|
21
|
+
const { run } = await import("@paretools/shared");
|
|
22
|
+
const result = await run("pip-audit", args, { cwd });
|
|
23
|
+
const data = parsePipAuditJson(result.stdout);
|
|
24
|
+
return dualOutput(data, formatPipAudit);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=pip-audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-audit.js","sourceRoot":"","sources":["../../src/tools/pip-audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,UAAU,oBAAoB,CAAC,MAAiB;IACpD,MAAM,CAAC,YAAY,CACjB,WAAW,EACX;QACE,KAAK,EAAE,WAAW;QAClB,WAAW,EAAE,8DAA8D;QAC3E,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;SAC1E;QACD,YAAY,EAAE,oBAAoB;KACnC,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAC3C,IAAI,YAAY;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAEhD,0DAA0D;QAC1D,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAClD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,UAAU,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC1C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-install.d.ts","sourceRoot":"","sources":["../../src/tools/pip-install.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QAiCvD"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { pip } from "../lib/python-runner.js";
|
|
4
|
+
import { parsePipInstall } from "../lib/parsers.js";
|
|
5
|
+
import { formatPipInstall } from "../lib/formatters.js";
|
|
6
|
+
import { PipInstallSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerPipInstallTool(server) {
|
|
8
|
+
server.registerTool("pip-install", {
|
|
9
|
+
title: "pip Install",
|
|
10
|
+
description: "Runs pip install and returns a structured summary of installed packages",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
packages: z
|
|
13
|
+
.array(z.string())
|
|
14
|
+
.optional()
|
|
15
|
+
.default([])
|
|
16
|
+
.describe("Packages to install (empty for requirements.txt)"),
|
|
17
|
+
requirements: z.string().optional().describe("Path to requirements file"),
|
|
18
|
+
path: z.string().optional().describe("Working directory (default: cwd)"),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: PipInstallSchema,
|
|
21
|
+
}, async ({ packages, requirements, path }) => {
|
|
22
|
+
const cwd = path || process.cwd();
|
|
23
|
+
const args = ["install"];
|
|
24
|
+
if (requirements) {
|
|
25
|
+
args.push("-r", requirements);
|
|
26
|
+
}
|
|
27
|
+
else if (packages && packages.length > 0) {
|
|
28
|
+
args.push(...packages);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
args.push("-r", "requirements.txt");
|
|
32
|
+
}
|
|
33
|
+
const result = await pip(args, cwd);
|
|
34
|
+
const data = parsePipInstall(result.stdout, result.stderr, result.exitCode);
|
|
35
|
+
return dualOutput(data, formatPipInstall);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=pip-install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pip-install.js","sourceRoot":"","sources":["../../src/tools/pip-install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EA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M,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC5E,OAAO,UAAU,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;IAC5C,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruff.d.ts","sourceRoot":"","sources":["../../src/tools/ruff.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAOzE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,QA4BjD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { dualOutput } from "@paretools/shared";
|
|
3
|
+
import { ruff } from "../lib/python-runner.js";
|
|
4
|
+
import { parseRuffJson } from "../lib/parsers.js";
|
|
5
|
+
import { formatRuff } from "../lib/formatters.js";
|
|
6
|
+
import { RuffResultSchema } from "../schemas/index.js";
|
|
7
|
+
export function registerRuffTool(server) {
|
|
8
|
+
server.registerTool("ruff-check", {
|
|
9
|
+
title: "ruff Lint",
|
|
10
|
+
description: "Runs ruff check and returns structured lint diagnostics (file, line, code, message)",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
path: z.string().optional().describe("Project root path (default: cwd)"),
|
|
13
|
+
targets: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.optional()
|
|
16
|
+
.default(["."])
|
|
17
|
+
.describe("Files or directories to check (default: ['.'])"),
|
|
18
|
+
fix: z.boolean().optional().default(false).describe("Auto-fix problems"),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: RuffResultSchema,
|
|
21
|
+
}, async ({ path, targets, fix }) => {
|
|
22
|
+
const cwd = path || process.cwd();
|
|
23
|
+
const args = ["check", "--output-format", "json", ...(targets || ["."])];
|
|
24
|
+
if (fix)
|
|
25
|
+
args.push("--fix");
|
|
26
|
+
const result = await ruff(args, cwd);
|
|
27
|
+
const data = parseRuffJson(result.stdout);
|
|
28
|
+
return dualOutput(data, formatRuff);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ruff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ruff.js","sourceRoot":"","sources":["../../src/tools/ruff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,UAAU,gBAAgB,CAAC,MAAiB;IAChD,MAAM,CAAC,YAAY,CACjB,YAAY,EACZ;QACE,KAAK,EAAE,WAAW;QAClB,WAAW,EACT,qFAAqF;QACvF,WAAW,EAAE;YACX,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;YACxE,OAAO,EAAE,CAAC;iBACP,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB,QAAQ,EAAE;iBACV,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;iBACd,QAAQ,CAAC,gDAAgD,CAAC;YAC7D,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;SACzE;QACD,YAAY,EAAE,gBAAgB;KAC/B,EACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACzE,IAAI,GAAG;YAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE5B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paretools/python",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP server for Python tools (pip, mypy, ruff) with structured, token-efficient output",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pare-python": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/Dave-London/pare.git",
|
|
22
|
+
"directory": "packages/server-python"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
29
|
+
"zod": "^3.25.0",
|
|
30
|
+
"@paretools/shared": "0.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.0.0",
|
|
34
|
+
"typescript": "^5.7.0",
|
|
35
|
+
"vitest": "^3.0.0",
|
|
36
|
+
"@paretools/tsconfig": "0.0.0"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"build": "tsc",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"lint": "eslint src/"
|
|
43
|
+
}
|
|
44
|
+
}
|