@laskarks/mcp-rag-node 1.0.3 → 1.0.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laskarks/mcp-rag-node",
3
- "version": "1.0.3",
3
+ "version": "1.0.6",
4
4
  "description": "Simple MCP RAG server using @modelcontextprotocol/sdk",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/ai.ts CHANGED
@@ -142,7 +142,14 @@ class AI {
142
142
  topK: 3,
143
143
  includeMetadata: true,
144
144
  });
145
- return results;
145
+
146
+ // Get text from metadata
147
+ const relevantChunks = results.matches.map((match) => ({
148
+ text: match.metadata?.text as string,
149
+ score: match.score,
150
+ }));
151
+ const context = relevantChunks.map((c) => c.text).join("\n\n");
152
+ return context;
146
153
  } else {
147
154
  return response?.data[0] || "Unexpected error";
148
155
  }
package/src/index.ts CHANGED
@@ -78,7 +78,7 @@ async function main() {
78
78
  async ({ keyword }: { keyword: string }) => {
79
79
  const response = await CallAI.search_documents(keyword);
80
80
  return {
81
- content: [{ type: "text", text: `${response}` }],
81
+ content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
82
82
  };
83
83
  },
84
84
  );