You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,6 +15,24 @@ This document describe how to re-use the configuration tested in the **AI Optimi
15
15
16
16
**NOTICE**: Only `Ollama` or `OpenAI` configurations are currently supported. Full support will come.
17
17
18
+
## Export config
19
+
In the **AI Optimizer & Toolkit** web interface, after have tested a configuration, in `Settings/Client Settings`:
20
+
21
+

22
+
23
+
and **ONLY** if have been selected `Ollama` or `OpenAI` providers for **both** chat and embeddings models:
24
+
25
+
* select the checkbox `Include Sensitive Settings`
26
+
* press button `Download LangchainMCP` to download a zip file containing a full project template to run current selected AI Optimizer configuration.
27
+
* unzip the file in a <PROJECT_DIR> dir.
28
+
29
+
To run it, follow the next steps.
30
+
31
+
**NOTICE**:
32
+
* if you want to run the application in another server, remember to change in the optimizer_settings.json any reference no more local, like hostname for LLM servers, Database, wallet dir and so on.
33
+
* if you don't see the `Download LangchainMCP` check again if you have selected Ollama or OpenAI for both chat and the vectorstore embedding model.
34
+
35
+
18
36
## Pre-requisites.
19
37
You need:
20
38
- Node.js: v20.17.0+
@@ -23,7 +41,7 @@ You need:
23
41
- Claude Desktop free
24
42
25
43
## Setup
26
-
With **[`uv`](https://docs.astral.sh/uv/getting-started/installation/)** installed, run the following commands in your current project directory `<PROJECT_DIR>/src/client/mcp/rag/`:
44
+
With **[`uv`](https://docs.astral.sh/uv/getting-started/installation/)** installed, run the following commands in your current project directory `<PROJECT_DIR>`:
In the **AI Optimizer & Toolkit** web interface, after tested a configuration, in `Settings/Client Settings`:
37
-
38
-

39
-
40
-
* select the checkbox `Include Sensitive Settings`
41
-
* press button `Download Settings` to download configuration in the project directory: `src/client/mcp/rag` as `optimizer_settings.json`.
42
-
* in `<PROJECT_DIR>/src/client/mcp/rag/rag_base_optimizer_config_mcp.py` change filepath with the absolute path of your `optimizer_settings.json` file.
43
-
44
-
45
53
## Standalone client
46
-
There is a client that you can run without MCP via commandline to test it:
47
-
48
-
```bash
49
-
uv run rag_base_optimizer_config.py
50
-
```
51
54
52
-
## Quick test via MCP "inspector"
53
-
54
-
* Run the inspector:
55
+
There is a client that let you run the service via command-line, to test it without an MCP client, in your `<PROJECT_DIR>`:
55
56
56
57
```bash
57
-
npx @modelcontextprotocol/inspector uv run rag_base_optimizer_config_mcp.py
58
-
```
59
-
60
-
* connect to the port `http://localhost:6274/` with your browser
61
-
* setup the `Inspector Proxy Address` with `http://127.0.0.1:6277`
62
-
* test the tool developed.
63
-
64
-
65
-
## Claude Desktop setup
66
-
67
-
* In **Claude Desktop** application, in `Settings/Developer/Edit Config`, get the `claude_desktop_config.json` to add the references to the local MCP server for RAG in the `<PROJECT_DIR>/src/client/mcp/rag/`:
68
-
```json
69
-
{
70
-
"mcpServers": {
71
-
...
72
-
,
73
-
"rag":{
74
-
"command":"bash",
75
-
"args":[
76
-
"-c",
77
-
"source <PROJECT_DIR>/src/client/mcp/rag/.venv/bin/activate && uv run <PROJECT_DIR>/src/client/mcp/rag/rag_base_optimizer_config_mcp.py"
78
-
]
79
-
}
80
-
}
81
-
}
58
+
uv run rag_base_optimizer_config_direct.py "[YOUR_QUESTION]"
82
59
```
83
-
* In **Claude Desktop** application, in `Settings/General/Claude Settings/Configure`, under `Profile` tab, update fields like:
84
-
-`Full Name`
85
-
-`What should we call you`
86
-
87
-
and so on, putting in `What personal preferences should Claude consider in responses?`
88
-
the following text:
89
-
90
-
```
91
-
#INSTRUCTION:
92
-
Always call the rag_tool tool when the user asks a factual or information-seeking question, even if you think you know the answer.
93
-
Show the rag_tool message as-is, without modification.
94
-
```
95
-
This will impose the usage of `rag_tool` in any case.
96
-
97
-
**NOTICE**: If you prefer, in this agent dashboard or any other, you could setup a message in the conversation with the same content of `Instruction` to enforce the LLM to use the rag tool as well.
98
-
99
-
* Restart **Claude Desktop**.
100
60
101
-
* You will see two warnings on rag_tool configuration: they will disappear and will not cause any issue in activating the tool.
102
-
103
-
* Start a conversation. You should see a pop up that ask to allow the `rag` tool usage to answer the questions:
104
-
105
-

106
-
107
-
If the question is related to the knowledge base content stored in the vector store, you will have an answer based on that information. Otherwise, it will try to answer considering information on which has been trained the LLM o other tools configured in the same Claude Desktop.
108
-
109
-
110
-
## Make a remote MCP server the RAG Tool
61
+
## Run the RAG Tool by a remote MCP server
111
62
112
63
In `rag_base_optimizer_config_mcp.py`:
113
64
114
-
*Update the absolute path of your `optimizer_settings.json`. Example:
65
+
*Check if configuration is like this for the clients (`Remote client`) in the following lines, otherwise change as shown:
* test the tool developed, setting `URL` to `http://localhost:9090/mcp`.
154
103
155
104
105
+
## Claude Desktop setup
156
106
157
-
## Claude Desktop setup for remote/local server
158
107
Claude Desktop, in free version, not allows to connect remote server. You can overcome, for testing purpose only, with a proxy library called `mcp-remote`. These are the options.
159
-
If you have already installed Node.js v20.17.0+, it should work:
160
-
161
-
* replace `rag` mcpServer, setting in `claude_desktop_config.json`:
162
-
```json
163
-
{
164
-
"mcpServers": {
165
-
"remote": {
108
+
If you have already installed Node.js v20.17.0+, it should work.
109
+
110
+
* In **Claude Desktop** application, in `Settings/Developer/Edit Config`, get the `claude_desktop_config.json` to add the reference to the local MCP server for RAG in `streamable-http`:
111
+
```json
112
+
{
113
+
"mcpServers": {
114
+
...
115
+
,
116
+
"rag":{
166
117
"command": "npx",
167
118
"args": [
168
119
"mcp-remote",
169
-
"http://127.0.0.1:8001/sse"
170
-
]
171
-
}
172
-
}
173
-
}
174
-
```
175
-
* restart Claude Desktop.
120
+
"http://127.0.0.1:9090/mcp"
121
+
]
122
+
}
123
+
}
124
+
}
125
+
```
126
+
127
+
128
+
* In **Claude Desktop** application, in `Settings/General/Claude Settings/Configure`, under `Profile` tab, update fields like:
129
+
130
+
- `Full Name`
131
+
- `What should we call you`
132
+
133
+
and so on, putting in `What personal preferences should Claude consider in responses?`
134
+
the following text:
135
+
136
+
```
137
+
#INSTRUCTION:
138
+
Always call the rag_tool tool when the user asks a factual or information-seeking question, even if you think you know the answer.
139
+
Show the rag_tool message as-is, without modification.
140
+
```
141
+
This will impose the usage of `rag_tool` in any case.
142
+
143
+
* Restart **Claude Desktop**.
144
+
145
+
* You will see two warnings on rag_tool configuration: they will disappear and will not cause any issue in activating the tool.
146
+
147
+
* Start a conversation. You should see a pop up that ask to allow the `rag` tool usage to answer the questions:
148
+
149
+

150
+
151
+
If the question is related to the knowledge base content stored in the vector store, you will have an answer based on that information. Otherwise, it will try to answer considering information on which has been trained the LLM o other tools configured in the same Claude Desktop.
176
152
177
153
**NOTICE**: If you have any problem running, check the logs if it's related to an old npx/nodejs version used with mcp-remote library. Check with:
0 commit comments