Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit 664425b

Browse files
authored
Merge pull request #7 from aarora79/dheeraj-work
Intelligent Tool Calling
2 parents a1ccbf1 + e0ed17d commit 664425b

File tree

7 files changed

+667
-127
lines changed

7 files changed

+667
-127
lines changed

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ WORKDIR /app
2626
# Copy the entire project context into the container
2727
COPY . /app/
2828

29-
# Install Python dependencies for the MCP Registry using uv
30-
# The server dependencies will be installed by start_all_servers.sh at runtime
31-
RUN cd /app && uv pip install --system --requirement pyproject.toml
29+
# Create the shared virtual environment that start_all_servers.sh will use
30+
RUN uv venv /app/.venv --python 3.12
31+
32+
# Install Python dependencies from pyproject.toml INTO the shared venv
33+
RUN . /app/.venv/bin/activate && uv pip install --no-cache-dir /app
3234

3335
# Generate self-signed SSL certificate for Nginx
3436
# Create directories for SSL certs

docs/medium.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,4 +265,3 @@ Ready to move beyond the chaos of scattered MCP servers and embrace a more organ
265265
* **Connect:** Join our community of AI practitioners who are building the future of AI tool integration.
266266

267267
Stop wrestling with complexity and start leveraging the power of a unified MCP landscape with the MCP Gateway & Registry. Your AI infrastructure deserves this level of organization and control.
268-

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,16 @@ dependencies = [
99
"itsdangerous>=2.2.0",
1010
"jinja2>=3.1.6",
1111
"mcp>=1.6.0",
12+
"pydantic>=2.11.3",
13+
"httpx>=0.27.0",
1214
"python-dotenv>=1.1.0",
1315
"python-multipart>=0.0.20",
1416
"uvicorn[standard]>=0.34.2",
17+
"faiss-cpu>=1.7.4",
18+
"sentence-transformers>=2.2.2",
19+
"websockets>=15.0.1",
20+
"scikit-learn>=1.3.0",
21+
"torch>=1.6.0"
1522
]
1623

1724
[tool.setuptools]

registry/main.py

Lines changed: 231 additions & 1 deletion
Large diffs are not rendered by default.

servers/mcpgw/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ dependencies = [
1010
"httpx>=0.27.0", # Added httpx
1111
"python-dotenv>=1.0.0", # Added dotenv as it's used in server.py
1212
"websockets>=15.0.1",
13+
"faiss-cpu>=1.7.4",
14+
"sentence-transformers>=2.2.2", # For semantic search
15+
"scikit-learn>=1.3.0" # For cosine similarity
1316
]

servers/mcpgw/server.py

Lines changed: 403 additions & 106 deletions
Large diffs are not rendered by default.

start_all_servers.sh

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ if [ ! -d "$LOGS_DIR" ]; then
2020
mkdir -p "$LOGS_DIR"
2121
fi
2222

23+
# The virtual environment is now created and populated by the Dockerfile.
24+
# We just need to ensure SCRIPT_DIR points to /app if this script is not run from /app
25+
# Assuming SCRIPT_DIR will be /app based on WORKDIR and entrypoint execution context
26+
27+
# Activate the pre-built virtual environment
28+
echo "Activating the pre-built virtual environment at $SCRIPT_DIR/.venv..."
29+
source "$SCRIPT_DIR/.venv/bin/activate"
30+
31+
# Dependency installation is now handled by the Dockerfile.
32+
2333
# Find all subdirectories in the servers directory
2434
subdirs=$(find "$SERVERS_DIR" -mindepth 1 -maxdepth 1 -type d | sort)
2535

@@ -39,23 +49,11 @@ for subdir in $subdirs; do
3949
# Move into the subdirectory
4050
cd "$subdir" || continue
4151

42-
echo "Setting up Python environment..."
43-
# Create a Python virtual environment using uv
44-
uv venv --python 3.12
45-
46-
# Activate the virtual environment
47-
source .venv/bin/activate
48-
49-
echo "Installing requirements in $(pwd)..."
50-
# Install requirements from pyproject.toml
51-
if [ -f "pyproject.toml" ]; then
52-
uv pip install --requirement pyproject.toml >> "$log_file" 2>&1
53-
else
54-
echo "Warning: pyproject.toml not found in $subdir" | tee -a "$log_file"
55-
fi
52+
# Python environment setup is now global, so no local venv creation/activation needed here
5653

5754
echo "Starting server on port $port (logs in $log_file)..."
5855
# Start the server in the background with the current port and redirect output to log file
56+
# uv run will use the globally activated venv
5957
uv run python server.py --port $port >> "$log_file" 2>&1 &
6058

6159
# Store the process ID for potential cleanup later
@@ -65,8 +63,7 @@ for subdir in $subdirs; do
6563
# Save PID to a file for easy management
6664
echo "$server_pid" > "$pid_file"
6765

68-
# Deactivate the virtual environment
69-
deactivate
66+
# No local deactivation needed
7067

7168
# Return to the original directory
7269
cd "$SCRIPT_DIR"
@@ -77,6 +74,11 @@ for subdir in $subdirs; do
7774
echo "-----------------------------------"
7875
done
7976

77+
# Deactivate the global virtual environment
78+
echo "Deactivating the global virtual environment."
79+
deactivate
80+
8081
echo "All servers have been started. Logs are available in the $LOGS_DIR directory."
82+
echo "The shared virtual environment at $SCRIPT_DIR/.venv was used."
8183
echo "To stop all servers, use: kill \$(cat $LOGS_DIR/*.pid)"
8284
echo "To view logs in real-time for a specific server, use: tail -f $LOGS_DIR/server_name_port.log"

0 commit comments

Comments
 (0)