mcp-for-memos 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +334 -0
- package/dist/client.d.ts +15 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +155 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +27 -0
- package/dist/config.js.map +1 -0
- package/dist/http.d.ts +4 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +342 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +68 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +4 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +52 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +40 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/memos.d.ts +9 -0
- package/dist/tools/memos.d.ts.map +1 -0
- package/dist/tools/memos.js +137 -0
- package/dist/tools/memos.js.map +1 -0
- package/dist/tools/relations.d.ts +4 -0
- package/dist/tools/relations.d.ts.map +1 -0
- package/dist/tools/relations.js +108 -0
- package/dist/tools/relations.js.map +1 -0
- package/dist/tools/resources.d.ts +4 -0
- package/dist/tools/resources.d.ts.map +1 -0
- package/dist/tools/resources.js +90 -0
- package/dist/tools/resources.js.map +1 -0
- package/dist/tools/review.d.ts +4 -0
- package/dist/tools/review.d.ts.map +1 -0
- package/dist/tools/review.js +208 -0
- package/dist/tools/review.js.map +1 -0
- package/dist/tools/tags.d.ts +4 -0
- package/dist/tools/tags.d.ts.map +1 -0
- package/dist/tools/tags.js +164 -0
- package/dist/tools/tags.js.map +1 -0
- package/dist/tools/utils.d.ts +6 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +68 -0
- package/dist/tools/utils.js.map +1 -0
- package/dist/types.d.ts +36 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -0
package/dist/http.js
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
3
|
+
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
|
4
|
+
import { createServerWithClient } from "./server.js";
|
|
5
|
+
import { MemosClient } from "./client.js";
|
|
6
|
+
import { getCorsOrigins } from "./config.js";
|
|
7
|
+
// Logger simple
|
|
8
|
+
function log(level, message, meta) {
|
|
9
|
+
const timestamp = new Date().toISOString();
|
|
10
|
+
const metaStr = meta ? ` ${JSON.stringify(meta)}` : "";
|
|
11
|
+
console.log(`[${timestamp}] [${level.toUpperCase()}] ${message}${metaStr}`);
|
|
12
|
+
}
|
|
13
|
+
// Extraer Bearer token del header Authorization
|
|
14
|
+
function extractBearerToken(req) {
|
|
15
|
+
const authHeader = req.headers.authorization;
|
|
16
|
+
if (!authHeader || !authHeader.startsWith("Bearer ")) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return authHeader.slice(7);
|
|
20
|
+
}
|
|
21
|
+
// Rate limiting configuration
|
|
22
|
+
const RATE_LIMIT_WINDOW_MS = 60_000; // 1 minute
|
|
23
|
+
const RATE_LIMIT_MAX_REQUESTS = 100; // 100 requests per minute per IP
|
|
24
|
+
const rateLimitMap = new Map();
|
|
25
|
+
// Sweep de rate limit cada 30 segundos
|
|
26
|
+
setInterval(() => {
|
|
27
|
+
const now = Date.now();
|
|
28
|
+
for (const [key, entry] of rateLimitMap) {
|
|
29
|
+
if (now - entry.timestamp > RATE_LIMIT_WINDOW_MS) {
|
|
30
|
+
rateLimitMap.delete(key);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, 30_000);
|
|
34
|
+
// Rate limiting middleware
|
|
35
|
+
function rateLimit(req, res, next) {
|
|
36
|
+
const ip = req.ip || req.socket.remoteAddress || "unknown";
|
|
37
|
+
const now = Date.now();
|
|
38
|
+
const entry = rateLimitMap.get(ip);
|
|
39
|
+
if (!entry || now - entry.timestamp > RATE_LIMIT_WINDOW_MS) {
|
|
40
|
+
rateLimitMap.set(ip, { count: 1, timestamp: now });
|
|
41
|
+
next();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (entry.count >= RATE_LIMIT_MAX_REQUESTS) {
|
|
45
|
+
res.status(429).json({ error: "Too many requests. Try again later." });
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
entry.count++;
|
|
49
|
+
next();
|
|
50
|
+
}
|
|
51
|
+
// Configuración de SSE sessions
|
|
52
|
+
const SSE_IDLE_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutos
|
|
53
|
+
const SSE_MAX_SESSIONS = 100;
|
|
54
|
+
// Map para mantener sesiones SSE activas
|
|
55
|
+
const sseSessions = new Map();
|
|
56
|
+
// Sweep de sesiones SSE idle
|
|
57
|
+
function sweepIdleSessions() {
|
|
58
|
+
const now = Date.now();
|
|
59
|
+
for (const [id, session] of sseSessions) {
|
|
60
|
+
if (now - session.lastActivity > SSE_IDLE_TIMEOUT_MS) {
|
|
61
|
+
log("info", "Closing idle SSE session", { sessionId: id });
|
|
62
|
+
session.transport.close();
|
|
63
|
+
sseSessions.delete(id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
// Sweep cada 30 segundos
|
|
68
|
+
setInterval(sweepIdleSessions, 30_000);
|
|
69
|
+
// Crear aplicación Express
|
|
70
|
+
export function createHttpApp(config) {
|
|
71
|
+
const app = express();
|
|
72
|
+
// Middleware
|
|
73
|
+
app.use(express.json({ limit: "10mb" }));
|
|
74
|
+
// Request ID middleware
|
|
75
|
+
app.use((req, _res, next) => {
|
|
76
|
+
req.requestId = Math.random().toString(36).slice(2, 11);
|
|
77
|
+
next();
|
|
78
|
+
});
|
|
79
|
+
// Logging middleware
|
|
80
|
+
app.use((req, res, next) => {
|
|
81
|
+
const requestId = req.requestId;
|
|
82
|
+
log("info", `${req.method} ${req.path}`, { requestId, ip: req.ip });
|
|
83
|
+
next();
|
|
84
|
+
});
|
|
85
|
+
// CORS
|
|
86
|
+
const corsOrigins = getCorsOrigins(config);
|
|
87
|
+
app.use((req, res, next) => {
|
|
88
|
+
const origin = req.headers.origin;
|
|
89
|
+
if (origin && (corsOrigins.includes("*") || corsOrigins.includes(origin))) {
|
|
90
|
+
res.setHeader("Access-Control-Allow-Origin", origin);
|
|
91
|
+
}
|
|
92
|
+
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
|
93
|
+
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization, MCT-PROXY-VERSION");
|
|
94
|
+
if (req.method === "OPTIONS") {
|
|
95
|
+
res.sendStatus(200);
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
next();
|
|
99
|
+
});
|
|
100
|
+
// Rate limiting
|
|
101
|
+
app.use(rateLimit);
|
|
102
|
+
// Health check endpoint
|
|
103
|
+
app.get("/health", (_req, res) => {
|
|
104
|
+
const uptime = process.uptime();
|
|
105
|
+
const memUsage = process.memoryUsage();
|
|
106
|
+
res.json({
|
|
107
|
+
status: "ok",
|
|
108
|
+
timestamp: new Date().toISOString(),
|
|
109
|
+
version: "3.0.0",
|
|
110
|
+
activeSessions: sseSessions.size,
|
|
111
|
+
uptime: Math.floor(uptime),
|
|
112
|
+
memory: {
|
|
113
|
+
rss: Math.floor(memUsage.rss / 1024 / 1024),
|
|
114
|
+
heapUsed: Math.floor(memUsage.heapUsed / 1024 / 1024),
|
|
115
|
+
heapTotal: Math.floor(memUsage.heapTotal / 1024 / 1024),
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
// HEAD request for MCP discovery (no auth required for protocol discovery)
|
|
120
|
+
app.head("/mcp", (_req, res) => {
|
|
121
|
+
res.setHeader("Content-Type", "application/json");
|
|
122
|
+
res.status(200).end();
|
|
123
|
+
});
|
|
124
|
+
// Streamable HTTP endpoint (moderno) - POST
|
|
125
|
+
app.post("/mcp", async (req, res) => {
|
|
126
|
+
const requestId = req.requestId;
|
|
127
|
+
const token = extractBearerToken(req);
|
|
128
|
+
if (!token) {
|
|
129
|
+
log("warn", "Missing or invalid Authorization header", { requestId });
|
|
130
|
+
res.status(401).json({ error: "Missing or invalid Authorization header. Use: Authorization: Bearer <token>" });
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (!config.MEMOS_URL) {
|
|
134
|
+
log("error", "MEMOS_URL not configured");
|
|
135
|
+
res.status(500).json({ error: "Server configuration error: MEMOS_URL not set" });
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const transport = new StreamableHTTPServerTransport({
|
|
139
|
+
sessionIdGenerator: undefined, // Stateless
|
|
140
|
+
});
|
|
141
|
+
const client = new MemosClient(config.MEMOS_URL, token);
|
|
142
|
+
const server = createServerWithClient(client);
|
|
143
|
+
let cleanedUp = false;
|
|
144
|
+
const cleanup = () => {
|
|
145
|
+
if (cleanedUp)
|
|
146
|
+
return;
|
|
147
|
+
cleanedUp = true;
|
|
148
|
+
try {
|
|
149
|
+
transport.close();
|
|
150
|
+
}
|
|
151
|
+
catch { }
|
|
152
|
+
try {
|
|
153
|
+
server.close();
|
|
154
|
+
}
|
|
155
|
+
catch { }
|
|
156
|
+
};
|
|
157
|
+
try {
|
|
158
|
+
await server.connect(transport);
|
|
159
|
+
await transport.handleRequest(req, res, req.body);
|
|
160
|
+
res.on("close", cleanup);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
log("error", "Error handling MCP request", { requestId, error: String(error) });
|
|
164
|
+
cleanup();
|
|
165
|
+
if (!res.headersSent) {
|
|
166
|
+
res.status(500).json({ error: "Internal server error" });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
// Streamable HTTP endpoint - GET
|
|
171
|
+
app.get("/mcp", async (req, res) => {
|
|
172
|
+
const requestId = req.requestId;
|
|
173
|
+
const token = extractBearerToken(req);
|
|
174
|
+
if (!token) {
|
|
175
|
+
res.status(401).json({ error: "Missing or invalid Authorization header" });
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
if (!config.MEMOS_URL) {
|
|
179
|
+
res.status(500).json({ error: "Server configuration error: MEMOS_URL not set" });
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const transport = new StreamableHTTPServerTransport({
|
|
183
|
+
sessionIdGenerator: undefined,
|
|
184
|
+
});
|
|
185
|
+
const client = new MemosClient(config.MEMOS_URL, token);
|
|
186
|
+
const server = createServerWithClient(client);
|
|
187
|
+
let cleanedUp = false;
|
|
188
|
+
const cleanup = () => {
|
|
189
|
+
if (cleanedUp)
|
|
190
|
+
return;
|
|
191
|
+
cleanedUp = true;
|
|
192
|
+
try {
|
|
193
|
+
transport.close();
|
|
194
|
+
}
|
|
195
|
+
catch { }
|
|
196
|
+
try {
|
|
197
|
+
server.close();
|
|
198
|
+
}
|
|
199
|
+
catch { }
|
|
200
|
+
};
|
|
201
|
+
try {
|
|
202
|
+
await server.connect(transport);
|
|
203
|
+
await transport.handleRequest(req, res);
|
|
204
|
+
res.on("close", cleanup);
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
log("error", "Error in MCP GET", { requestId, error: String(error) });
|
|
208
|
+
cleanup();
|
|
209
|
+
if (!res.headersSent) {
|
|
210
|
+
res.status(500).json({ error: "Internal server error" });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
// SSE endpoint - GET para iniciar stream
|
|
215
|
+
app.get("/sse", async (req, res) => {
|
|
216
|
+
const requestId = req.requestId;
|
|
217
|
+
const token = extractBearerToken(req);
|
|
218
|
+
if (!token) {
|
|
219
|
+
res.status(401).json({ error: "Missing or invalid Authorization header" });
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (!config.MEMOS_URL) {
|
|
223
|
+
res.status(500).json({ error: "Server configuration error: MEMOS_URL not set" });
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
// Verificar límite de sesiones
|
|
227
|
+
if (sseSessions.size >= SSE_MAX_SESSIONS) {
|
|
228
|
+
log("warn", "SSE session limit reached", { currentSessions: sseSessions.size, requestId });
|
|
229
|
+
res.status(429).json({ error: "Too many SSE sessions. Try again later." });
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const transport = new SSEServerTransport("/sse/messages", res);
|
|
233
|
+
const client = new MemosClient(config.MEMOS_URL, token);
|
|
234
|
+
const server = createServerWithClient(client);
|
|
235
|
+
// Guardar sesión
|
|
236
|
+
sseSessions.set(transport.sessionId, {
|
|
237
|
+
transport,
|
|
238
|
+
lastActivity: Date.now(),
|
|
239
|
+
});
|
|
240
|
+
// Cleanup cuando se cierra la conexión
|
|
241
|
+
res.on("close", () => {
|
|
242
|
+
sseSessions.delete(transport.sessionId);
|
|
243
|
+
try {
|
|
244
|
+
transport.close();
|
|
245
|
+
}
|
|
246
|
+
catch { }
|
|
247
|
+
try {
|
|
248
|
+
server.close();
|
|
249
|
+
}
|
|
250
|
+
catch { }
|
|
251
|
+
});
|
|
252
|
+
try {
|
|
253
|
+
await server.connect(transport);
|
|
254
|
+
transport.start();
|
|
255
|
+
log("info", "SSE session started", { sessionId: transport.sessionId, requestId });
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
log("error", "Error starting SSE", { requestId, error: String(error) });
|
|
259
|
+
sseSessions.delete(transport.sessionId);
|
|
260
|
+
try {
|
|
261
|
+
transport.close();
|
|
262
|
+
}
|
|
263
|
+
catch { }
|
|
264
|
+
try {
|
|
265
|
+
server.close();
|
|
266
|
+
}
|
|
267
|
+
catch { }
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
// SSE endpoint - POST para recibir mensajes
|
|
271
|
+
app.post("/sse/messages", async (req, res) => {
|
|
272
|
+
const sessionId = req.query.sessionId;
|
|
273
|
+
if (!sessionId) {
|
|
274
|
+
res.status(400).json({ error: "Missing sessionId query parameter" });
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const session = sseSessions.get(sessionId);
|
|
278
|
+
if (!session) {
|
|
279
|
+
res.status(404).json({ error: "Session not found or expired" });
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
// Actualizar actividad
|
|
283
|
+
session.lastActivity = Date.now();
|
|
284
|
+
try {
|
|
285
|
+
await session.transport.handlePostMessage(req, res, req.body);
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
log("error", "Error handling SSE message", { sessionId, error: String(error) });
|
|
289
|
+
if (!res.headersSent) {
|
|
290
|
+
res.status(500).json({ error: "Internal server error" });
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
// Error handler
|
|
295
|
+
app.use((err, _req, res, _next) => {
|
|
296
|
+
log("error", "Unhandled error", { error: err.message, stack: err.stack });
|
|
297
|
+
if (!res.headersSent) {
|
|
298
|
+
res.status(500).json({ error: "Internal server error" });
|
|
299
|
+
}
|
|
300
|
+
});
|
|
301
|
+
return app;
|
|
302
|
+
}
|
|
303
|
+
// Iniciar servidor HTTP
|
|
304
|
+
export function startHttpServer(config) {
|
|
305
|
+
const app = createHttpApp(config);
|
|
306
|
+
const { HTTP_PORT, HTTP_HOST } = config;
|
|
307
|
+
const server = app.listen(HTTP_PORT, HTTP_HOST, () => {
|
|
308
|
+
log("info", `HTTP server started`, {
|
|
309
|
+
host: HTTP_HOST,
|
|
310
|
+
port: HTTP_PORT,
|
|
311
|
+
url: `http://${HTTP_HOST}:${HTTP_PORT}`,
|
|
312
|
+
});
|
|
313
|
+
log("info", `Endpoints:`, {
|
|
314
|
+
health: `GET http://${HTTP_HOST}:${HTTP_PORT}/health`,
|
|
315
|
+
mcp: `POST http://${HTTP_HOST}:${HTTP_PORT}/mcp`,
|
|
316
|
+
sse: `GET http://${HTTP_HOST}:${HTTP_PORT}/sse`,
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
// Graceful shutdown - cerrar todo limpiamente
|
|
320
|
+
const shutdown = () => {
|
|
321
|
+
log("info", "Shutting down HTTP server...");
|
|
322
|
+
// Cerrar todas las sesiones SSE
|
|
323
|
+
for (const [id, session] of sseSessions) {
|
|
324
|
+
session.transport.close();
|
|
325
|
+
sseSessions.delete(id);
|
|
326
|
+
}
|
|
327
|
+
// Cerrar el servidor Express
|
|
328
|
+
server.close(() => {
|
|
329
|
+
log("info", "HTTP server stopped");
|
|
330
|
+
process.exit(0);
|
|
331
|
+
});
|
|
332
|
+
// Forzar salida después de 5 segundos
|
|
333
|
+
setTimeout(() => {
|
|
334
|
+
log("warn", "Force shutdown after timeout");
|
|
335
|
+
process.exit(1);
|
|
336
|
+
}, 5_000);
|
|
337
|
+
};
|
|
338
|
+
process.on("SIGINT", shutdown);
|
|
339
|
+
process.on("SIGTERM", shutdown);
|
|
340
|
+
return server;
|
|
341
|
+
}
|
|
342
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,OAA4C,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC7E,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAU,cAAc,EAAE,MAAM,aAAa,C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CAAC;YAC1B,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC;QAED,6BAA6B;QAC7B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE;YAChB,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,sCAAsC;QACtC,UAAU,CAAC,GAAG,EAAE;YACd,GAAG,CAAC,MAAM,EAAE,8BAA8B,CAAC,CAAC;YAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,EAAE,KAAK,CAAC,CAAC;IACZ,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEhC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createServer } from "./server.js";
|
|
4
|
+
import { startHttpServer } from "./http.js";
|
|
5
|
+
import { loadConfig } from "./config.js";
|
|
6
|
+
// Detectar modo de ejecución
|
|
7
|
+
const args = process.argv.slice(2);
|
|
8
|
+
const isHttpMode = args.includes("--http") || args.includes("-h");
|
|
9
|
+
const showHelp = args.includes("--help") || args.includes("-?");
|
|
10
|
+
// Parse port argument
|
|
11
|
+
let customPort;
|
|
12
|
+
const portIndex = args.indexOf("--port");
|
|
13
|
+
if (portIndex !== -1 && args[portIndex + 1]) {
|
|
14
|
+
customPort = parseInt(args[portIndex + 1], 10);
|
|
15
|
+
if (isNaN(customPort) || customPort < 1 || customPort > 65535) {
|
|
16
|
+
console.error("Invalid port. Use --port with a number between 1 and 65535.");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
// Mostrar ayuda
|
|
21
|
+
if (showHelp) {
|
|
22
|
+
console.log(`
|
|
23
|
+
memos-mcp - Model Context Protocol server for Memos
|
|
24
|
+
|
|
25
|
+
Usage:
|
|
26
|
+
memos-mcp Start in stdio mode (for Claude Desktop/Code)
|
|
27
|
+
memos-mcp --http Start in HTTP/SSE mode (for OpenCode/LibreChat)
|
|
28
|
+
|
|
29
|
+
Environment variables:
|
|
30
|
+
MEMOS_URL Memos instance URL (required)
|
|
31
|
+
|
|
32
|
+
HTTP mode:
|
|
33
|
+
No token needed in .env. Each client sends its own token via
|
|
34
|
+
Authorization: Bearer <token> header. The server uses that token
|
|
35
|
+
to access Memos as that specific user.
|
|
36
|
+
|
|
37
|
+
HTTP_PORT HTTP server port (default: 3000)
|
|
38
|
+
HTTP_HOST HTTP server host (default: 127.0.0.1)
|
|
39
|
+
CORS_ORIGIN Allowed CORS origins (default: *)
|
|
40
|
+
LOG_LEVEL Log level: debug, info, warn, error (default: info)
|
|
41
|
+
|
|
42
|
+
Stdio mode:
|
|
43
|
+
MEMOS_TOKEN Memos access token (required for stdio only)
|
|
44
|
+
|
|
45
|
+
Examples:
|
|
46
|
+
# Claude Desktop/Code (stdio) - token in env
|
|
47
|
+
MEMOS_URL=https://memos.example.com MEMOS_TOKEN=xxx npx memos-mcp
|
|
48
|
+
|
|
49
|
+
# OpenCode/LibreChat (HTTP) - token in client config
|
|
50
|
+
MEMOS_URL=https://memos.example.com npx memos-mcp --http
|
|
51
|
+
`);
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
// Modo HTTP
|
|
55
|
+
if (isHttpMode) {
|
|
56
|
+
// Override port if specified via CLI
|
|
57
|
+
if (customPort) {
|
|
58
|
+
process.env.HTTP_PORT = String(customPort);
|
|
59
|
+
}
|
|
60
|
+
const config = loadConfig();
|
|
61
|
+
console.log(`Starting memos-mcp in HTTP mode...`);
|
|
62
|
+
console.log(`Server will accept requests at:`);
|
|
63
|
+
console.log(` - http://${config.HTTP_HOST}:${config.HTTP_PORT}/mcp (Streamable HTTP)`);
|
|
64
|
+
console.log(` - http://${config.HTTP_HOST}:${config.HTTP_PORT}/sse (SSE)`);
|
|
65
|
+
console.log(` - http://${config.HTTP_HOST}:${config.HTTP_PORT}/health (Health check)`);
|
|
66
|
+
console.log(``);
|
|
67
|
+
console.log(`Each request must include: Authorization: Bearer <token>`);
|
|
68
|
+
startHttpServer(config);
|
|
69
|
+
}
|
|
70
|
+
// Modo stdio (default)
|
|
71
|
+
else {
|
|
72
|
+
const server = createServer();
|
|
73
|
+
const transport = new StdioServerTransport();
|
|
74
|
+
server.connect(transport).catch((err) => {
|
|
75
|
+
console.error("Failed to connect transport:", err);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,6BAA6B;AAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC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I,MAAM,CAAC,SAAS,YAAY,CAAC,CAAC;IAC5E,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,wBAAwB,CAAC,CAAC;IACxF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;IACxE,eAAe,CAAC,MAAM,CAAC,CAAC;AAC1B,CAAC;AACD,uBAAuB;KAClB,CAAC;IACJ,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACtC,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,GAAG,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,eAAO,MAAM,eAAe,GAAI,QAAQ,SAAS,SAqFhD,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const registerPrompts = (server) => {
|
|
3
|
+
// capture — save a thought
|
|
4
|
+
server.registerPrompt("capture", {
|
|
5
|
+
description: "Quick-save a thought, note, task, or idea",
|
|
6
|
+
argsSchema: {
|
|
7
|
+
content: z.string().describe("The thought or note to save"),
|
|
8
|
+
tags: z.string().optional().describe("Comma-separated tags (e.g. 'idea,project')"),
|
|
9
|
+
visibility: z.enum(["PRIVATE", "PROTECTED", "PUBLIC"]).default("PRIVATE"),
|
|
10
|
+
},
|
|
11
|
+
}, ({ content, tags, visibility }) => {
|
|
12
|
+
let memoContent = content;
|
|
13
|
+
if (tags) {
|
|
14
|
+
memoContent = `${memoContent}\n\n${tags.split(",").map((t) => `#${t.trim()}`).join(" ")}`;
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
messages: [{
|
|
18
|
+
role: "user",
|
|
19
|
+
content: { type: "text", text: `Create a memo using the create tool. Visibility: ${visibility}.\n\nContent:\n${memoContent}` },
|
|
20
|
+
}],
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
// review — review memos from a period
|
|
24
|
+
server.registerPrompt("review", {
|
|
25
|
+
description: "Review memos from a time period",
|
|
26
|
+
argsSchema: {
|
|
27
|
+
period: z.enum(["today", "week", "month", "year"]).default("week"),
|
|
28
|
+
},
|
|
29
|
+
}, ({ period }) => {
|
|
30
|
+
const map = {
|
|
31
|
+
today: { date: "today" },
|
|
32
|
+
week: { date: "this_week", week: true },
|
|
33
|
+
month: { date: "this_month" },
|
|
34
|
+
year: { date: "2024-01-01", endDate: "2024-12-31" },
|
|
35
|
+
};
|
|
36
|
+
const { date, week, endDate } = map[period];
|
|
37
|
+
const weekArg = week ? ", week=true" : "";
|
|
38
|
+
const endDateArg = endDate ? `, endDate="${endDate}"` : "";
|
|
39
|
+
return {
|
|
40
|
+
messages: [{
|
|
41
|
+
role: "user",
|
|
42
|
+
content: { type: "text", text: `Review your memos from ${period}.\n\n1. search(date="${date}"${weekArg}${endDateArg})\n2. get(id="<id>") for each memo, one at a time\n3. Wait for user confirmation between each\n4. Summarize when done` },
|
|
43
|
+
}],
|
|
44
|
+
};
|
|
45
|
+
});
|
|
46
|
+
// on_day — check a specific date
|
|
47
|
+
server.registerPrompt("on_day", {
|
|
48
|
+
description: "Check what happened or is planned for a specific date",
|
|
49
|
+
argsSchema: {
|
|
50
|
+
date: z.string().describe("Date to check (ISO 8601, 'today', 'yesterday', 'next_monday', etc.)"),
|
|
51
|
+
},
|
|
52
|
+
}, ({ date }) => ({
|
|
53
|
+
messages: [{
|
|
54
|
+
role: "user",
|
|
55
|
+
content: { type: "text", text: `Check what happened or is planned for ${date}.\n\nUse: search(date="${date}")\nPresent the memos found.` },
|
|
56
|
+
}],
|
|
57
|
+
}));
|
|
58
|
+
// tag_overview — analyze tags
|
|
59
|
+
server.registerPrompt("tag_overview", {
|
|
60
|
+
description: "Analyze your tag system and suggest improvements",
|
|
61
|
+
}, () => ({
|
|
62
|
+
messages: [{
|
|
63
|
+
role: "user",
|
|
64
|
+
content: { type: "text", text: `Analyze my tag organization.\n\n1. tags() for top-level tags\n2. tags(parent="<tag>") for children\n3. Present: hierarchy, usage, cleanup suggestions` },
|
|
65
|
+
}],
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAiB,EAAE,EAAE;IACnD,2BAA2B;IAC3B,MAAM,CAAC,cAAc,CACnB,SAAS,EACT;QACE,WAAW,EAAE,2CAA2C;QACxD,UAAU,EAAE;YACV,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;YAC3D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;YAClF,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;SAC1E;KACF,EACD,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE;QAChC,IAAI,WAAW,GAAG,OAAO,CAAC;QAC1B,IAAI,IAAI,EAAE,CAAC;YACT,WA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E,QAAQ,WAAW,SA8DvE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { getPromptDefinitions } from "../prompts/index.js";
|
|
2
|
+
export const registerResources = (server, client) => {
|
|
3
|
+
server.registerResource("memo", "memo://memos/{uid}", { description: "A memo by its UID", mimeType: "text/markdown" }, async (uri) => {
|
|
4
|
+
const uid = uri.pathname.split("/").pop();
|
|
5
|
+
if (!uid) {
|
|
6
|
+
throw new Error("Invalid memo URI: missing UID");
|
|
7
|
+
}
|
|
8
|
+
const memo = await client.get(`/api/v1/memos:by-uid/${uid}`);
|
|
9
|
+
const id = memo.name?.match(/^memos\/(\d+)$/)?.[1];
|
|
10
|
+
const frontmatter = [
|
|
11
|
+
"---",
|
|
12
|
+
id ? `id: ${id}` : null,
|
|
13
|
+
`uid: ${memo.uid}`,
|
|
14
|
+
`visibility: ${memo.visibility}`,
|
|
15
|
+
memo.pinned ? `pinned: true` : null,
|
|
16
|
+
`created: ${memo.createTime}`,
|
|
17
|
+
`updated: ${memo.updateTime}`,
|
|
18
|
+
memo.tags?.length ? `tags: [${memo.tags.join(", ")}]` : null,
|
|
19
|
+
"---",
|
|
20
|
+
]
|
|
21
|
+
.filter(Boolean)
|
|
22
|
+
.join("\n");
|
|
23
|
+
return {
|
|
24
|
+
contents: [
|
|
25
|
+
{
|
|
26
|
+
uri: uri.href,
|
|
27
|
+
mimeType: "text/markdown",
|
|
28
|
+
text: `${frontmatter}\n\n${memo.content}`,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
// Expose prompts as readable resources so the assistant can access them
|
|
34
|
+
// programmatically (e.g. from channel conversations where slash commands
|
|
35
|
+
// are not available).
|
|
36
|
+
const prompts = getPromptDefinitions();
|
|
37
|
+
for (const [name, prompt] of Object.entries(prompts)) {
|
|
38
|
+
server.registerResource(`prompt-${name}`, `memo://prompts/${name}`, {
|
|
39
|
+
description: `Prompt: ${prompt.description}`,
|
|
40
|
+
mimeType: "text/markdown",
|
|
41
|
+
}, async (uri) => ({
|
|
42
|
+
contents: [
|
|
43
|
+
{
|
|
44
|
+
uri: uri.href,
|
|
45
|
+
mimeType: "text/markdown",
|
|
46
|
+
text: prompt.text,
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAiB,EAAE,MAAmB,EAAE,EAAE;IAC1E,MAAM,CAAC,gBAAgB,CACrB,MAAM,EACN,oBAAoB,EACpB,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,eAAe,EAAE,EAC/D,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;QAC1C,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,GAAG,CAAO,wBAAwB,GAAG,EAAE,CAAC,CAAC;QAEnE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,WAAW,GAAG;YAClB,KAAK;YACL,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI;YACvB,QAAQ,IAAI,CAAC,GAAG,EAAE;YAClB,eAAe,IAAI,CAAC,UAAU,EAAE;YAChC,IAAI,CAAC,MAAM,C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";
|
|
2
|
+
import { MemosClient } from "./client.js";
|
|
3
|
+
import { type Visibility } from "./types.js";
|
|
4
|
+
export interface ServerOptions {
|
|
5
|
+
defaultVisibility?: Visibility;
|
|
6
|
+
}
|
|
7
|
+
export declare const createServerWithClient: (client: MemosClient, options?: ServerOptions) => McpServer;
|
|
8
|
+
export declare const createServer: () => McpServer;
|
|
9
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK1C,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,EAAE,UAAU,CAAC;CAChC;AAGD,eAAO,MAAM,sBAAsB,GACjC,QAAQ,WAAW,EACnB,UAAS,aAAkB,cAe5B,CAAC;AAGF,eAAO,MAAM,YAAY,iBAqBxB,CAAC"}
|