Skip to content

Commit 15634f4

Browse files
authored
Fix #12: Update Prerequisites and Installation Instructions in README.md (#25)
- Updated Prerequisites section with clearer SSL certificate options - Added detailed security group configuration for different deployment scenarios - Replaced manual Docker commands with build_and_run.sh script usage - Added Docker Compose architecture explanation with separate containers - Updated environment configuration steps using .env.template - Enhanced authentication section with Cognito vs username/password options - Updated HTTPS configuration for production deployments - Made instructions more accessible for entry-level developers Addresses all tasks in issue #12: ✅ Prerequisites section explains SSL options and security group requirements ✅ Installation steps use build_and_run.sh instead of manual Docker commands ✅ Environment configuration is clearly explained ✅ Instructions are accessible to entry-level developers
1 parent b12fde1 commit 15634f4

File tree

1 file changed

+112
-91
lines changed

1 file changed

+112
-91
lines changed

README.md

Lines changed: 112 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -183,135 +183,156 @@ flowchart TB
183183

184184
## Prerequisites
185185

186-
* An Amazon EC2 machine (`ml.t3.2xlarge`) with a standard Ubuntu AMI for running this solution.
187-
* An SSL cert for securing the communication to the Gateway. _This Gateway uses a self-signed cert by default and is also available over HTTP_.
188-
* One of the example MCP servers packaged in this repo uses the [`Polygon`](https://polygon.io/stocks) API for stock ticker data. Get an API key from [here](https://polygon.io/dashboard/signup?redirect=%2Fdashboard%2Fkeys). The server will still start without the API key but you will get a 401 Unauthorized error when using the tools provided by this server.
189-
* Setup authentication using Amazon Cognito as per instructions [here](docs/auth.md).
186+
* **Amazon EC2 Instance:** An Amazon EC2 machine (`ml.t3.2xlarge`) with a standard Ubuntu AMI for running this solution.
190187

191-
## Installation
188+
* **SSL Certificate Options:**
189+
- **Production Deployments:** SSL certificate is preferred for secure communication to the Gateway
190+
- **Testing/Development:** Can use localhost when running on EC2, or EC2 domain name for testing
191+
- **Default Configuration:** Gateway is available over HTTP for development
192192

193-
### Installation on EC2
193+
* **Security Group Configuration:** Configure your EC2 security group based on your deployment scenario:
194+
- **HTTPS with SSL certificate:** Only port **443** needs to be opened
195+
- **HTTP with EC2 domain name:** Only port **80** needs to be opened
196+
- **HTTP with localhost (port forwarding):** Ports **80**, **7860**, and **8888** need to be opened
194197

195-
The Gateway and the Registry are available as a Docker container. The package includes a couple of test MCP servers as well.
198+
* **External API Keys (Optional):** One of the example MCP servers uses the [`Polygon`](https://polygon.io/stocks) API for stock ticker data. Get an API key from [here](https://polygon.io/dashboard/signup?redirect=%2Fdashboard%2Fkeys). The server will still start without the API key but you will get a 401 Unauthorized error when using the tools provided by this server.
196199

197-
1. **Clone the repository:**
198-
```bash
199-
git clone https://github.com/agentic-community/mcp-gateway-registry.git
200-
cd mcp-gateway
201-
```
200+
* **Authentication Setup:** Setup authentication using Amazon Cognito as per instructions [here](docs/auth.md).
202201

203-
1. **Create local directories for saving MCP server logs and run-time data:**
204-
```bash
205-
sudo mkdir -p /opt/mcp-gateway/servers
206-
sudo cp -r registry/servers /opt/mcp-gateway/
207-
sudo mkdir /var/log/mcp-gateway
208-
```
202+
## Installation
209203

210-
1. **Build the Docker container to run the Gateway and Registry:**
204+
### Installation on EC2
211205

212-
```bash
213-
docker build -t mcp-gateway .
206+
The Gateway and Registry are deployed using Docker Compose with separate containers for each service, providing a scalable and maintainable architecture.
214207

215-
```
208+
#### Docker Compose Architecture
216209

217-
1. **Run the container:**
210+
The deployment includes these containers:
211+
- **Nginx Reverse Proxy**: Routes requests to appropriate services and handles SSL termination
212+
- **Auth Server**: Handles authentication with Amazon Cognito and GitHub OAuth
213+
- **Registry MCP Server**: Provides service discovery, management, and the web UI
214+
- **Example MCP Servers**:
215+
- Current Time server (port 8000)
216+
- Financial Info server (port 8001)
217+
- Real Server Fake Tools server (port 8002)
218+
- MCP Gateway server (port 8003)
218219

219-
```bash
220-
# environment variables
221-
export ADMIN_USER=admin
222-
export ADMIN_PASSWORD=your-admin-password
223-
export POLYGON_API_KEY=your-polygon-api-key
224-
# stop any previous instance
225-
docker stop mcp-gateway-container && docker rm mcp-gateway-container
226-
docker run -p 80:80 -p 443:443 -p 7860:7860 -p 8888:8888 \
227-
-e ADMIN_USER=$ADMIN_USER \
228-
-e ADMIN_PASSWORD=$ADMIN_PASSWORD \
229-
-e POLYGON_API_KEY=$POLYGON_API_KEY \
230-
-e SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))') \
231-
-v /var/log/mcp-gateway:/app/logs \
232-
-v /opt/mcp-gateway/servers:/app/registry/servers \
233-
--name mcp-gateway-container mcp-gateway
234-
```
235-
236-
You should see some of the following traces show up on the screen (the following is an excerpt, some traces have been omitted for clarity).
220+
#### Quick Start Installation
237221

222+
1. **Clone the repository:**
238223
```bash
239-
Nginx config regeneration successful.
240-
Starting background health check task...
241-
Running periodic health checks (Interval: 300s)...
242-
Performing periodic check for enabled service: /fininfo
243-
Setting status to 'checking' for /fininfo (http://localhost:8002/)...
244-
INFO: Application startup complete.
245-
INFO: Uvicorn running on http://0.0.0.0:7860 (Press CTRL+C to quit)
246-
INFO: 127.0.0.1:40132 - "HEAD /sse HTTP/1.1" 200 OK
247-
Health check successful for /fininfo (http://localhost:8002/).
248-
Final health status for /fininfo: healthy
249-
Performing periodic check for enabled service: /currenttime
250-
Setting status to 'checking' for /currenttime (http://0.0.0.0:8001/)...
251-
INFO: 127.0.0.1:54256 - "HEAD /sse HTTP/1.1" 200 OK
252-
Health check successful for /currenttime (http://0.0.0.0:8001/).
253-
Final health status for /currenttime: healthy
254-
Finished periodic health checks. Current status map: {'/fininfo': 'healthy', '/currenttime': 'healthy'}
255-
No status changes detected in periodic check, skipping broadcast.
256-
Starting Nginx in the background...
257-
Nginx started. Keeping container alive...
224+
git clone https://github.com/agentic-community/mcp-gateway-registry.git
225+
cd mcp-gateway-registry
258226
```
259227

260-
1. **Navigate to [`http://localhost:7860`](http://localhost:7860) access the Registry**
261-
262-
![MCP Registry](docs/img/registry.png)
263-
264-
1. **View logs from the Registry and the built-in MCP servers:**
265-
Logs are available on the local machine in the `/var/log/mcp-gateway` directory.
228+
2. **Configure environment variables:**
229+
```bash
230+
# Copy the template and edit with your values
231+
cp .env.template .env
232+
nano .env # or use your preferred editor
266233
```
267-
tail -f /var/log/mcp-gateway/*
234+
235+
**Required configuration in `.env`:**
236+
- `ADMIN_PASSWORD`: Set to a secure password (replace "your-secure-password-here")
237+
- `COGNITO_USER_POOL_ID`: Your AWS Cognito User Pool ID
238+
- `COGNITO_CLIENT_ID`: Your Cognito App Client ID
239+
- `COGNITO_CLIENT_SECRET`: Your Cognito App Client Secret
240+
- `AWS_REGION`: AWS region where your Cognito User Pool is located
241+
242+
**Optional configuration:**
243+
- `POLYGON_API_KEY`: For financial data tools (get from [Polygon.io](https://polygon.io/dashboard/signup))
244+
- `SECRET_KEY`: Auto-generated by build script if not provided
245+
246+
3. **Deploy with the build and run script:**
247+
```bash
248+
./build_and_run.sh
249+
```
250+
251+
The script will:
252+
- Validate your `.env` configuration
253+
- Generate `SECRET_KEY` if not provided
254+
- Build all Docker images using Docker Compose
255+
- Start all services in the correct order
256+
- Verify service health and display status
257+
258+
4. **Access the Registry:**
259+
Navigate to `http://localhost:7860` and you will have two authentication options:
260+
261+
**Option 1 - Amazon Cognito (Recommended for Production):**
262+
- Click "Login with Cognito" to authenticate via your configured Cognito User Pool
263+
- Access permissions will be based on the Cognito group you are a member of
264+
- Provides fine-grained access control based on your organizational roles
265+
266+
**Option 2 - Username/Password (Testing Only):**
267+
- Use the traditional login with:
268+
- **Username:** Value of `ADMIN_USER` (default: admin)
269+
- **Password:** Value of `ADMIN_PASSWORD` from your `.env` file
270+
- Provides admin access by default
271+
- **Note:** This approach should only be used for testing and will soon require setting `ENABLE_DEV_MODE=true` in your `.env` file
272+
273+
![MCP Registry](docs/img/registry.png)
274+
275+
#### Post-Installation
276+
277+
1. **View logs from all services:**
278+
```bash
279+
# View logs from all services
280+
docker-compose logs -f
281+
282+
# View logs from a specific service
283+
docker-compose logs -f registry
284+
docker-compose logs -f auth-server
268285
```
269286

270-
1. **View MCP server metadata:**
271-
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.
287+
2. **View MCP server metadata:**
288+
Metadata about all MCP servers is available in `/opt/mcp-gateway/servers` directory. The metadata includes information gathered from `ListTools` as well as information provided during server registration.
272289

273-
1. **Test the Gateway and Registry with the sample Agent and test suite:**
274-
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.
290+
3. **Test the Gateway and Registry:**
291+
The repo includes a test agent that can connect to the Registry to discover tools and invoke them:
275292

276-
```{.python}
293+
```bash
277294
python agents/agent.py --mcp-registry-url http://localhost/mcpgw/sse --message "what is the current time in clarksburg, md"
278295
279296
# With Strands agent
280297
# python agents/strands_agent.py --mcp-registry-url http://localhost/mcpgw/sse --message "what is the current time in clarksburg, md"
281298
```
282299

283-
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.
300+
You can also run the full test suite:
284301

285-
```{.python}
302+
```bash
286303
python agents/test_suite.py --mcp-registry-url http://localhost/mcpgw/sse
287304
# With Strands agent
288305
# python agents/test_suite.py --mcp-registry-url http://localhost/mcpgw/sse --use-strands
289306
```
290307

291-
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.
308+
Test results are available in the `agents/test_results` folder with accuracy metrics and detailed logs.
292309

293310
#### Running the Gateway over HTTPS
294311

295-
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.
312+
For production deployments with SSL certificates:
296313

297-
1. You would need to have an HTTPS certificate and private key to proceed. Let's say you use `your-mcp-gateway.com` as the domain for your MCP server then you will need an SSL cert for `your-mcp-gateway.com` and MCP servers behind the Gateway will be accessible to MCP clients as `https://your-mcp-gateway.com/mcp-server-name/sse`.
314+
1. **Configure Security Group:** Enable access to TCP port 443 from the IP addresses of your MCP clients in the inbound rules of your EC2 instance's security group.
298315
299-
1. Rebuild the container using the same command line as before.
316+
2. **Prepare SSL Certificates:** You need an HTTPS certificate and private key for your domain. For example, if you use `your-mcp-gateway.com` as the domain, you'll need an SSL certificate for `your-mcp-gateway.com`. MCP servers behind the Gateway will be accessible as `https://your-mcp-gateway.com/mcp-server-name/sse`.
300317

301-
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.
318+
3. **Place SSL Certificates:** Copy your SSL certificates to `/home/ubuntu/ssl_data/` on your EC2 instance:
319+
```bash
320+
sudo mkdir -p /home/ubuntu/ssl_data/certs
321+
sudo mkdir -p /home/ubuntu/ssl_data/private
322+
# Copy your certificate and private key files to these directories
323+
```
302324

303-
```bash
304-
docker run -p 80:80 -p 443:443 -p 7860:7860 -p 8888:8888 \
305-
-e ADMIN_USER=$ADMIN_USER \
306-
-e ADMIN_PASSWORD=$ADMIN_PASSWORD \
307-
-e POLYGON_API_KEY=$POLYGON_API_KEY \
308-
-e SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(32))') \
309-
-v /path/to/certs:/etc/ssl/certs \
310-
-v /path/to/private:/etc/ssl/private \
311-
-v /var/log/mcp-gateway:/app/logs \
312-
-v /opt/mcp-gateway/servers:/app/registry/servers \
313-
--name mcp-gateway-container mcp-gateway
314-
```
325+
4. **Deploy with HTTPS:** Run the deployment script as normal:
326+
```bash
327+
./build_and_run.sh
328+
```
329+
330+
The Docker Compose configuration automatically mounts the SSL certificates from `/home/ubuntu/ssl_data` to the appropriate container paths.
331+
332+
5. **Access via HTTPS:** Your services will be available at:
333+
- Main interface: `https://your-domain.com`
334+
- Registry API: `https://your-domain.com:7860` (if port 7860 is opened in security group)
335+
- MCP servers: `https://your-domain.com/server-name/sse`
315336

316337
### Installation on EKS
317338

0 commit comments

Comments
 (0)