Skip to content

Commit 280961c

Browse files
authored
Merge pull request #2 from agentic-community/feature-agent-m2m-auth
Feature agent m2m auth
2 parents 40d35dc + 7aa7ee1 commit 280961c

26 files changed

+4489
-19
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ celerybeat.pid
132132

133133
# Environments
134134
.env
135+
.env.user
136+
.env.agent
135137
.env.docker
136138
.venv
137139
env/

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ FROM python:3.12-slim
55
ENV PYTHONUNBUFFERED=1 \
66
DEBIAN_FRONTEND=noninteractive
77

8-
# Install minimal system dependencies needed for the container to function
9-
# All Python-related setup moved to entrypoint.sh for a more lightweight image
8+
# Install system dependencies including nginx with lua module
109
RUN apt-get update && apt-get install -y --no-install-recommends \
1110
nginx \
11+
nginx-extras \
12+
lua-cjson \
1213
curl \
1314
procps \
1415
openssl \
@@ -28,7 +29,6 @@ COPY . /app/
2829
# Note: We copy it here so it's part of the image layer
2930
COPY docker/nginx_rev_proxy.conf /app/docker/nginx_rev_proxy.conf
3031

31-
3232
# Make the entrypoint script executable
3333
COPY docker/entrypoint.sh /app/docker/entrypoint.sh
3434
RUN chmod +x /app/docker/entrypoint.sh
@@ -48,5 +48,9 @@ ENV ADMIN_USER=$ADMIN_USER
4848
ENV ADMIN_PASSWORD=$ADMIN_PASSWORD
4949
ENV POLYGON_API_KEY=$POLYGON_API_KEY
5050

51+
# Add health check using the new HTTP endpoint
52+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
53+
CMD curl -f http://localhost:7860/health || exit 1
54+
5155
# Run the entrypoint script when the container launches
5256
ENTRYPOINT ["/app/docker/entrypoint.sh"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ The Gateway and the Registry are available as a Docker container. The package in
184184
export POLYGON_API_KEY=your-polygon-api-key
185185
# stop any previous instance
186186
docker stop mcp-gateway-container && docker rm mcp-gateway-container
187-
docker run -p 80:80 -p 443:443 -p 7860:7860 \
187+
docker run -p 80:80 -p 443:443 -p 7860:7860 -p 8888:8888 \
188188
-e ADMIN_USER=$ADMIN_USER \
189189
-e ADMIN_PASSWORD=$ADMIN_PASSWORD \
190190
-e POLYGON_API_KEY=$POLYGON_API_KEY \
@@ -262,7 +262,7 @@ The Gateway and the Registry are available as a Docker container. The package in
262262
1. Run the container with the `-v` switch to map the local folder containing the cert and the private key to the container. Replace `/path/to/certs/` and `/path/private` as appropriate in the command provided below.
263263

264264
```bash
265-
docker run -p 80:80 -p 443:443 -p 7860:7860 \
265+
docker run -p 80:80 -p 443:443 -p 7860:7860 -p 8888:8888 \
266266
-e ADMIN_USER=$ADMIN_USER \
267267
-e ADMIN_PASSWORD=$ADMIN_PASSWORD \
268268
-e POLYGON_API_KEY=$POLYGON_API_KEY \

agents/.env.template

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Cognito Authentication Configuration
2+
# Copy this file to .env and fill in your actual values
3+
4+
# Cognito App Client ID
5+
COGNITO_CLIENT_ID=your_cognito_client_id_here
6+
7+
# Cognito App Client Secret
8+
COGNITO_CLIENT_SECRET=your_cognito_client_secret_here
9+
10+
# Cognito User Pool ID
11+
COGNITO_USER_POOL_ID=your_cognito_user_pool_id_here
12+
13+
# AWS Region for Cognito
14+
AWS_REGION=us-east-1
15+
16+
# Cognito Domain (without https:// prefix, just the domain name)
17+
# Example: mcp-gateway or your-custom-domain
18+
# COGNITO_DOMAIN=
19+
20+
# Secret key for session cookie signing (must match registry SECRET_KEY), string of hex characters
21+
# To generate: python -c 'import secrets; print(secrets.token_hex(32))'
22+
SECRET_KEY=your-secret-key-here

agents/agent.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,12 @@ def load_system_prompt():
153153
Returns:
154154
str: The system prompt template
155155
"""
156+
import os
156157
try:
157-
with open("agents/system_prompt.txt", "r") as f:
158+
# Get the directory where this Python file is located
159+
current_dir = os.path.dirname(__file__)
160+
system_prompt_path = os.path.join(current_dir, "system_prompt.txt")
161+
with open(system_prompt_path, "r") as f:
158162
return f.read()
159163
except Exception as e:
160164
print(f"Error loading system prompt: {e}")
@@ -297,7 +301,11 @@ async def main():
297301
system_prompt_template = load_system_prompt()
298302
system_prompt = system_prompt_template.format(
299303
current_utc_time=current_utc_time,
300-
mcp_registry_url=args.mcp_registry_url
304+
mcp_registry_url=args.mcp_registry_url,
305+
auth_token="",
306+
user_pool_id="",
307+
client_id="",
308+
region=""
301309
)
302310

303311
# Format the message with system message first

0 commit comments

Comments
 (0)