@imenam/mcp-organizer 1.0.29 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -230,7 +230,7 @@ Les outils MCP sont destinés à l'agent ; leurs schémas JSON sont écrits à l
230
230
  | `edit_checklist` | `POST tasks/:ref/checklist` | Ajoute (en fin de liste, ou juste après `after_item_id`, `null` : en tête), renomme, coche, déplace (`move`, juste après `after_item_id`) ou supprime des éléments de checklist ; ajoute, renomme, déplace ou supprime des points de vérification d'un test (tout ou rien) ; l'annulation d'un déplacement remet l'élément à sa place |
231
231
  | `edit_questions` | `POST tasks/:ref/questions` | Pose, reformule ou supprime des questions d'une tâche (choix unique ou multiple) et leurs propositions (libellé, détail markdown, recommandation) ; les réponses appartiennent aux membres (tout ou rien) |
232
232
  | `add_comment` | `POST tasks/:ref/comments` | Commentaire de l'agent ; assignés et commentateurs précédents notifiés |
233
- | `add_attachment` | `POST tasks/:ref/attachments` (multipart) | Joint à une tâche de l'espace un fichier local désigné par son chemin absolu (`path`, `name` facultatif) : le mode MCP le lit et l'envoie en multipart, son contenu ne passe jamais par l'agent. `comment` publie un commentaire avec la référence au fichier (miniature pour une image, nom sinon), `append_to_description` l'ajoute en fin de description. Chaque élément est une action annulable du lot |
233
+ | `add_attachment` | `POST tasks/:ref/attachments` (multipart) | Joint à une tâche de l'espace un fichier local désigné par son chemin absolu (`file_path`, `name` facultatif) : le mode MCP le lit et l'envoie en multipart, son contenu ne passe jamais par l'agent. À défaut, `file_content` (base64) et `file_name` portent le fichier lui-même : c'est la paire que remplit le relais de mcp-http-gateway. `comment` publie un commentaire avec la référence au fichier (miniature pour une image, nom sinon), `append_to_description` l'ajoute en fin de description. Chaque élément est une action annulable du lot |
234
234
  | `create_idea` / `update_idea` | `POST ideas`, `PATCH ideas/:id` | Idée dans la boîte à idées ; reformulation, archivage |
235
235
  | `promote_idea` | `POST ideas/:id/promote` | Crée une tâche à partir d'une idée et marque l'idée promue |
236
236
  | `list_views` | `GET views?request_id=…` | Vues du tableau de bord de l'auteur de la demande (sans `request_id` : du propriétaire du jeton) : disposition, regroupements, groupes vides, filtres |
@@ -678,7 +678,7 @@ Un non-membre reçoit la même réponse qu'un espace ou une tâche inexistants (
678
678
  - **Pièces jointes** : 20 Mo au plus, stockées sous `<données>/attachments/<id>` ; supprimer une pièce jointe, sa tâche ou son espace efface le fichier.
679
679
  - **Images collées** : une image du presse-papiers (Ctrl+V / Cmd+V, ou « Coller » d'un appui long dans un champ sur téléphone) collée dans le détail d'une tâche devient une pièce jointe de la tâche, nommée `capture-AAAA-MM-JJ-HHMMSS.png` (suivi de `-2`, `-3`… pour les images suivantes d'un même collage). Formats acceptés : PNG, JPEG, GIF et WebP, dans la limite des pièces jointes. L'envoi s'affiche dans la liste des pièces jointes, qui signale un format refusé ou une image trop lourde. Dans un champ de saisie, un collage qui porte aussi du texte (cellules d'un tableur) reste un collage de texte.
680
680
  - **Fichiers vus par l'agent** : `get_attachment` (pièces jointes des tâches) et `get_document` (documents de référence) montrent une image à l'agent comme bloc de contenu image MCP, relayé tel quel par le mode MCP. Le site prépare l'image avec sharp pour l'API de Claude : une image PNG, JPEG, GIF ou WebP d'au plus 2000 px de côté et 5 Mo en base64 part telle quelle ; une image plus grande ou plus lourde (photo de téléphone, capture d'un grand écran) est réduite à 2000 px de côté, puis recompressée (PNG, ou JPEG de qualité et de taille décroissantes) jusqu'à tenir dans 5 Mo ; une image animée est réduite à sa première image et un autre format (TIFF…) converti. Une image que le site ne sait pas décoder est une erreur explicite. Le texte d'un PDF est extrait avec unpdf (pdf.js, sans module natif). Le mode MCP ne charge ni sharp ni unpdf.
