@laskarks/mcp-rag-node 1.0.6 → 1.0.8

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 CHANGED
@@ -2,6 +2,50 @@
2
2
 
3
3
  MCP (Model Context Protocol) server for RAG (Retrieval-Augmented Generation) using Pinecone, OpenAI-compatible embedding APIs, and the official MCP SDK. Save documents and search by semantic similarity via MCP tools.
4
4
 
5
+ ### Add to MCP clients
6
+
7
+ **Claude Desktop** (`claude_desktop_config.json`):
8
+
9
+ ```json
10
+ {
11
+ "mcpServers": {
12
+ "rag": {
13
+ "command": "npx",
14
+ "args": ["-y", "@laskarks/mcp-rag-node@latest"],
15
+ "env": {
16
+ "APIKEY": "sk-...",
17
+ "EMBEDDING_MODEL": "text-embedding-3-small",
18
+ "RAG_CHUNK_MAX_TOKENS": 1536,
19
+ "PINECONE_API_KEY": "...",
20
+ "PINECONE_INDEX": "rag-index",
21
+ "PROVIDER": "openai"
22
+ }
23
+ }
24
+ }
25
+ }
26
+ ```
27
+
28
+ **Cursor** (`.cursor/mcp.json` or MCP settings):
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "rag": {
34
+ "command": "npx",
35
+ "args": ["-y", "@laskarks/mcp-rag-node@latest"],
36
+ "env": {
37
+ "APIKEY": "sk-...",
38
+ "EMBEDDING_MODEL": "text-embedding-3-small",
39
+ "RAG_CHUNK_MAX_TOKENS": 1536,
40
+ "PINECONE_API_KEY": "...",
41
+ "PINECONE_INDEX": "rag-index",
42
+ "PROVIDER": "openai"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
5
49
  ## Tools
6
50
 
7
51
  | Tool | Description |
@@ -50,7 +94,7 @@ For OpenRouter, use the model ID format, e.g. `openai/text-embedding-3-small` or
50
94
 
51
95
  | Variable | Description | Default |
52
96
  | ---------------------- | ------------------------------------- | ------- |
53
- | `RAG_CHUNK_MAX_TOKENS` | Max tokens per chunk before embedding | `512` |
97
+ | `RAG_CHUNK_MAX_TOKENS` | Max tokens per chunk before embedding | `1536` |
54
98
  | `RAG_CHUNK_OVERLAP` | Overlap tokens between chunks | `50` |
55
99
 
56
100
  ## Usage
@@ -77,50 +121,6 @@ PROVIDER=openai
77
121
  npm start
78
122
  ```
79
123
 
80
- ### Add to MCP clients
81
-
82
- Install the package first: `npm i @laskarks/mcp-rag-node`
83
-
84
- **Claude Desktop** (`claude_desktop_config.json`):
85
-
86
- ```json
87
- {
88
- "mcpServers": {
89
- "rag": {
90
- "command": "npx",
91
- "args": ["-y", "@laskarks/mcp-rag-node"],
92
- "env": {
93
- "APIKEY": "sk-...",
94
- "EMBEDDING_MODEL": "text-embedding-3-small",
95
- "PINECONE_API_KEY": "...",
96
- "PINECONE_INDEX": "rag-index",
97
- "PROVIDER": "openai"
98
- }
99
- }
100
- }
101
- }
102
- ```
103
-
104
- **Cursor** (`.cursor/mcp.json` or MCP settings):
105
-
106
- ```json
107
- {
108
- "mcpServers": {
109
- "rag": {
110
- "command": "npx",
111
- "args": ["-y", "@laskarks/mcp-rag-node"],
112
- "env": {
113
- "APIKEY": "sk-...",
114
- "EMBEDDING_MODEL": "text-embedding-3-small",
115
- "PINECONE_API_KEY": "...",
116
- "PINECONE_INDEX": "rag-index",
117
- "PROVIDER": "openai"
118
- }
119
- }
120
- }
121
- }
122
- ```
123
-
124
124
  ### Development
125
125
 
126
126
  ```bash
package/dist/ai.js CHANGED
@@ -52,7 +52,7 @@ class AI {
52
52
  chunkByToken(text, maxTokens, overlap) {
53
53
  const defaultMax = env.RAG_CHUNK_MAX_TOKENS
54
54
  ? Number(env.RAG_CHUNK_MAX_TOKENS)
55
- : 512;
55
+ : 1536;
56
56
  const defaultOverlap = 50;
57
57
  const limit = maxTokens ?? defaultMax;
58
58
  const overlapTokens = overlap ?? defaultOverlap;
@@ -129,13 +129,13 @@ class AI {
129
129
  topK: 3,
130
130
  includeMetadata: true,
131
131
  });
132
- return results;
133
- // const relevantChunks = results.matches.map((match) => ({
134
- // text: match.metadata?.text as string,
135
- // score: match.score,
136
- // }));
137
- // const context = relevantChunks.map((c) => c.text).join("\n\n");
138
- // return context;
132
+ // Get text from metadata
133
+ const relevantChunks = results.matches.map((match) => ({
134
+ text: match.metadata?.text,
135
+ score: match.score,
136
+ }));
137
+ const context = relevantChunks.map((c) => c.text).join("\n\n");
138
+ return context;
139
139
  }
140
140
  else {
141
141
  return response?.data[0] || "Unexpected error";
package/dist/index.js CHANGED
@@ -60,7 +60,7 @@ async function main() {
60
60
  }, async ({ keyword }) => {
61
61
  const response = await CallAI.search_documents(keyword);
62
62
  return {
63
- content: [{ type: "text", text: `${response}` }],
63
+ content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
64
64
  };
65
65
  });
66
66
  const transport = new StdioServerTransport();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@laskarks/mcp-rag-node",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Simple MCP RAG server using @modelcontextprotocol/sdk",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/ai.ts CHANGED
@@ -68,7 +68,7 @@ class AI {
68
68
  chunkByToken(text: string, maxTokens?: number, overlap?: number): string[] {
69
69
  const defaultMax = env.RAG_CHUNK_MAX_TOKENS
70
70
  ? Number(env.RAG_CHUNK_MAX_TOKENS)
71
- : 512;
71
+ : 1536;
72
72
  const defaultOverlap = 50;
73
73
  const limit = maxTokens ?? defaultMax;
74
74
  const overlapTokens = overlap ?? defaultOverlap;