@imenam/mcp-documentor 1.0.81 → 1.0.82
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/dist/src/index.js +6 -4
- package/dist/src/tools/upload-image.js +22 -7
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +1 -1
- package/gui/README.md +0 -75
package/dist/src/index.js
CHANGED
|
@@ -1251,16 +1251,18 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
1251
1251
|
},
|
|
1252
1252
|
{
|
|
1253
1253
|
name: "upload_image",
|
|
1254
|
-
description: "Upload an image to a project's assets from a
|
|
1254
|
+
description: "Upload an image to a project's assets from a file on your machine and get back the markdown link to insert in a document. Returns the URL and a ready-to-use markdown snippet: .",
|
|
1255
1255
|
inputSchema: {
|
|
1256
1256
|
type: "object",
|
|
1257
1257
|
properties: {
|
|
1258
|
-
filename: { type: "string", description: "
|
|
1259
|
-
|
|
1258
|
+
filename: { type: "string", description: "Name the image gets in the project's assets, extension included, e.g. 'screenshot.png'" },
|
|
1259
|
+
file_path: { type: "string", description: "Absolute path to the image file on the agent machine." },
|
|
1260
|
+
file_content: { type: "string", description: "Filled in by the mcp-http-gateway relay, never by the agent: the base64 content of the file read on the agent machine." },
|
|
1261
|
+
file_name: { type: "string", description: "Filled in by the mcp-http-gateway relay, never by the agent: the original name of the file read on the agent machine." },
|
|
1260
1262
|
project: { type: "string", description: "Target project whose assets receive the image. REQUIRED — never defaulted to the current project." },
|
|
1261
1263
|
alt: { type: "string", description: "Alt text for the markdown image link (optional)" },
|
|
1262
1264
|
},
|
|
1263
|
-
required: ["filename", "
|
|
1265
|
+
required: ["filename", "file_path", "project"],
|
|
1264
1266
|
},
|
|
1265
1267
|
},
|
|
1266
1268
|
{
|
|
@@ -3,7 +3,9 @@ import path from "path";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
const UploadImageArgsSchema = z.object({
|
|
5
5
|
filename: z.string().min(1),
|
|
6
|
-
|
|
6
|
+
file_path: z.string().optional(),
|
|
7
|
+
file_content: z.string().optional(),
|
|
8
|
+
file_name: z.string().optional(),
|
|
7
9
|
project: z
|
|
8
10
|
.string()
|
|
9
11
|
.min(1)
|
|
@@ -35,16 +37,29 @@ export async function uploadImage(storageEngine, args) {
|
|
|
35
37
|
content: [{ type: "text", text: `Project "${project}" does not exist. Known projects: ${knownProjects.join(", ")}.` }],
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
// Le relais du gateway a posé le contenu : il a lu le fichier sur la machine de
|
|
41
|
+
// l'agent, dont ce serveur ne voit pas le disque. Sans contenu, les deux machines
|
|
42
|
+
// n'en font qu'une et on lit le chemin directement.
|
|
43
|
+
let data;
|
|
44
|
+
if (validated.file_content) {
|
|
45
|
+
data = Buffer.from(validated.file_content.replace(/^data:[^;,]*;base64,/, ""), "base64");
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
if (!validated.file_path) {
|
|
49
|
+
return { isError: true, content: [{ type: "text", text: "file_path is required." }] };
|
|
50
|
+
}
|
|
51
|
+
if (!fs.existsSync(validated.file_path)) {
|
|
52
|
+
return {
|
|
53
|
+
isError: true,
|
|
54
|
+
content: [{ type: "text", text: `File not found: ${validated.file_path}` }],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
data = fs.readFileSync(validated.file_path);
|
|
43
58
|
}
|
|
44
59
|
const assetsDir = path.join(storageEngine.getDataDir(), "projects", project, "assets");
|
|
45
60
|
fs.mkdirSync(assetsDir, { recursive: true });
|
|
46
61
|
const finalName = resolveFilename(assetsDir, validated.filename);
|
|
47
|
-
fs.
|
|
62
|
+
fs.writeFileSync(path.join(assetsDir, finalName), data);
|
|
48
63
|
const url = `/api/images/${encodeURIComponent(project)}/${encodeURIComponent(finalName)}`;
|
|
49
64
|
const alt = validated.alt ?? "";
|
|
50
65
|
const markdownLink = ``;
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const APP_VERSION = "1.0.
|
|
1
|
+
export declare const APP_VERSION = "1.0.82";
|
package/dist/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Auto-generated version file - do not edit manually
|
|
2
|
-
export const APP_VERSION = '1.0.
|
|
2
|
+
export const APP_VERSION = '1.0.82';
|
package/package.json
CHANGED
package/gui/README.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# React + TypeScript + Vite
|
|
2
|
-
|
|
3
|
-
This app is the browser UI for MCP Documentor. Shared MCP/proxy helpers live in the Node package `@imenam/mcp-gui-interface` (used from the repo root server and `gui-worker`, not from this Vite bundle).
|
|
4
|
-
|
|
5
|
-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
6
|
-
|
|
7
|
-
Currently, two official plugins are available:
|
|
8
|
-
|
|
9
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
|
|
10
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
11
|
-
|
|
12
|
-
## React Compiler
|
|
13
|
-
|
|
14
|
-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
|
|
15
|
-
|
|
16
|
-
## Expanding the ESLint configuration
|
|
17
|
-
|
|
18
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
19
|
-
|
|
20
|
-
```js
|
|
21
|
-
export default defineConfig([
|
|
22
|
-
globalIgnores(['dist']),
|
|
23
|
-
{
|
|
24
|
-
files: ['**/*.{ts,tsx}'],
|
|
25
|
-
extends: [
|
|
26
|
-
// Other configs...
|
|
27
|
-
|
|
28
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
29
|
-
tseslint.configs.recommendedTypeChecked,
|
|
30
|
-
// Alternatively, use this for stricter rules
|
|
31
|
-
tseslint.configs.strictTypeChecked,
|
|
32
|
-
// Optionally, add this for stylistic rules
|
|
33
|
-
tseslint.configs.stylisticTypeChecked,
|
|
34
|
-
|
|
35
|
-
// Other configs...
|
|
36
|
-
],
|
|
37
|
-
languageOptions: {
|
|
38
|
-
parserOptions: {
|
|
39
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
40
|
-
tsconfigRootDir: import.meta.dirname,
|
|
41
|
-
},
|
|
42
|
-
// other options...
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
])
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
49
|
-
|
|
50
|
-
```js
|
|
51
|
-
// eslint.config.js
|
|
52
|
-
import reactX from 'eslint-plugin-react-x'
|
|
53
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
54
|
-
|
|
55
|
-
export default defineConfig([
|
|
56
|
-
globalIgnores(['dist']),
|
|
57
|
-
{
|
|
58
|
-
files: ['**/*.{ts,tsx}'],
|
|
59
|
-
extends: [
|
|
60
|
-
// Other configs...
|
|
61
|
-
// Enable lint rules for React
|
|
62
|
-
reactX.configs['recommended-typescript'],
|
|
63
|
-
// Enable lint rules for React DOM
|
|
64
|
-
reactDom.configs.recommended,
|
|
65
|
-
],
|
|
66
|
-
languageOptions: {
|
|
67
|
-
parserOptions: {
|
|
68
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
69
|
-
tsconfigRootDir: import.meta.dirname,
|
|
70
|
-
},
|
|
71
|
-
// other options...
|
|
72
|
-
},
|
|
73
|
-
},
|
|
74
|
-
])
|
|
75
|
-
```
|