681
- - **Fichiers envoyés par l'agent** : `add_attachment` prend le chemin absolu d'un fichier sur la machine où tourne le mode MCP (le poste de l'utilisateur pour Claude Code, le serveur pour le runner). Le mode MCP le lit avec les droits de l'utilisateur qui l'a lancé, refuse un chemin relatif, introuvable, un dossier, un fichier spécial et un fichier de plus de 20 Mo, puis l'envoie au site en multipart (champ `file`, comme le navigateur) : le contenu ne passe jamais par la conversation de l'agent. Le type est déduit de l'extension ; tous les formats sont acceptés, comme pour les pièces jointes des membres. La pièce jointe, le commentaire qui la montre et l'ajout à la description sont trois actions du lot de la demande (ou d'une action directe) ; annuler le lot les retire et efface le fichier.
681
+ - **Fichiers envoyés par l'agent** : `add_attachment` prend le chemin absolu d'un fichier (`file_path`) sur la machine où tourne le mode MCP (le poste de l'utilisateur pour Claude Code, le serveur pour le runner). Le mode MCP le lit avec les droits de l'utilisateur qui l'a lancé, refuse un chemin relatif, introuvable, un dossier, un fichier spécial et un fichier de plus de 20 Mo, puis l'envoie au site en multipart (champ `file`, comme le navigateur) : le contenu ne passe jamais par la conversation de l'agent. Le type est déduit de l'extension ; tous les formats sont acceptés, comme pour les pièces jointes des membres. Dans une gateway, le mode MCP tourne sur la machine de la gateway et ne voit pas le disque de l'agent : l'outil déclare donc aussi la paire `file_path` / `file_content` de la convention de mcp-http-gateway. Le relais `--mcp` lit le fichier sur la machine de l'agent (dans les dossiers de `GATEWAY_INLINE_ROOTS`), le transmet en base64 dans `file_content` avec son nom dans `file_name`, et cache ces deux paramètres à l'agent ; le mode MCP décode le contenu (base64 invalide et fichier de plus de 20 Mo refusés) et l'envoie comme un fichier lu sur son disque. La pièce jointe, le commentaire qui la montre et l'ajout à la description sont trois actions du lot de la demande (ou d'une action directe) ; annuler le lot les retire et efface le fichier.
682
682
  - **Images dans les textes** : une image collée dans un commentaire (zone de saisie ou modification), dans le commentaire d'un point de vérification ou dans la description, ou ajoutée par le bouton « Image » de la zone de commentaire ou par le + en bout de champ du commentaire d'un point (sur téléphone, ils ouvrent la galerie ou l'appareil photo), est jointe à la tâche puis référencée dans le texte par `![nom](attachment:<id>)`, sur sa propre ligne au curseur. Avant l'envoi, un aperçu montre la miniature de chaque image avec « Retirer », qui supprime la pièce jointe et sa référence, et les envois en cours, pendant lesquels l'envoi du commentaire attend. Publiée, l'image s'affiche en miniature dans le texte et s'ouvre en grand d'un clic ; une pièce jointe supprimée laisse « Image supprimée ». Supprimer un commentaire laisse ses images dans les pièces jointes de la tâche. Une image choisie par le bouton garde son nom de fichier.
683
683
  - **Questions** : l'agent pose dans une tâche, de tout type, des questions qui tranchent un point avec les membres (`edit_questions`). Chacune propose des réponses, un seul choix ou plusieurs, avec un détail markdown et la recommandation de l'agent, plus une réponse libre. Tout membre de l'espace y répond depuis le détail de la tâche (`PUT /api/questions/:id/answer`) ; pour un choix unique, la réponse est une proposition ou la réponse libre. Une question est répondue dès qu'une réponse y est enregistrée, par n'importe quel membre (une proposition choisie ou une réponse libre) ; une réponse vidée la remet à trancher. Répondre n'envoie rien à l'agent : il lit les réponses avec `get_task` quand il consulte la tâche, et ne les traite que si un membre le lui demande, par un message ou par un commentaire qui mentionne `@agent`. Les questions et propositions écrites par l'agent sont des actions de son lot, annulables tant que personne n'a répondu depuis ; une question supprimée revient avec sa réponse.
684
684
  - **Tâches de test** : des points de vérification à la place d'une checklist ; chaque testeur saisit son propre résultat par point (`ok`, `ko`, `blocked`, `untested`) et un commentaire. Le bilan d'un point est KO si un testeur a trouvé un KO, sinon Bloqué, sinon OK, sinon à vérifier. Un test peut désigner la tâche qu'il vérifie. La review se rédige en brouillon puis se soumet : elle est figée et crée une demande `test_review` qui vise l'espace de la tâche.
@@ -1,6 +1,6 @@
1
1
  import { AgentEnvelopeSchema, AgentErrorSchema, WaitRequestsDataSchema } from "../../shared/schemas/agent-tools.schema.js";
2
2
  import { ToolArgumentError } from "./tools.js";
3
- import { LocalFileError, readLocalUpload } from "./upload.js";
3
+ import { LocalFileError, readUpload } from "./upload.js";
4
4
  /**
5
5
  * Client HTTP de l'API agent du site : seul point de sortie réseau du mode
6
6
  * MCP. Chaque appel porte le jeton dans `Authorization: Bearer`.
@@ -29,13 +29,13 @@ function redirectTarget(response, requestUrl) {
29
29
  }
30
30
  }
31
31
  /**
32
- * Formulaire multipart d'un envoi de fichier : le fichier local dans le champ
32
+ * Formulaire multipart d'un envoi de fichier : le fichier dans le champ
33
33
  * `file`, chaque autre argument dans un champ texte.
34
34
  */
35
35
  async function uploadForm(file, fields) {
36
36
  let upload;
37
37
  try {
38
- upload = await readLocalUpload(file.path, file.name);
38
+ upload = await readUpload(file);
39
39
  }
40
40
  catch (err) {
41
41
  if (err instanceof LocalFileError)
@@ -1,6 +1,6 @@
1
1
  import { type SiteConnection } from "./client.js";
2
2
  /** Présentation du serveur transmise au client MCP : concepts et déroulé. */
3
- export declare const INSTRUCTIONS = "mcp-organizer connects you to an organizer site: a multi-user task manager where people organize tasks in a web app and queue requests for the AI. You, the connected agent, process those requests when the user asks you to. The site never calls an LLM: you are the intelligence.\n\nYour token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.\n\nConcepts:\n- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.\n- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.\n- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as `![file name](attachment:<id>)`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request \u2014 a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment \u2014 a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine; this server reads and uploads it, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.\n- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in `#/notes/<id>`; when a request links notes, claim_request shows them in full. \"Envoyer \u00E0 l'agent\" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas\u2026).\n- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export\u2026) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml\u2026) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.\n- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.\n- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.\n- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.\n- A **direct action** is a write you make without request_id, when your user asks you directly (in their editor, for example) rather than through a request: it is done in the name of your token's owner and forms its own batch, listed among the requests of the space as a direct action and undoable like any other. The site runner never acts directly: it always passes the request_id of the request it processes.\n- A **view** is a tab of a member's dashboard: a layout (kanban, list, matrix), groupings by status or priority, and filters on status, priority, assignees, tags and task type (standard or test). Each member has their own views in each space.\n- A **timer** measures the time a member spends on a task: a free timer, or a pomodoro that alternates work phases and breaks (default 25 / 5 / 15 min, long break after 4 cycles). Each member has their own timer on a task, only one runs at a time, and the site's clock counts it; only the work phases of a pomodoro count. The time spent on a task is the sum of the sessions of all members: read it with get_task_time. When a member asks you to measure their time, call start_timer (and stop_timer to end it): you act on the timers of the author of the request, like their views.\n- The **scope** of your work is the space of your token: you see and process the requests of all its members, and you never act outside it. You change the views and timers of the author of the request you process, and nobody else's: only when the author owns your token, or when you are the site runner. A direct action on views or timers changes those of your token's owner.\n\nWork loop, when the user asks you to process the queue:\n1. list_requests to see the pending requests of your space.\n2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.\n3. Read what you need with get_task and search_tasks, with get_attachment for an image or a file attached to a task, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, add_attachment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up \u2014 always passing the request_id. Each write is one undoable action of the batch.\n5. complete_request with a short reply in the author's language and, in follow_ups, every point the author still has to handle (or fail_request with the reason), then go back to step 1 until no request is pending.\nWhen the queue is empty, tell the user.\n\nDirect work, when the user asks you to change the space outside any request: read with get_context, get_task and search_tasks, then call the write tools without request_id. Do not claim, complete or fail anything: there is no request to close. When your user still has points to handle afterwards, leave them with report_direct.\n\nNotifications: call enable_notifications once at the start of the session and arm the watcher it hands you with Monitor, whatever the command (behind mcp-http-gateway, the gateway relay answers in place of this server and gives its own watcher command). Each request that becomes pending in your space then arrives on its own as one line (kind, author, excerpt, request id), even while you are idle: process it with the work loop above, starting with claim_request. The host stops that watcher after 30 minutes at most: each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good. A line \"notifications stopped\" means the site refused the token, and a line \"[gateway-watch] \u2026 la veille \u00E9choue\" means the gateway watcher keeps failing: tell the user. wait_for_requests is the waiting tool of the watcher: you do not need to call it.\n\nHow to handle each kind of request:\n- **idea**: classify it. If it belongs to an existing task or sub-task, attach it there (sub-task, checklist item or comment). If it is actionable and important enough, create a task (or sub-task) with a fitting priority. Otherwise, put it in the idea box with create_idea. Prefer existing tasks over duplicates.\n- **test_review**: feed the tester's findings back into the existing tasks (status, checklist, comments, priority of the affected tasks), or create a task for each problem that has none.\n- **remark** and **message**: do whatever is useful \u2014 answer, update or create tasks, comment \u2014 and say what you did in the reply.\n- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.\n\nRules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); put anything the members are meant to copy and paste (a command, code, a prompt, an identifier, a URL to reuse) in a fenced markdown code block, which the site shows with a Copy button; never bury in the reply something the author must act on: it belongs in follow_ups. Errors tell you what to do next; an error about the token (missing, revoked, expired, owner no longer a member) cannot be fixed by retrying: tell the user.";
3
+ export declare const INSTRUCTIONS = "mcp-organizer connects you to an organizer site: a multi-user task manager where people organize tasks in a web app and queue requests for the AI. You, the connected agent, process those requests when the user asks you to. The site never calls an LLM: you are the intelligence.\n\nYour token covers exactly one space, with the rights of the user who created the token. Every tool works on that space.\n\nConcepts:\n- A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.\n- A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.\n- A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as `![file name](attachment:<id>)`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request \u2014 a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment \u2014 a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine in file_path; it is read and uploaded for you, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.\n- A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in `#/notes/<id>`; when a request links notes, claim_request shows them in full. \"Envoyer \u00E0 l'agent\" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas\u2026).\n- A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export\u2026) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml\u2026) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.\n- A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.\n- A **batch** is the set of actions you perform for one request. Every action is logged with its before and after state and with your token, and users can undo one action or the whole batch.\n- The **history** of the space records every event, by the members and by you: tasks created, changed (with before and after values) or deleted, checklist items, ideas, members, notes and documents (comments keep their own thread). Members read it on the site and restore an old version of a task, or a deleted task, from there. Read it with get_history when a member asks who changed something or what happened to a task.\n- A **direct action** is a write you make without request_id, when your user asks you directly (in their editor, for example) rather than through a request: it is done in the name of your token's owner and forms its own batch, listed among the requests of the space as a direct action and undoable like any other. The site runner never acts directly: it always passes the request_id of the request it processes.\n- A **view** is a tab of a member's dashboard: a layout (kanban, list, matrix), groupings by status or priority, and filters on status, priority, assignees, tags and task type (standard or test). Each member has their own views in each space.\n- A **timer** measures the time a member spends on a task: a free timer, or a pomodoro that alternates work phases and breaks (default 25 / 5 / 15 min, long break after 4 cycles). Each member has their own timer on a task, only one runs at a time, and the site's clock counts it; only the work phases of a pomodoro count. The time spent on a task is the sum of the sessions of all members: read it with get_task_time. When a member asks you to measure their time, call start_timer (and stop_timer to end it): you act on the timers of the author of the request, like their views.\n- The **scope** of your work is the space of your token: you see and process the requests of all its members, and you never act outside it. You change the views and timers of the author of the request you process, and nobody else's: only when the author owns your token, or when you are the site runner. A direct action on views or timers changes those of your token's owner.\n\nWork loop, when the user asks you to process the queue:\n1. list_requests to see the pending requests of your space.\n2. claim_request on the oldest one: it becomes processing for you and you get its context (text, author, context task, for a message the previous exchanges of its author, task tree, members, recent ideas, reference documents), along with the custom instructions of the site and of the space, which you follow. get_context shows the space at any time.\n3. Read what you need with get_task and search_tasks, with get_attachment for an image or a file attached to a task, with get_history to know who changed what, with get_note for a note the request or a task links, and with get_document for a reference document that helps the request.\n4. Act with create_task, update_task, set_assignees, set_tags, edit_checklist, edit_questions, add_comment, add_attachment, create_idea, update_idea, promote_idea, with list_views, create_view, update_view, delete_view when the author asks how their board should look, with start_timer and stop_timer when the author asks to measure their time on a task, and with check_follow_ups for a follow-up \u2014 always passing the request_id. Each write is one undoable action of the batch.\n5. complete_request with a short reply in the author's language and, in follow_ups, every point the author still has to handle (or fail_request with the reason), then go back to step 1 until no request is pending.\nWhen the queue is empty, tell the user.\n\nDirect work, when the user asks you to change the space outside any request: read with get_context, get_task and search_tasks, then call the write tools without request_id. Do not claim, complete or fail anything: there is no request to close. When your user still has points to handle afterwards, leave them with report_direct.\n\nNotifications: call enable_notifications once at the start of the session and arm the watcher it hands you with Monitor, whatever the command (behind mcp-http-gateway, the gateway relay answers in place of this server and gives its own watcher command). Each request that becomes pending in your space then arrives on its own as one line (kind, author, excerpt, request id), even while you are idle: process it with the work loop above, starting with claim_request. The host stops that watcher after 30 minutes at most: each time it tells you the watcher expired, re-arm it at once with the same Monitor call; otherwise notifications stop for good. A line \"notifications stopped\" means the site refused the token, and a line \"[gateway-watch] \u2026 la veille \u00E9choue\" means the gateway watcher keeps failing: tell the user. wait_for_requests is the waiting tool of the watcher: you do not need to call it.\n\nHow to handle each kind of request:\n- **idea**: classify it. If it belongs to an existing task or sub-task, attach it there (sub-task, checklist item or comment). If it is actionable and important enough, create a task (or sub-task) with a fitting priority. Otherwise, put it in the idea box with create_idea. Prefer existing tasks over duplicates.\n- **test_review**: feed the tester's findings back into the existing tasks (status, checklist, comments, priority of the affected tasks), or create a task for each problem that has none.\n- **remark** and **message**: do whatever is useful \u2014 answer, update or create tasks, comment \u2014 and say what you did in the reply.\n- **idea_promotion**: turn the context idea into a well-formed task with promote_idea.\n\nRules: write titles, descriptions and replies in the language of the users; keep the reply short and factual (markdown is rendered); put anything the members are meant to copy and paste (a command, code, a prompt, an identifier, a URL to reuse) in a fenced markdown code block, which the site shows with a Copy button; never bury in the reply something the author must act on: it belongs in follow_ups. Errors tell you what to do next; an error about the token (missing, revoked, expired, owner no longer a member) cannot be fixed by retrying: tell the user.";
4
4
  /**
5
5
  * Connexion au site d'après `ORGANIZER_URL` et `ORGANIZER_TOKEN` ; une valeur
6
6
  * absente ou invalide, ou une URL http vers une autre machine, est une `ConfigError`.
@@ -16,7 +16,7 @@ Your token covers exactly one space, with the rights of the user who created the
16
16
  Concepts:
17
17
  - A **space** holds tasks, an idea box, notes and reference documents. A user's **personal space** is private; a **shared space** has one owner and members.
18
18
  - A **task** has a title, a markdown description, a status (todo, doing, review, done), a priority (low, medium, high, critical), assignees and tags. Tasks nest on two levels: task > sub-task > sub-sub-task. A task is either standard (with a checklist) or a test (with checkpoints that each tester marks ok, ko, blocked or untested). Any task can also carry **questions** you ask the members to settle a point: options to choose from (one, or several), each with a markdown detail, plus a free answer. The members answer on the site; an answer does not notify you. You read the answers with get_task, and act on them only when a member asks you to, in a message or in a comment mentioning @agent.
19
- - A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as \`![file name](attachment:<id>)\`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request — a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment — a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine; this server reads and uploads it, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.
19
+ - A task has **attachments** (files the members upload), listed by get_task with their id. Members paste screenshots into descriptions, comments and checkpoint comments: such an image is an attachment of the task, referenced in the text as \`![file name](attachment:<id>)\`, and get_task flags the comments and checkpoint comments that contain one. Open with get_attachment the images and PDF files that matter for the request — a screenshot attached to a failed checkpoint, an image cited in a comment mentioning @agent, a PDF specification: you see an image as it is, and read the text of a PDF (a scanned PDF without a text layer is reported as such). You can attach a file yourself with add_attachment — a screenshot you took during a test, an export or a report you generated: give the absolute path of the file on your machine in file_path; it is read and uploaded for you, so its content never goes through you. Pass comment to post it in a comment (an image shows as a thumbnail) or append_to_description to reference it in the description.
20
20
  - A **note** is a markdown draft a member writes in the space to mature a thought over several sessions. Notes never reach your queue and writing one does not notify you: read them only when a member asks you to, with get_note and search_notes (read-only). A text refers to a note by a link ending in \`#/notes/<id>\`; when a request links notes, claim_request shows them in full. "Envoyer à l'agent" on a note queues a message that links it: process the note as that message asks (create or update tasks, ideas…).
21
21
  - A **document** is a reference file a member uploads to the space (a report on the project, a specification, a data export…) so that your decisions match the real state of the project. claim_request and get_context list the documents with their description; read the ones that help the request with get_document (read-only, in parts for long files). You read text files (txt, md, csv, json, yaml, xml…) and the text of Word files (.docx) and PDF files; an image comes as the image itself, which you see.
22
22
  - A **request** is something a member of your space asked the AI: an idea, a remark, a test review, a message or an idea promotion. It is pending, then processing once you claim it (only your token can then act for it), then done (with your reply and the points left to its author) or failed (with the reason). The points left to the author are checkboxes the members tick off. A **follow-up** is a message a member sends from a handled request: claim_request shows that original request, your reply and its points with their ids, and check_follow_ups ticks off the points the follow-up settles. A member can also hand a request to you by mentioning @agent in a comment of a task: claim_request then shows the task's thread, and complete_request posts your reply as a comment right after theirs.
@@ -1,3 +1,4 @@
1
+ import type { UploadSource } from "./upload.js";
1
2
  /**
2
3
  * Outils de l'agent : définition (schéma JSON écrit à la main, description
3
4
  * en anglais) et route de l'API agent du site qui l'exécute. Le mode MCP ne
@@ -36,11 +37,8 @@ export interface ToolHttpRequest {
36
37
  path: string;
37
38
  query: Record<string, string>;
38
39
  body: Record<string, unknown> | undefined;
39
- /** Fichier local à envoyer en multipart (champ `file`), pour un outil d'envoi. */
40
- file?: {
41
- path: string;
42
- name?: string;
43
- };
40
+ /** Fichier à envoyer en multipart (champ `file`), pour un outil d'envoi. */
41
+ file?: UploadSource;
44
42
  }
45
43
  /** Argument d'appel d'outil inutilisable pour former la requête. */
46
44
  export declare class ToolArgumentError extends Error {
@@ -422,13 +422,18 @@ export const AGENT_TOOLS = [
422
422
  upload: true,
423
423
  definition: {
424
424
  name: "add_attachment",
425
- description: "Attach a local file to a task of your space: a screenshot you took during a test, an export or a report you generated. Give the absolute path of the file on the machine where you run: this MCP server reads it and uploads it to the site itself, so its content never goes through you. Any format, up to 20 MB. To show it to the members, pass comment (a comment posted with the file shown in it: an image as a thumbnail, another file by its name) or append_to_description (the same reference added at the end of the description). Members see the file among the attachments of the task and can undo the upload with the rest of the batch.",
425
+ description: "Attach a local file to a task of your space: a screenshot you took during a test, an export or a report you generated. Give the absolute path of the file on your machine in file_path: it is read and uploaded to the site for you, so its content never goes through you. Any format, up to 20 MB. To show it to the members, pass comment (a comment posted with the file shown in it: an image as a thumbnail, another file by its name) or append_to_description (the same reference added at the end of the description). Members see the file among the attachments of the task and can undo the upload with the rest of the batch.",
426
426
  inputSchema: {
427
427
  type: "object",
428
428
  properties: {
429
429
  request_id: REQUEST_ID,
430
430
  task: TASK_REF,
431
- path: { type: "string", description: "Absolute path of a regular file on the machine where you run (e.g. C:\\Users\\me\\capture.png or /tmp/report.pdf)." },
431
+ file_path: { type: "string", description: "Absolute path of a regular file on your machine (e.g. C:\\Users\\me\\capture.png or /tmp/report.pdf)." },
432
+ file_content: {
433
+ type: "string",
434
+ description: "Content of the file encoded in base64, with file_name, in place of file_path. Only when this server cannot read your disk (it runs on another machine and no relay reads the file for you); otherwise use file_path.",
435
+ },
436
+ file_name: { type: "string", maxLength: 255, description: "Name of the file given in file_content, with its extension, which sets its type (e.g. capture.png)." },
432
437
  name: { type: "string", maxLength: 255, description: "File name shown to the members. Default: the name of the file." },
433
438
  comment: {
434
439
  type: "string",
@@ -437,7 +442,7 @@ export const AGENT_TOOLS = [
437
442
  },
438
443
  append_to_description: { type: "boolean", description: "Add the reference to the file at the end of the task description. Default: false." },
439
444
  },
440
- required: ["task", "path"],
445
+ required: ["task"],
441
446
  additionalProperties: false,
442
447
  },
443
448
  },
@@ -670,6 +675,40 @@ export const AGENT_TOOLS = [
670
675
  export function findAgentTool(name) {
671
676
  return AGENT_TOOLS.find((tool) => tool.definition.name === name);
672
677
  }
678
+ /** Chaîne non vide, ou undefined pour un argument absent ; toute autre valeur est refusée. */
679
+ function optionalText(args, name, expected) {
680
+ const value = args[name];
681
+ if (value === undefined || value === null)
682
+ return undefined;
683
+ if (typeof value !== "string" || value.trim() === "")
684
+ throw new ToolArgumentError(`Invalid arguments — ${name}: expected ${expected}. Check the tool's input schema.`);
685
+ return value;
686
+ }
687
+ /**
688
+ * Fichier d'un outil d'envoi et champs de son formulaire. Le fichier vient de
689
+ * `file_path` ou de `file_content` (base64) avec `file_name` : la paire
690
+ * `file_path` / `file_content` est celle que le relais de mcp-http-gateway
691
+ * reconnaît pour lire le fichier sur la machine de l'agent et en transmettre
692
+ * le contenu.
693
+ */
694
+ function uploadArguments(args) {
695
+ const { file_path: _path, file_content: _content, file_name: _fileName, name: _name, ...body } = args;
696
+ const filePath = optionalText(args, "file_path", "the absolute path of a file");
697
+ const content = optionalText(args, "file_content", "the content of the file encoded in base64");
698
+ const fileName = optionalText(args, "file_name", "the name of the file, with its extension");
699
+ const name = optionalText(args, "name", "a non-empty string");
700
+ const shown = name === undefined ? {} : { name };
701
+ if (filePath !== undefined && content !== undefined)
702
+ throw new ToolArgumentError("Invalid arguments — pass file_path or file_content, not both.");
703
+ if (content !== undefined) {
704
+ if (fileName === undefined)
705
+ throw new ToolArgumentError("Invalid arguments — file_name: expected the name of the file given in file_content, with its extension.");
706
+ return { body, file: { content, filename: fileName.trim(), ...shown } };
707
+ }
708
+ if (filePath === undefined)
709
+ throw new ToolArgumentError("Invalid arguments — file_path: expected the absolute path of a file. Check the tool's input schema.");
710
+ return { body, file: { path: filePath.trim(), ...shown } };
711
+ }
673
712
  /**
674
713
  * Requête HTTP d'un appel d'outil : les arguments nommés dans le chemin y
675
714
  * sont placés (ils sont alors obligatoires et textuels), les autres vont
@@ -686,12 +725,7 @@ export function toolHttpRequest(tool, args) {
686
725
  return encodeURIComponent(value.trim());
687
726
  });
688
727
  if (tool.upload) {
689
- const { path: filePath, name, ...fields } = rest;
690
- if (typeof filePath !== "string" || filePath.trim() === "")
691
- throw new ToolArgumentError("Invalid arguments — path: expected the absolute path of a file. Check the tool's input schema.");
692
- if (name !== undefined && (typeof name !== "string" || name.trim() === ""))
693
- throw new ToolArgumentError("Invalid arguments — name: expected a non-empty string. Check the tool's input schema.");
694
- return { method: tool.method, path, query: {}, body: fields, file: { path: filePath.trim(), ...(name === undefined ? {} : { name: name }) } };
728
+ return { method: tool.method, path, query: {}, ...uploadArguments(rest) };
695
729
  }
696
730
  if (tool.method !== "GET")
697
731
  return { method: tool.method, path, query: {}, body: rest };
@@ -1,8 +1,20 @@
1
1
  /**
2
- * Fichier local envoyé par l'agent comme pièce jointe : le mode MCP le lit
3
- * sur la machine où il tourne, avec les droits de l'utilisateur qui l'a
4
- * lancé, et l'envoie au site. Son contenu ne passe jamais par l'agent.
2
+ * Fichier envoyé par l'agent comme pièce jointe. Désigné par son chemin, le
3
+ * mode MCP le lit sur la machine où il tourne, avec les droits de
4
+ * l'utilisateur qui l'a lancé. Fourni en base64, il est décodé tel quel :
5
+ * c'est la forme que remplit le relais de mcp-http-gateway, qui lit le
6
+ * fichier sur la machine de l'agent quand le mode MCP tourne sur celle de
7
+ * la gateway.
5
8
  */
9
+ /** Source d'un envoi : chemin absolu d'un fichier local, ou contenu en base64 avec son nom de fichier. */
10
+ export type UploadSource = {
11
+ path: string;
12
+ name?: string;
13
+ } | {
14
+ content: string;
15
+ filename: string;
16
+ name?: string;
17
+ };
6
18
  /** Fichier local lu pour l'envoi. */
7
19
  export interface LocalUpload {
8
20
  filename: string;
@@ -20,3 +32,10 @@ export declare function mimeOfFilename(filename: string): string;
20
32
  * remplace son nom. Un lien symbolique est suivi jusqu'au fichier qu'il désigne.
21
33
  */
22
34
  export declare function readLocalUpload(filePath: string, name?: string): Promise<LocalUpload>;
35
+ /**
36
+ * Décode le contenu base64 `content` d'un fichier nommé `filename`, qui
37
+ * donne son type ; `name` remplace ce nom. Les blancs du base64 sont ignorés.
38
+ */
39
+ export declare function decodeInlineUpload(content: string, filename: string, name?: string): LocalUpload;
40
+ /** Fichier d'un envoi, lu sur le disque ou décodé du base64 selon sa source. */
41
+ export declare function readUpload(source: UploadSource): Promise<LocalUpload>;
@@ -49,8 +49,9 @@ export async function readLocalUpload(filePath, name) {
49
49
  stat = await fs.stat(filePath);
50
50
  }
51
51
  catch (err) {
52
- if (err?.code === "ENOENT" || err?.code === "ENOTDIR")
53
- throw new LocalFileError(`No file at ${filePath}: check the path.`);
52
+ if (err?.code === "ENOENT" || err?.code === "ENOTDIR") {
53
+ throw new LocalFileError(`No file at ${filePath}: check the path. This server reads the path on the machine where it runs; if that is not your machine, pass the file in file_content (base64) with file_name instead.`);
54
+ }
54
55
  if (err?.code === "EACCES" || err?.code === "EPERM")
55
56
  throw new LocalFileError(`The file ${filePath} cannot be read: permission denied.`);
56
57
  throw new LocalFileError(`The file ${filePath} cannot be read (${err?.message ?? err}).`);
@@ -77,3 +78,31 @@ export async function readLocalUpload(filePath, name) {
77
78
  throw new LocalFileError("name must not be empty.");
78
79
  return { filename, mime: mimeOfFilename(path.basename(filePath)), content };
79
80
  }
81
+ /** Base64 standard : alphabet, longueur multiple de 4, au plus deux `=` en fin. */
82
+ function isBase64(text) {
83
+ return text.length % 4 === 0 && /^[A-Za-z0-9+/]*={0,2}$/.test(text);
84
+ }
85
+ /**
86
+ * Décode le contenu base64 `content` d'un fichier nommé `filename`, qui
87
+ * donne son type ; `name` remplace ce nom. Les blancs du base64 sont ignorés.
88
+ */
89
+ export function decodeInlineUpload(content, filename, name) {
90
+ const compact = content.replace(/\s+/g, "");
91
+ if ((compact.length / 4) * 3 > MAX_ATTACHMENT_BYTES + 2) {
92
+ throw new LocalFileError(`The file ${filename} is too large: an attachment cannot exceed ${megabytes(MAX_ATTACHMENT_BYTES)}.`);
93
+ }
94
+ if (!isBase64(compact))
95
+ throw new LocalFileError("file_content must be the content of the file encoded in base64.");
96
+ const decoded = Buffer.from(compact, "base64");
97
+ if (decoded.length > MAX_ATTACHMENT_BYTES) {
98
+ throw new LocalFileError(`The file ${filename} is too large (${megabytes(decoded.length)}): an attachment cannot exceed ${megabytes(MAX_ATTACHMENT_BYTES)}.`);
99
+ }
100
+ const shown = (name ?? path.basename(filename)).trim();
101
+ if (shown === "")
102
+ throw new LocalFileError("name must not be empty.");
103
+ return { filename: shown, mime: mimeOfFilename(path.basename(filename)), content: decoded };
104
+ }
105
+ /** Fichier d'un envoi, lu sur le disque ou décodé du base64 selon sa source. */
106
+ export async function readUpload(source) {
107
+ return "content" in source ? decodeInlineUpload(source.content, source.filename, source.name) : readLocalUpload(source.path, source.name);
108
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imenam/mcp-organizer",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
4
4
  "description": "MCP server with a multi-user web GUI to organize tasks in personal and shared spaces; requests to the AI are queued and processed by the connected agent, every agent action is logged and undoable.",
5
5
  "main": "dist/src/index.js",
6
6
  "scripts": {