@memly/mcp-server 0.1.1 → 0.1.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/dist/index.js +53 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20139,6 +20139,57 @@ function registerResources(server, client) {
|
|
|
20139
20139
|
});
|
|
20140
20140
|
}
|
|
20141
20141
|
|
|
20142
|
+
// src/prompts.ts
|
|
20143
|
+
function registerPrompts(server, client) {
|
|
20144
|
+
server.prompt("restore_context", {
|
|
20145
|
+
project_id: exports_external.string().uuid().optional().describe("Project ID to load context from")
|
|
20146
|
+
}, async (args) => {
|
|
20147
|
+
const project_id = args?.project_id;
|
|
20148
|
+
const stats = await client.getStats();
|
|
20149
|
+
const project = stats.projects.find((p) => p.project_id === project_id) ?? stats.projects[0];
|
|
20150
|
+
if (!project) {
|
|
20151
|
+
return {
|
|
20152
|
+
messages: [
|
|
20153
|
+
{
|
|
20154
|
+
role: "assistant",
|
|
20155
|
+
content: {
|
|
20156
|
+
type: "text",
|
|
20157
|
+
text: "No memories found. I'm ready to start learning from this session."
|
|
20158
|
+
}
|
|
20159
|
+
}
|
|
20160
|
+
]
|
|
20161
|
+
};
|
|
20162
|
+
}
|
|
20163
|
+
const result = await client.searchMemories("context restore", project.project_id, 10);
|
|
20164
|
+
const memoryText = result.memories.map((m) => `[MEMORY:${m.id} (${m.created_at})]
|
|
20165
|
+
${m.content}`).join(`
|
|
20166
|
+
|
|
20167
|
+
`);
|
|
20168
|
+
return {
|
|
20169
|
+
messages: [
|
|
20170
|
+
{
|
|
20171
|
+
role: "user",
|
|
20172
|
+
content: {
|
|
20173
|
+
type: "text",
|
|
20174
|
+
text: `Restore context for project ${project.project_id}`
|
|
20175
|
+
}
|
|
20176
|
+
},
|
|
20177
|
+
{
|
|
20178
|
+
role: "assistant",
|
|
20179
|
+
content: {
|
|
20180
|
+
type: "text",
|
|
20181
|
+
text: `I've retrieved the following context from Memly:
|
|
20182
|
+
|
|
20183
|
+
${memoryText}
|
|
20184
|
+
|
|
20185
|
+
I am ready to continue our work.`
|
|
20186
|
+
}
|
|
20187
|
+
}
|
|
20188
|
+
]
|
|
20189
|
+
};
|
|
20190
|
+
});
|
|
20191
|
+
}
|
|
20192
|
+
|
|
20142
20193
|
// src/index.ts
|
|
20143
20194
|
var apiKey = process.env.MEMLY_API_KEY;
|
|
20144
20195
|
if (!apiKey) {
|
|
@@ -20162,6 +20213,7 @@ if (isHttp) {
|
|
|
20162
20213
|
const server = new McpServer({ name: "memly", version: "0.1.0" });
|
|
20163
20214
|
registerTools(server, client);
|
|
20164
20215
|
registerResources(server, client);
|
|
20216
|
+
registerPrompts(server, client);
|
|
20165
20217
|
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
20166
20218
|
sessionIdGenerator: undefined
|
|
20167
20219
|
});
|
|
@@ -20178,6 +20230,7 @@ if (isHttp) {
|
|
|
20178
20230
|
const server = new McpServer({ name: "memly", version: "0.1.0" });
|
|
20179
20231
|
registerTools(server, client);
|
|
20180
20232
|
registerResources(server, client);
|
|
20233
|
+
registerPrompts(server, client);
|
|
20181
20234
|
const transport = new StdioServerTransport;
|
|
20182
20235
|
await server.connect(transport);
|
|
20183
20236
|
console.error("\uD83E\uDDE0 Memly MCP Server (stdio) connected");
|