Skip to content

Commit 9413a9b

Browse files
committed
fixes
1 parent 3240b06 commit 9413a9b

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

src/client/mcp/rag/README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22
# MCP Server for a tested AI Optimizer & Toolkit configuration
33

44
## Introduction
5-
This document describe how to re-use the configuration tested in the **AI Optimizer & Toolkit** an expose it as an MCP tool to a local **Claude Desktop**. It will be provided further info to setup as a remote MCP server. This early draft implementation utilizes the `stdio` to interact between the agent dashboard, represented by the **Claude Desktop**, and the tool.
5+
This document describe how to re-use the configuration tested in the **AI Optimizer & Toolkit** an expose it as an MCP tool to a local **Claude Desktop** and how to setup as a remote MCP server. This early draft implementation utilizes the `stdio` and `sse` to interact between the agent dashboard, represented by the **Claude Desktop**, and the tool. Not always the parameters are exported at the moment, and only Ollama or OpenAI configuration are supported.
6+
Full support will come.
7+
8+
## Pre-requisites.
9+
You need:
10+
- Node.js: v20.17.0+
11+
- npx/npm: v11.2.0+
12+
- uv: v0.7.10+
13+
- Claude Desktop free
614

715
## Setup
816
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/`:
@@ -21,8 +29,17 @@ In the **AI Optimizer & Toolkit** web interface, after tested a configuration, i
2129

2230
* select the checkbox `Include Sensitive Settings`
2331
* press button `Download Settings` to download configuration in the project directory: `src/client/mcp/rag` as `optimizer_settings.json`.
32+
* 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.
2433

25-
## Quick test
34+
35+
## Standalone client
36+
There is a client that you can run without MCP via commandline to test it:
37+
38+
```bash
39+
uv run rag_base_optimizer_config.py
40+
```
41+
42+
## Quick test via MCP "inspector"
2643

2744
* Run the inspector:
2845

@@ -175,4 +192,4 @@ chmod +x claude-remote-wrapper.sh
175192

176193
* restart and test as remote server
177194

178-
{{% children %}}
195+

src/client/mcp/rag/rag_base_optimizer_config.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Copyright (c) 2024, 2025, Oracle and/or its affiliates.
3+
Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
4+
"""
15
from typing import List
26
#from mcp.server.fastmcp import FastMCP
37
import os
@@ -205,11 +209,11 @@ def get_conf(data):
205209
# Initialize and run the server
206210
# Load JSON file
207211
file_path = os.path.join(os.getcwd(), "optimizer_settings.json")
208-
#file="/Users/cdebari/Documents/GitHub/mcp/rag/optimizer_settings_openai.json"
209212
print(file_path)
210213
with open(file_path, "r") as file:
211214
data = json.load(file)
212215
print(get_embeddings(data))
216+
#Set your question to check if configuration is working
213217
question="Which kind of IDE should be used in this demo?"
214218
print(f"Question: {question}")
215219
print(f"Answer: {rag_tool(question)}")

src/client/mcp/rag/rag_base_optimizer_config_mcp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Copyright (c) 2024, 2025, Oracle and/or its affiliates.
3+
Licensed under the Universal Permissive License v1.0 as shown at http://oss.oracle.com/licenses/upl.
4+
"""
15
from typing import List
26
from mcp.server.fastmcp import FastMCP
37
import os
@@ -177,7 +181,7 @@ def get_vectorstore(data,embeddings):
177181

178182

179183
# Initialize and run the server
180-
# Load JSON file
184+
# Load JSON file: set your absolute path
181185
file_path = "/Users/cdebari/Documents/GitHub/ai-optimizer-mcp-export/src/client/mcp/rag/optimizer_settings.json"
182186
with open(file_path, "r") as file:
183187
#rag_tool.__doc__=rag_tool_desc[0]

0 commit comments

Comments
 (0)