mdshare 1.0.2 → 1.0.3
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/bin/mdshare-cli.mjs +539 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -66
- package/dist/index.js.map +1 -1
- package/dist/tools.d.ts +286 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +300 -0
- package/dist/tools.js.map +1 -0
- package/package.json +8 -7
- package/README.md +0 -52
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,gGAAgG;AAChG,gGAAgG;AAChG,iFAAiF;AACjF,sDAAsD;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE;KACV;CACF,CACF,CAAC;AAEF,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AAEjF,MAAM,CAAC,iBAAiB,CAAC,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAChE,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAG,OAAO,CAAC,MAAM,CAAC,SAAiC,IAAI,EAAE,CAAC,CAAC;AAChG,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,8FAA8F;AAC9F,kGAAkG;AAClG,yBAAyB;AACzB,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/F,IAAI,WAAW,EAAE,CAAC;IAChB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
export declare function resolveAgentToken(): string;
|
|
2
|
+
export declare const TOOLS: ({
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: string;
|
|
7
|
+
properties: {
|
|
8
|
+
markdown: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
ttl: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
keep: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
parent: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
origin: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
svg?: undefined;
|
|
29
|
+
title?: undefined;
|
|
30
|
+
q?: undefined;
|
|
31
|
+
kind?: undefined;
|
|
32
|
+
limit?: undefined;
|
|
33
|
+
offset?: undefined;
|
|
34
|
+
id?: undefined;
|
|
35
|
+
is_public?: undefined;
|
|
36
|
+
status?: undefined;
|
|
37
|
+
ids?: undefined;
|
|
38
|
+
resolved_in?: undefined;
|
|
39
|
+
};
|
|
40
|
+
required: string[];
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: string;
|
|
47
|
+
properties: {
|
|
48
|
+
svg: {
|
|
49
|
+
type: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
title: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
};
|
|
56
|
+
markdown: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
};
|
|
60
|
+
ttl: {
|
|
61
|
+
type: string;
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
keep?: undefined;
|
|
65
|
+
parent?: undefined;
|
|
66
|
+
origin?: undefined;
|
|
67
|
+
q?: undefined;
|
|
68
|
+
kind?: undefined;
|
|
69
|
+
limit?: undefined;
|
|
70
|
+
offset?: undefined;
|
|
71
|
+
id?: undefined;
|
|
72
|
+
is_public?: undefined;
|
|
73
|
+
status?: undefined;
|
|
74
|
+
ids?: undefined;
|
|
75
|
+
resolved_in?: undefined;
|
|
76
|
+
};
|
|
77
|
+
required: string[];
|
|
78
|
+
};
|
|
79
|
+
} | {
|
|
80
|
+
name: string;
|
|
81
|
+
description: string;
|
|
82
|
+
inputSchema: {
|
|
83
|
+
type: string;
|
|
84
|
+
properties: {
|
|
85
|
+
markdown?: undefined;
|
|
86
|
+
ttl?: undefined;
|
|
87
|
+
keep?: undefined;
|
|
88
|
+
parent?: undefined;
|
|
89
|
+
origin?: undefined;
|
|
90
|
+
svg?: undefined;
|
|
91
|
+
title?: undefined;
|
|
92
|
+
q?: undefined;
|
|
93
|
+
kind?: undefined;
|
|
94
|
+
limit?: undefined;
|
|
95
|
+
offset?: undefined;
|
|
96
|
+
id?: undefined;
|
|
97
|
+
is_public?: undefined;
|
|
98
|
+
status?: undefined;
|
|
99
|
+
ids?: undefined;
|
|
100
|
+
resolved_in?: undefined;
|
|
101
|
+
};
|
|
102
|
+
required?: undefined;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
name: string;
|
|
106
|
+
description: string;
|
|
107
|
+
inputSchema: {
|
|
108
|
+
type: string;
|
|
109
|
+
properties: {
|
|
110
|
+
q: {
|
|
111
|
+
type: string;
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
kind: {
|
|
115
|
+
type: string;
|
|
116
|
+
enum: string[];
|
|
117
|
+
description: string;
|
|
118
|
+
};
|
|
119
|
+
limit: {
|
|
120
|
+
type: string;
|
|
121
|
+
description: string;
|
|
122
|
+
};
|
|
123
|
+
offset: {
|
|
124
|
+
type: string;
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
markdown?: undefined;
|
|
128
|
+
ttl?: undefined;
|
|
129
|
+
keep?: undefined;
|
|
130
|
+
parent?: undefined;
|
|
131
|
+
origin?: undefined;
|
|
132
|
+
svg?: undefined;
|
|
133
|
+
title?: undefined;
|
|
134
|
+
id?: undefined;
|
|
135
|
+
is_public?: undefined;
|
|
136
|
+
status?: undefined;
|
|
137
|
+
ids?: undefined;
|
|
138
|
+
resolved_in?: undefined;
|
|
139
|
+
};
|
|
140
|
+
required?: undefined;
|
|
141
|
+
};
|
|
142
|
+
} | {
|
|
143
|
+
name: string;
|
|
144
|
+
description: string;
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: string;
|
|
147
|
+
properties: {
|
|
148
|
+
id: {
|
|
149
|
+
type: string;
|
|
150
|
+
description: string;
|
|
151
|
+
};
|
|
152
|
+
kind: {
|
|
153
|
+
type: string;
|
|
154
|
+
enum: string[];
|
|
155
|
+
description: string;
|
|
156
|
+
};
|
|
157
|
+
markdown?: undefined;
|
|
158
|
+
ttl?: undefined;
|
|
159
|
+
keep?: undefined;
|
|
160
|
+
parent?: undefined;
|
|
161
|
+
origin?: undefined;
|
|
162
|
+
svg?: undefined;
|
|
163
|
+
title?: undefined;
|
|
164
|
+
q?: undefined;
|
|
165
|
+
limit?: undefined;
|
|
166
|
+
offset?: undefined;
|
|
167
|
+
is_public?: undefined;
|
|
168
|
+
status?: undefined;
|
|
169
|
+
ids?: undefined;
|
|
170
|
+
resolved_in?: undefined;
|
|
171
|
+
};
|
|
172
|
+
required: string[];
|
|
173
|
+
};
|
|
174
|
+
} | {
|
|
175
|
+
name: string;
|
|
176
|
+
description: string;
|
|
177
|
+
inputSchema: {
|
|
178
|
+
type: string;
|
|
179
|
+
properties: {
|
|
180
|
+
id: {
|
|
181
|
+
type: string;
|
|
182
|
+
description: string;
|
|
183
|
+
};
|
|
184
|
+
kind: {
|
|
185
|
+
type: string;
|
|
186
|
+
enum: string[];
|
|
187
|
+
description: string;
|
|
188
|
+
};
|
|
189
|
+
is_public: {
|
|
190
|
+
type: string;
|
|
191
|
+
description: string;
|
|
192
|
+
};
|
|
193
|
+
markdown?: undefined;
|
|
194
|
+
ttl?: undefined;
|
|
195
|
+
keep?: undefined;
|
|
196
|
+
parent?: undefined;
|
|
197
|
+
origin?: undefined;
|
|
198
|
+
svg?: undefined;
|
|
199
|
+
title?: undefined;
|
|
200
|
+
q?: undefined;
|
|
201
|
+
limit?: undefined;
|
|
202
|
+
offset?: undefined;
|
|
203
|
+
status?: undefined;
|
|
204
|
+
ids?: undefined;
|
|
205
|
+
resolved_in?: undefined;
|
|
206
|
+
};
|
|
207
|
+
required: string[];
|
|
208
|
+
};
|
|
209
|
+
} | {
|
|
210
|
+
name: string;
|
|
211
|
+
description: string;
|
|
212
|
+
inputSchema: {
|
|
213
|
+
type: string;
|
|
214
|
+
properties: {
|
|
215
|
+
id: {
|
|
216
|
+
type: string;
|
|
217
|
+
description: string;
|
|
218
|
+
};
|
|
219
|
+
status: {
|
|
220
|
+
type: string;
|
|
221
|
+
enum: string[];
|
|
222
|
+
description: string;
|
|
223
|
+
};
|
|
224
|
+
markdown?: undefined;
|
|
225
|
+
ttl?: undefined;
|
|
226
|
+
keep?: undefined;
|
|
227
|
+
parent?: undefined;
|
|
228
|
+
origin?: undefined;
|
|
229
|
+
svg?: undefined;
|
|
230
|
+
title?: undefined;
|
|
231
|
+
q?: undefined;
|
|
232
|
+
kind?: undefined;
|
|
233
|
+
limit?: undefined;
|
|
234
|
+
offset?: undefined;
|
|
235
|
+
is_public?: undefined;
|
|
236
|
+
ids?: undefined;
|
|
237
|
+
resolved_in?: undefined;
|
|
238
|
+
};
|
|
239
|
+
required?: undefined;
|
|
240
|
+
};
|
|
241
|
+
} | {
|
|
242
|
+
name: string;
|
|
243
|
+
description: string;
|
|
244
|
+
inputSchema: {
|
|
245
|
+
type: string;
|
|
246
|
+
properties: {
|
|
247
|
+
ids: {
|
|
248
|
+
type: string;
|
|
249
|
+
items: {
|
|
250
|
+
type: string;
|
|
251
|
+
};
|
|
252
|
+
description: string;
|
|
253
|
+
};
|
|
254
|
+
status: {
|
|
255
|
+
type: string;
|
|
256
|
+
enum: string[];
|
|
257
|
+
description: string;
|
|
258
|
+
};
|
|
259
|
+
resolved_in: {
|
|
260
|
+
type: string;
|
|
261
|
+
description: string;
|
|
262
|
+
};
|
|
263
|
+
markdown?: undefined;
|
|
264
|
+
ttl?: undefined;
|
|
265
|
+
keep?: undefined;
|
|
266
|
+
parent?: undefined;
|
|
267
|
+
origin?: undefined;
|
|
268
|
+
svg?: undefined;
|
|
269
|
+
title?: undefined;
|
|
270
|
+
q?: undefined;
|
|
271
|
+
kind?: undefined;
|
|
272
|
+
limit?: undefined;
|
|
273
|
+
offset?: undefined;
|
|
274
|
+
id?: undefined;
|
|
275
|
+
is_public?: undefined;
|
|
276
|
+
};
|
|
277
|
+
required: string[];
|
|
278
|
+
};
|
|
279
|
+
})[];
|
|
280
|
+
export declare function callTool(toolName: string, args: Record<string, any>): Promise<{
|
|
281
|
+
content: {
|
|
282
|
+
type: "text";
|
|
283
|
+
text: string;
|
|
284
|
+
}[];
|
|
285
|
+
}>;
|
|
286
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAuCA,wBAAgB,iBAAiB,IAAI,MAAM,CAe1C;AAaD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyIjB,CAAC;AAkBF,wBAAsB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;;GA8FzE"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
// mcp/src/tools.ts — the actual tool definitions and implementations, deliberately with zero
|
|
2
|
+
// npm dependencies (no @modelcontextprotocol/sdk import here). Split out of index.ts
|
|
3
|
+
// (2026-12-01, agent-install kit) so tests/mcp-tools.test.mjs and tests/agents-page.test.mjs
|
|
4
|
+
// (the docs-drift guard comparing /agents.md's documented tools against the server's real tool
|
|
5
|
+
// list) can import TOOLS/callTool directly without mcp/'s own node_modules being installed —
|
|
6
|
+
// matching mcp/bin/mdshare-cli.mjs's "zero npm dependencies" convention, and keeping `npm test` at
|
|
7
|
+
// the repo root (CI's `npm ci` only installs the root package, not mcp/) independent of whether
|
|
8
|
+
// `cd mcp && npm install` has ever been run. index.ts (the actual stdio MCP server, which does
|
|
9
|
+
// need the sdk) is a thin wrapper around this file.
|
|
10
|
+
import { readFileSync } from "fs";
|
|
11
|
+
// Default: public hosted API. Set MDSHARE_API to use your own instance.
|
|
12
|
+
const MDSHARE_API = process.env.MDSHARE_API || "https://mdshare-rileylins-projects.vercel.app/api/share";
|
|
13
|
+
const MDSHARE_DIAGRAM_API = process.env.MDSHARE_DIAGRAM_API || "https://mdshare-rileylins-projects.vercel.app/api/diagram";
|
|
14
|
+
const MDSHARE_ARCHIFY_API = process.env.MDSHARE_ARCHIFY_API || "https://mdshare-rileylins-projects.vercel.app/api/archify";
|
|
15
|
+
const MDSHARE_PASTES_API = process.env.MDSHARE_PASTES_API || "https://mdshare-rileylins-projects.vercel.app/api/pastes";
|
|
16
|
+
const MDSHARE_PIN_API = process.env.MDSHARE_PIN_API || "https://mdshare-rileylins-projects.vercel.app/api/pin";
|
|
17
|
+
const MDSHARE_AUTH_API = process.env.MDSHARE_AUTH_API || "https://mdshare-rileylins-projects.vercel.app/api/auth";
|
|
18
|
+
// The reading loop (feedback/resolve/versions) all live behind one action-dispatch endpoint,
|
|
19
|
+
// api/doc.js. Added 2026-12-01 (agent-install kit) alongside list_feedback/resolve_feedback below.
|
|
20
|
+
const MDSHARE_DOC_API = process.env.MDSHARE_DOC_API || "https://mdshare-rileylins-projects.vercel.app/api/doc";
|
|
21
|
+
// READ_API maps a content kind to its raw-read/create endpoint.
|
|
22
|
+
const READ_API = { paste: MDSHARE_API, diagram: MDSHARE_DIAGRAM_API, archify: MDSHARE_ARCHIFY_API };
|
|
23
|
+
// Optional per-agent bearer token (owner-issued from the mdshare dashboard's "API Tokens"
|
|
24
|
+
// panel). Never hardcode a token here — set MDSHARE_AGENT_TOKEN in the MCP client's env config
|
|
25
|
+
// (e.g. via a protected secrets store reference), one distinct token per agent/deployment so
|
|
26
|
+
// usage and revocation stay attributable per agent. Unset -> identical unauthenticated behavior
|
|
27
|
+
// as before (anonymous, always-private creation, no read-back capability).
|
|
28
|
+
//
|
|
29
|
+
// MDSHARE_AGENT_TOKEN_FILE (added 2026-10-08, AGENT-SEARCH-PLAN.md) is an alternative for
|
|
30
|
+
// machine setups that keep the token in a file with restrictive permissions instead of directly
|
|
31
|
+
// in the process environment (e.g. a secrets-mount path). Read once, trimmed, cached in memory
|
|
32
|
+
// for the life of the process — never logged, never echoed back in any tool response or error.
|
|
33
|
+
// Neither this file's tools nor the portable CLI (mcp/bin/mdshare-cli.mjs) ever accept a token as
|
|
34
|
+
// a tool argument/CLI flag: a secret must come only from the environment or a file path, never
|
|
35
|
+
// from text a model/user could cause to appear in a visible tool call or shell history.
|
|
36
|
+
let cachedTokenFromFile = null;
|
|
37
|
+
export function resolveAgentToken() {
|
|
38
|
+
if (process.env.MDSHARE_AGENT_TOKEN)
|
|
39
|
+
return process.env.MDSHARE_AGENT_TOKEN;
|
|
40
|
+
if (cachedTokenFromFile !== null)
|
|
41
|
+
return cachedTokenFromFile;
|
|
42
|
+
const filePath = process.env.MDSHARE_AGENT_TOKEN_FILE;
|
|
43
|
+
if (filePath) {
|
|
44
|
+
try {
|
|
45
|
+
cachedTokenFromFile = readFileSync(filePath, "utf8").trim();
|
|
46
|
+
return cachedTokenFromFile;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
cachedTokenFromFile = "";
|
|
50
|
+
return "";
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
cachedTokenFromFile = "";
|
|
54
|
+
return "";
|
|
55
|
+
}
|
|
56
|
+
function authHeaders() {
|
|
57
|
+
const headers = { "Content-Type": "application/json" };
|
|
58
|
+
const token = resolveAgentToken();
|
|
59
|
+
if (token)
|
|
60
|
+
headers["Authorization"] = `Bearer ${token}`;
|
|
61
|
+
return headers;
|
|
62
|
+
}
|
|
63
|
+
// The tool list, exported so tests (and the agent-install docs-drift check, tests/agents-page
|
|
64
|
+
// .test.mjs) can read the real tool names/schemas without starting a stdio server — the only
|
|
65
|
+
// source of truth for "what the MCP server actually exposes" is this array, never a hand-copied
|
|
66
|
+
// list in a doc page.
|
|
67
|
+
export const TOOLS = [
|
|
68
|
+
{
|
|
69
|
+
name: "share_markdown",
|
|
70
|
+
description: "Share markdown as a beautifully rendered web page. Returns a URL you can send to anyone. Use this whenever you want to share structured content (tables, code, lists, diagrams) in a readable format, or to publish a revision of something you shared before (set `parent`). Supports Mermaid diagrams: use ```mermaid fenced code blocks for flowcharts, sequence diagrams, ER diagrams, etc. They render as interactive SVGs automatically.",
|
|
71
|
+
inputSchema: {
|
|
72
|
+
type: "object",
|
|
73
|
+
properties: {
|
|
74
|
+
markdown: {
|
|
75
|
+
type: "string",
|
|
76
|
+
description: "The markdown content to render and share. Supports full GFM (tables, code blocks, task lists) plus Mermaid diagram blocks (```mermaid).",
|
|
77
|
+
},
|
|
78
|
+
ttl: {
|
|
79
|
+
type: "number",
|
|
80
|
+
description: "Time-to-live in seconds (default: 86400 = 24h, max: 604800 = 7 days). Ignored when `keep` is true.",
|
|
81
|
+
},
|
|
82
|
+
keep: {
|
|
83
|
+
type: "boolean",
|
|
84
|
+
description: "Never expire this document (it still stays private unless published). Needs a bearer token (or the owner session); silently ignored otherwise. Use for anything the user will want later — reports, plans, long explanations.",
|
|
85
|
+
},
|
|
86
|
+
parent: {
|
|
87
|
+
type: "string",
|
|
88
|
+
description: "Id of an earlier document this one replaces (a revision). The old page then shows 'a newer version exists' and the new one gets a 'What changed' link. Needs a token that can read the parent (it created it, or holds documents:read); otherwise the call fails with 404 and nothing is created. Use this when revising after feedback — pass the id you are resolving feedback for.",
|
|
89
|
+
},
|
|
90
|
+
origin: {
|
|
91
|
+
type: "string",
|
|
92
|
+
description: "Your session or chat id (letters, digits, : . @ / # + - _, max 200 chars). Stored only for a bearer token or the owner. Reader feedback on this document can then be traced back to where it should be routed.",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
required: ["markdown"],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "share_diagram",
|
|
100
|
+
description: "Share a standalone SVG diagram as a rendered page. Use this for fully custom visuals that Mermaid can't express (hand-crafted SVGs, generated charts, etc). For most diagrams, prefer share_markdown with ```mermaid blocks instead — it's simpler.",
|
|
101
|
+
inputSchema: {
|
|
102
|
+
type: "object",
|
|
103
|
+
properties: {
|
|
104
|
+
svg: {
|
|
105
|
+
type: "string",
|
|
106
|
+
description: "Valid SVG markup (must start with <svg or <?xml)",
|
|
107
|
+
},
|
|
108
|
+
title: {
|
|
109
|
+
type: "string",
|
|
110
|
+
description: "Diagram title (default: 'Diagram')",
|
|
111
|
+
},
|
|
112
|
+
markdown: {
|
|
113
|
+
type: "string",
|
|
114
|
+
description: "Optional markdown notes rendered below the diagram",
|
|
115
|
+
},
|
|
116
|
+
ttl: {
|
|
117
|
+
type: "number",
|
|
118
|
+
description: "Time-to-live in seconds (default: 86400 = 24h, max: 604800 = 7 days)",
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
required: ["svg"],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "auth_status",
|
|
126
|
+
description: "Check this agent's own mdshare bearer-token identity: id, name, whether it's a legacy token (create + own-row-read only) or a scoped one, and which scopes it holds (documents:read / documents:write / documents:publish). Reads the token only from MDSHARE_AGENT_TOKEN / MDSHARE_AGENT_TOKEN_FILE — never a tool argument. Fails if no token is configured or it's invalid/expired/revoked.",
|
|
127
|
+
inputSchema: { type: "object", properties: {} },
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "search_documents",
|
|
131
|
+
description: "Search or list (recent) the owner's mdshare document library across pastes/diagrams/archify diagrams — titles and, where available, body text — with real server-side search and bounded pagination. Requires a bearer token with the documents:read scope; omit `q` for a recent/listing view instead of a search.",
|
|
132
|
+
inputSchema: {
|
|
133
|
+
type: "object",
|
|
134
|
+
properties: {
|
|
135
|
+
q: { type: "string", description: "Search term (optional — omit for recent/listing mode)" },
|
|
136
|
+
kind: { type: "string", enum: ["paste", "diagram", "archify", "all"], description: "Restrict to one content kind, or 'all' (default)" },
|
|
137
|
+
limit: { type: "number", description: "Max results per page (default 20, max 50)" },
|
|
138
|
+
offset: { type: "number", description: "Pagination offset (default 0, max 5000)" },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "read_document",
|
|
144
|
+
description: "Read a document's raw content back by id and kind. Readable without any scope if this token itself created it; readable regardless of creator if this token holds the documents:read scope; public documents are always readable.",
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: {
|
|
148
|
+
id: { type: "string", description: "Document id, from its share URL (/v/:id, /d/:id, /a/:id)" },
|
|
149
|
+
kind: { type: "string", enum: ["paste", "diagram", "archify"], description: "Content kind" },
|
|
150
|
+
},
|
|
151
|
+
required: ["id", "kind"],
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "publish_document",
|
|
156
|
+
description: "Toggle a document's public/private visibility. Requires the documents:publish scope, and only works on a document this exact token itself created — it can never change visibility on the owner's or another token's content, even with this scope.",
|
|
157
|
+
inputSchema: {
|
|
158
|
+
type: "object",
|
|
159
|
+
properties: {
|
|
160
|
+
id: { type: "string", description: "Document id" },
|
|
161
|
+
kind: { type: "string", enum: ["paste", "diagram", "archify"], description: "Content kind" },
|
|
162
|
+
is_public: { type: "boolean", description: "true to make it publicly viewable, false to make it private again" },
|
|
163
|
+
},
|
|
164
|
+
required: ["id", "kind", "is_public"],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "list_feedback",
|
|
169
|
+
description: "List the reader's paragraph feedback on documents (quote + note + which paragraph, kind: example | unclear | wrong | expand | note). Part of the read → publish → check feedback → revise loop: call this to see what the owner asked for before you republish with share_markdown's `parent`. Requires the activity:read scope (or the owner session). Omit `id` to see feedback across every document; omit `status` to default to open feedback only.",
|
|
170
|
+
inputSchema: {
|
|
171
|
+
type: "object",
|
|
172
|
+
properties: {
|
|
173
|
+
id: { type: "string", description: "Restrict to one document's feedback (optional)" },
|
|
174
|
+
status: { type: "string", enum: ["open", "resolved", "dismissed"], description: "Filter by status (default: open when `id` is also omitted; otherwise every status for that document)" },
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
name: "resolve_feedback",
|
|
180
|
+
description: "Mark one or more feedback items resolved (or dismissed) after you've published a revision that addresses them. Pass `resolved_in` with the id of the new document from share_markdown (ideally one published with `parent` set to the original) so the reader can see what changed. Requires the activity:write scope (or the owner session).",
|
|
181
|
+
inputSchema: {
|
|
182
|
+
type: "object",
|
|
183
|
+
properties: {
|
|
184
|
+
ids: { type: "array", items: { type: "string" }, description: "Feedback item ids (from list_feedback's results, each item's `id`)" },
|
|
185
|
+
status: { type: "string", enum: ["resolved", "dismissed", "open"], description: "New status (default: resolved)" },
|
|
186
|
+
resolved_in: { type: "string", description: "Id of the new/revised document this feedback was addressed in (optional, recommended)" },
|
|
187
|
+
},
|
|
188
|
+
required: ["ids"],
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
async function fetchJson(url, init, errorPrefix) {
|
|
193
|
+
const response = await fetch(url, init);
|
|
194
|
+
if (!response.ok) {
|
|
195
|
+
const errorText = await response.text().catch(() => "unknown error");
|
|
196
|
+
throw new Error(`${errorPrefix}: ${response.status} ${response.statusText} — ${errorText}`);
|
|
197
|
+
}
|
|
198
|
+
return response.json();
|
|
199
|
+
}
|
|
200
|
+
function textContent(text) {
|
|
201
|
+
return { content: [{ type: "text", text }] };
|
|
202
|
+
}
|
|
203
|
+
// The actual tool implementations, factored out of the request handler so tests can call them
|
|
204
|
+
// directly (mocked global.fetch, no stdio transport) — the same shape the CLI's tests use for
|
|
205
|
+
// mcp/bin/mdshare-cli.mjs.
|
|
206
|
+
export async function callTool(toolName, args) {
|
|
207
|
+
if (toolName === "share_markdown") {
|
|
208
|
+
if (!args.markdown || typeof args.markdown !== "string") {
|
|
209
|
+
throw new Error("markdown argument is required and must be a string");
|
|
210
|
+
}
|
|
211
|
+
const body = { markdown: args.markdown };
|
|
212
|
+
if (args.ttl !== undefined)
|
|
213
|
+
body.ttl = args.ttl;
|
|
214
|
+
if (args.keep !== undefined)
|
|
215
|
+
body.keep = args.keep;
|
|
216
|
+
if (args.parent !== undefined)
|
|
217
|
+
body.parent = args.parent;
|
|
218
|
+
if (args.origin !== undefined)
|
|
219
|
+
body.origin = args.origin;
|
|
220
|
+
const data = await fetchJson(MDSHARE_API, { method: "POST", headers: authHeaders(), body: JSON.stringify(body) }, "mdshare API error");
|
|
221
|
+
if (!data.url)
|
|
222
|
+
throw new Error("mdshare API returned no URL");
|
|
223
|
+
return textContent(data.url);
|
|
224
|
+
}
|
|
225
|
+
if (toolName === "share_diagram") {
|
|
226
|
+
if (!args.svg || typeof args.svg !== "string") {
|
|
227
|
+
throw new Error("svg argument is required and must be a string");
|
|
228
|
+
}
|
|
229
|
+
const body = { svg: args.svg };
|
|
230
|
+
if (args.title)
|
|
231
|
+
body.title = args.title;
|
|
232
|
+
if (args.markdown)
|
|
233
|
+
body.markdown = args.markdown;
|
|
234
|
+
if (args.ttl !== undefined)
|
|
235
|
+
body.ttl = args.ttl;
|
|
236
|
+
const data = await fetchJson(MDSHARE_DIAGRAM_API, { method: "POST", headers: authHeaders(), body: JSON.stringify(body) }, "mdshare diagram API error");
|
|
237
|
+
if (!data.url)
|
|
238
|
+
throw new Error("mdshare diagram API returned no URL");
|
|
239
|
+
return textContent(data.url);
|
|
240
|
+
}
|
|
241
|
+
if (toolName === "auth_status") {
|
|
242
|
+
const token = resolveAgentToken();
|
|
243
|
+
if (!token)
|
|
244
|
+
throw new Error("No MDSHARE_AGENT_TOKEN / MDSHARE_AGENT_TOKEN_FILE configured for this agent");
|
|
245
|
+
const data = await fetchJson(`${MDSHARE_AUTH_API}?action=whoami`, { headers: authHeaders() }, "mdshare auth_status error");
|
|
246
|
+
return textContent(JSON.stringify(data, null, 2));
|
|
247
|
+
}
|
|
248
|
+
if (toolName === "search_documents") {
|
|
249
|
+
const params = new URLSearchParams();
|
|
250
|
+
if (args.q)
|
|
251
|
+
params.set("q", args.q);
|
|
252
|
+
if (args.kind)
|
|
253
|
+
params.set("kind", args.kind);
|
|
254
|
+
if (args.limit !== undefined)
|
|
255
|
+
params.set("limit", String(args.limit));
|
|
256
|
+
if (args.offset !== undefined)
|
|
257
|
+
params.set("offset", String(args.offset));
|
|
258
|
+
const data = await fetchJson(`${MDSHARE_PASTES_API}?${params.toString()}`, { headers: authHeaders() }, "mdshare search_documents error. Requires a bearer token with the documents:read scope");
|
|
259
|
+
return textContent(JSON.stringify(data, null, 2));
|
|
260
|
+
}
|
|
261
|
+
if (toolName === "read_document") {
|
|
262
|
+
if (!args.id || !args.kind)
|
|
263
|
+
throw new Error("id and kind are required");
|
|
264
|
+
const api = READ_API[args.kind];
|
|
265
|
+
if (!api)
|
|
266
|
+
throw new Error(`Unknown kind: ${args.kind}`);
|
|
267
|
+
const response = await fetch(`${api}?id=${encodeURIComponent(args.id)}`, { headers: authHeaders() });
|
|
268
|
+
if (!response.ok) {
|
|
269
|
+
const errorText = await response.text().catch(() => "unknown error");
|
|
270
|
+
throw new Error(`mdshare read_document error: ${response.status} — ${errorText}`);
|
|
271
|
+
}
|
|
272
|
+
const text = await response.text();
|
|
273
|
+
return textContent(text);
|
|
274
|
+
}
|
|
275
|
+
if (toolName === "publish_document") {
|
|
276
|
+
if (!args.id || !args.kind || typeof args.is_public !== "boolean") {
|
|
277
|
+
throw new Error("id, kind, and is_public are required");
|
|
278
|
+
}
|
|
279
|
+
const data = await fetchJson(MDSHARE_PIN_API, { method: "PATCH", headers: authHeaders(), body: JSON.stringify({ id: args.id, kind: args.kind, is_public: args.is_public }) }, "mdshare publish_document error. Requires documents:publish on a document this token itself created");
|
|
280
|
+
return textContent(JSON.stringify(data, null, 2));
|
|
281
|
+
}
|
|
282
|
+
if (toolName === "list_feedback") {
|
|
283
|
+
const params = new URLSearchParams({ action: "feedback" });
|
|
284
|
+
if (args.id)
|
|
285
|
+
params.set("id", args.id);
|
|
286
|
+
if (args.status)
|
|
287
|
+
params.set("status", args.status);
|
|
288
|
+
const data = await fetchJson(`${MDSHARE_DOC_API}?${params.toString()}`, { headers: authHeaders() }, "mdshare list_feedback error. Requires the activity:read scope");
|
|
289
|
+
return textContent(JSON.stringify(data, null, 2));
|
|
290
|
+
}
|
|
291
|
+
if (toolName === "resolve_feedback") {
|
|
292
|
+
if (!Array.isArray(args.ids) || args.ids.length === 0)
|
|
293
|
+
throw new Error("ids (a non-empty array of feedback ids) is required");
|
|
294
|
+
const body = { ids: args.ids, status: args.status || "resolved", resolved_in: args.resolved_in ?? null };
|
|
295
|
+
const data = await fetchJson(`${MDSHARE_DOC_API}?action=resolve`, { method: "POST", headers: authHeaders(), body: JSON.stringify(body) }, "mdshare resolve_feedback error. Requires the activity:write scope");
|
|
296
|
+
return textContent(JSON.stringify(data, null, 2));
|
|
297
|
+
}
|
|
298
|
+
throw new Error(`Unknown tool: ${toolName}`);
|
|
299
|
+
}
|
|
300
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,qFAAqF;AACrF,6FAA6F;AAC7F,+FAA+F;AA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C,CAAC;QACnD,MAAM,IAAI,GAAG,MAAM,SAAS,CAAC,GAAG,eAAe,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,EAAE,+DAA+D,CAAC,CAAC;QACrK,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,IAAI,QAAQ,KAAK,kBAAkB,EAAE,CAAC;QACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAC9H,MAAM,IAAI,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,UAAU,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;QACzG,MAAM,IAAI,GAAG,MAAM,SAAS,CAC1B,GAAG,eAAe,iBAAiB,EACnC,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EACtE,mEAAmE,CACpE,CAAC;QACF,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdshare",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "The output layer for AI agents
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "The output layer for AI agents — turn any markdown into a beautiful shareable link. MCP server for Claude Desktop & AI assistants.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"mdshare": "./dist/index.js"
|
|
7
|
+
"mdshare": "./dist/index.js",
|
|
8
|
+
"mdshare-cli": "./bin/mdshare-cli.mjs"
|
|
8
9
|
},
|
|
9
10
|
"main": "./dist/index.js",
|
|
10
11
|
"scripts": {
|
|
@@ -15,8 +16,8 @@
|
|
|
15
16
|
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
16
17
|
},
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
19
|
+
"typescript": "^5.0.0",
|
|
20
|
+
"@types/node": "^20.0.0"
|
|
20
21
|
},
|
|
21
22
|
"engines": {
|
|
22
23
|
"node": ">=18"
|
|
@@ -38,9 +39,9 @@
|
|
|
38
39
|
"type": "git",
|
|
39
40
|
"url": "https://github.com/RileyLin/mdshare"
|
|
40
41
|
},
|
|
41
|
-
"homepage": "https://github.com/RileyLin/mdshare#mcp-server-for-claude-desktop--ai-assistants",
|
|
42
42
|
"files": [
|
|
43
43
|
"dist/",
|
|
44
|
+
"bin/",
|
|
44
45
|
"README.md"
|
|
45
46
|
]
|
|
46
|
-
}
|
|
47
|
+
}
|