Skip to content

Commit 1198a5c

Browse files
committed
simplify dockerfile, add agents test suite, nginx can now take a hostname, other cleanup
1 parent 7535044 commit 1198a5c

File tree

7 files changed

+512
-77
lines changed

7 files changed

+512
-77
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,4 @@ cookies.txt
182182
registry/server_state.json
183183
registry/nginx_mcp_revproxy.conf
184184
logs/
185+
agents/test_results/

Dockerfile

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,37 +21,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
2121
# Set the working directory in the container
2222
WORKDIR /app
2323

24-
# Copy dependency files first to leverage Docker cache
25-
COPY pyproject.toml uv.lock /app/
26-
27-
# Create the shared virtual environment that start_all_servers.sh will use
28-
RUN pip install uv
29-
RUN uv venv /app/.venv --python 3.12
30-
31-
# Install dependencies directly from pyproject.toml
32-
# This installs all dependencies without requiring the actual package code
33-
RUN . /app/.venv/bin/activate && uv pip install \
34-
"fastapi>=0.115.12" \
35-
"itsdangerous>=2.2.0" \
36-
"jinja2>=3.1.6" \
37-
"mcp>=1.6.0" \
38-
"pydantic>=2.11.3" \
39-
"httpx>=0.27.0" \
40-
"python-dotenv>=1.1.0" \
41-
"python-multipart>=0.0.20" \
42-
"uvicorn[standard]>=0.34.2" \
43-
"faiss-cpu>=1.7.4" \
44-
"sentence-transformers>=2.2.2" \
45-
"websockets>=15.0.1" \
46-
"scikit-learn>=1.3.0" \
47-
"torch>=1.6.0" \
48-
"huggingface-hub[cli]>=0.31.1" \
49-
"pyjwt[crypto]>=2.8.0" \
50-
"pycognito>=2024.3.1" \
51-
"boto3>=1.28.0" \
52-
"requests>=2.32.3"
53-
54-
# Copy the rest of the application
24+
# Copy the application code
5525
COPY . /app/
5626

5727
# Copy the custom Nginx configuration (will be moved by entrypoint)

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,12 +182,14 @@ The Gateway and the Registry are available as a Docker container. The package in
182182
export ADMIN_USER=admin
183183
export ADMIN_PASSWORD=your-admin-password
184184
export POLYGON_API_KEY=your-polygon-api-key
185+
export GATEWAY_HOSTNAME=your-ec2-hostname
185186
# stop any previous instance
186187
docker stop mcp-gateway-container && docker rm mcp-gateway-container
187188
docker run -p 80:80 -p 443:443 -p 7860:7860 \
188189
-e ADMIN_USER=$ADMIN_USER \
189190
-e ADMIN_PASSWORD=$ADMIN_PASSWORD \
190191
-e POLYGON_API_KEY=$POLYGON_API_KEY \
192+
-e GATEWAY_HOSTNAME=$GATEWAY_HOSTNAME \
191193
-e SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))') \
192194
-v /var/log/mcp-gateway:/app/logs \
193195
-v /opt/mcp-gateway/servers:/app/registry/servers \
@@ -231,6 +233,19 @@ The Gateway and the Registry are available as a Docker container. The package in
231233
1. **View MCP server metadata:**
232234
Metadata about all MCP servers connected to the Registry is available in `/opt/mcp-gateway/servers` directory. The metadata includes information gathered from `ListTools` as well as information provided while registering the server.
233235
236+
```{.python}
237+
python agents\agent.py --mcp-registry-url http://localhost/mcpgw/sse --message "what is the current time in clarksburg, md"
238+
```
239+
240+
You can also run the full test suite and get a handy agent evaluation report. This test suite exercises the Registry functionality as well as tests the multiple built-in MCP servers provided by the Gateway.
241+
```{python}
242+
python agents\test_suite.py
243+
```
244+
The result of the tests suites are available in the `agents/test_results` folder. It contains an `accuracy.json`, a `summary.json`, a `logs` folder and a `raw_data` folder that contains the verbose output from the agent. The test suite uses an LLM as a judge to evaluate the results for accuracy and tool usage quality.
245+
246+
1. **Test the Gateway and Registry with the sample Agent and test suite**
247+
The repo includes a test agent that can connect to the Registry to discover tools and invoke them to do interesting tasks. This functionality can be invoked either standalone or as part of a test suite.
248+
234249
#### Running the Gateway over HTTPS
235250

236251
1. Enable access to TCP port 443 from the IP address of your MCP client (your laptop, or anywhere) in the inbound rules in the security group associated with your EC2 instance.
@@ -246,6 +261,7 @@ The Gateway and the Registry are available as a Docker container. The package in
246261
-e ADMIN_USER=$ADMIN_USER \
247262
-e ADMIN_PASSWORD=$ADMIN_PASSWORD \
248263
-e POLYGON_API_KEY=$POLYGON_API_KEY \
264+
-e GATEWAY_HOSTNAME=$GATEWAY_HOSTNAME \
249265
-e SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))') \
250266
-v /path/to/certs:/etc/ssl/certs \
251267
-v /path/to/private:/etc/ssl/private \

agents/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ async def invoke_mcp_tool(mcp_registry_url: str, server_name: str, tool_name: st
172172
173173
How to use intelligent_tool_finder:
174174
1. When you identify that a task requires a specialized tool (e.g., image generation, specialized API access, etc.)
175-
2. Call the tool with a description of what you need: `intelligent_tool_finder("description of needed capability")`, Use admin/password for authentication.
175+
2. Call the tool with a description of what you need: `intelligent_tool_finder("description of needed capability")`
176176
3. The tool will return the most appropriate specialized tool along with usage instructions
177177
4. You can then use the invoke_mcp_tool to invoke this discovered tool by providing the MCP Registry URL, server name, tool name, and required arguments
178178

0 commit comments

Comments
 (0)