@satiyap/confluence-reader-mcp 0.2.1 → 0.2.2
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 +2 -1
- package/dist/index.js +13 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -76,12 +76,13 @@ Lists the direct child pages of a Confluence page without fetching their content
|
|
|
76
76
|
|
|
77
77
|
### `confluence.fetch_image`
|
|
78
78
|
|
|
79
|
-
Downloads an image attachment from a Confluence page by filename
|
|
79
|
+
Downloads an image attachment from a Confluence page by filename and saves it to a local directory.
|
|
80
80
|
|
|
81
81
|
| Parameter | Type | Description |
|
|
82
82
|
|-----------|------|-------------|
|
|
83
83
|
| `url` | string | Confluence page URL |
|
|
84
84
|
| `filename` | string | Attachment filename (e.g. `architecture.png`) |
|
|
85
|
+
| `destination` | string | Local directory path to save the image to |
|
|
85
86
|
|
|
86
87
|
### `confluence.compare`
|
|
87
88
|
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { storageToMarkdown } from "./confluence/transform.js";
|
|
|
8
8
|
import { generateUnifiedDiff, generateDiffStats } from "./compare/diff.js";
|
|
9
9
|
const server = new McpServer({
|
|
10
10
|
name: "confluence-reader-mcp",
|
|
11
|
-
version: "0.2.
|
|
11
|
+
version: "0.2.2"
|
|
12
12
|
});
|
|
13
13
|
function getEnv(name) {
|
|
14
14
|
const v = process.env[name];
|
|
@@ -79,10 +79,11 @@ server.tool("confluence.list_children", "List the direct child pages of a Conflu
|
|
|
79
79
|
: "No child pages found.";
|
|
80
80
|
return { content: [{ type: "text", text }] };
|
|
81
81
|
});
|
|
82
|
-
server.tool("confluence.fetch_image", "Download an image attachment from a Confluence page by filename. Returns the
|
|
82
|
+
server.tool("confluence.fetch_image", "Download an image attachment from a Confluence page by filename and save it to a local directory. Returns the saved file path.", {
|
|
83
83
|
url: z.string().describe("Confluence page URL"),
|
|
84
|
-
filename: z.string().describe("Attachment filename (e.g. 'architecture.png')")
|
|
85
|
-
|
|
84
|
+
filename: z.string().describe("Attachment filename (e.g. 'architecture.png')"),
|
|
85
|
+
destination: z.string().describe("Local directory path to save the image to")
|
|
86
|
+
}, async ({ url, filename, destination }) => {
|
|
86
87
|
const cfg = getCfg();
|
|
87
88
|
const pageId = extractConfluencePageId(url);
|
|
88
89
|
const attachments = await fetchAttachments(cfg, pageId);
|
|
@@ -96,23 +97,17 @@ server.tool("confluence.fetch_image", "Download an image attachment from a Confl
|
|
|
96
97
|
}]
|
|
97
98
|
};
|
|
98
99
|
}
|
|
99
|
-
const { buffer
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
data: base64,
|
|
107
|
-
mimeType: contentType,
|
|
108
|
-
}]
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
// Non-image attachment — return as base64 text
|
|
100
|
+
const { buffer } = await downloadAttachment(cfg, pageId, match.id);
|
|
101
|
+
// Ensure destination directory exists
|
|
102
|
+
const fs = await import("node:fs/promises");
|
|
103
|
+
const path = await import("node:path");
|
|
104
|
+
await fs.mkdir(destination, { recursive: true });
|
|
105
|
+
const filePath = path.join(destination, match.title);
|
|
106
|
+
await fs.writeFile(filePath, buffer);
|
|
112
107
|
return {
|
|
113
108
|
content: [{
|
|
114
109
|
type: "text",
|
|
115
|
-
text: `
|
|
110
|
+
text: `Saved "${match.title}" (${buffer.length} bytes) to ${filePath}`
|
|
116
111
|
}]
|
|
117
112
|
};
|
|
118
113
|
});
|