mirror of
https://github.com/Xe138/AI-Trader.git
synced 2026-04-01 17:17:24 -04:00
refactor: remove unnecessary MCP service port configuration
MCP services are completely internal to the container and accessed only via localhost. They should not be configurable or exposed. Changes: - Remove MATH_HTTP_PORT, SEARCH_HTTP_PORT, TRADE_HTTP_PORT, GETPRICE_HTTP_PORT from docker-compose.yml environment - Remove MCP service port mappings from docker-compose.yml - Remove MCP port configuration from .env.example - Update README.md to remove MCP port configuration - Update CLAUDE.md to clarify MCP services use fixed internal ports - Update CHANGELOG.md with these simplifications Technical details: - MCP services hardcode to ports 8000-8003 via os.getenv() defaults - Services only accessed via localhost URLs within container: - http://localhost:8000/mcp (math) - http://localhost:8001/mcp (search) - http://localhost:8002/mcp (trade) - http://localhost:8003/mcp (price) - No external access needed or desired for these services - Only API (8080) and web dashboard (8888) should be exposed Benefits: - Simpler configuration (4 fewer environment variables) - Reduced attack surface (4 fewer exposed ports) - Clearer architecture (internal vs external services) - Prevents accidental misconfiguration of internal services
This commit is contained in:
@@ -13,14 +13,6 @@ OPENAI_API_KEY=your_openai_key_here # https://platform.openai.com/api-keys
|
||||
ALPHAADVANTAGE_API_KEY=your_alphavantage_key_here # https://www.alphavantage.co/support/#api-key
|
||||
JINA_API_KEY=your_jina_key_here # https://jina.ai/
|
||||
|
||||
# MCP Service Host Ports (exposed on host machine)
|
||||
# Container always uses 8000-8003 internally
|
||||
# Change these if you need different ports on your host
|
||||
MATH_HTTP_PORT=8000
|
||||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
|
||||
# API Server Port (exposed on host machine for REST API)
|
||||
# Container ALWAYS uses port 8080 internally (hardcoded in entrypoint.sh)
|
||||
# This variable ONLY controls the host port mapping (host:API_PORT -> container:8080)
|
||||
|
||||
10
CHANGELOG.md
10
CHANGELOG.md
@@ -8,12 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
- **Simplified Configuration** - Removed unnecessary environment variables
|
||||
- **Simplified Configuration** - Removed unnecessary environment variables and port mappings
|
||||
- Removed `RUNTIME_ENV_PATH` (API dynamically manages runtime configs)
|
||||
- Removed `API_PORT` from container environment (only used for host port mapping)
|
||||
- Container always uses port 8080 internally (hardcoded in entrypoint.sh)
|
||||
- API_PORT in .env only controls host-side port mapping
|
||||
- Reduces configuration complexity for new deployments
|
||||
- Removed MCP service port configuration (MATH_HTTP_PORT, SEARCH_HTTP_PORT, TRADE_HTTP_PORT, GETPRICE_HTTP_PORT)
|
||||
- MCP services use fixed internal ports (8000-8003) and are no longer exposed to host
|
||||
- Container always uses port 8080 internally for API (hardcoded in entrypoint.sh)
|
||||
- Only API port (8080) and web dashboard (8888) are exposed to host
|
||||
- Reduces configuration complexity and attack surface for new deployments
|
||||
|
||||
## [0.3.0] - 2025-10-31
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ cp .env.example .env
|
||||
# Edit .env and set:
|
||||
# - OPENAI_API_BASE, OPENAI_API_KEY
|
||||
# - ALPHAADVANTAGE_API_KEY, JINA_API_KEY
|
||||
# - MCP service ports (default: 8000-8003)
|
||||
# - AGENT_MAX_STEP (default: 30)
|
||||
```
|
||||
|
||||
@@ -40,11 +39,8 @@ cd agent_tools
|
||||
python start_mcp_services.py
|
||||
cd ..
|
||||
|
||||
# Services run on ports defined in .env:
|
||||
# - MATH_HTTP_PORT (default: 8000)
|
||||
# - SEARCH_HTTP_PORT (default: 8001)
|
||||
# - TRADE_HTTP_PORT (default: 8002)
|
||||
# - GETPRICE_HTTP_PORT (default: 8003)
|
||||
# MCP services use fixed internal ports (8000-8003)
|
||||
# These are not exposed to the host and should not be changed
|
||||
```
|
||||
|
||||
### Docker Deployment
|
||||
|
||||
@@ -291,11 +291,6 @@ OPENAI_API_KEY=your_openai_key
|
||||
ALPHAADVANTAGE_API_KEY=your_alpha_vantage_key
|
||||
JINA_API_KEY=your_jina_api_key
|
||||
|
||||
# 🌐 Service Port Configuration
|
||||
MATH_HTTP_PORT=8000
|
||||
SEARCH_HTTP_PORT=8001
|
||||
TRADE_HTTP_PORT=8002
|
||||
GETPRICE_HTTP_PORT=8003
|
||||
# 🧠 AI Agent Configuration
|
||||
AGENT_MAX_STEP=30 # Maximum reasoning steps
|
||||
```
|
||||
|
||||
@@ -18,21 +18,10 @@ services:
|
||||
- ALPHAADVANTAGE_API_KEY=${ALPHAADVANTAGE_API_KEY}
|
||||
- JINA_API_KEY=${JINA_API_KEY}
|
||||
|
||||
# MCP Service Ports (fixed internally)
|
||||
- MATH_HTTP_PORT=8000
|
||||
- SEARCH_HTTP_PORT=8001
|
||||
- TRADE_HTTP_PORT=8002
|
||||
- GETPRICE_HTTP_PORT=8003
|
||||
|
||||
# Agent Configuration
|
||||
- AGENT_MAX_STEP=${AGENT_MAX_STEP:-30}
|
||||
ports:
|
||||
# MCP service ports (internal)
|
||||
- "${MATH_HTTP_PORT:-8000}:8000"
|
||||
- "${SEARCH_HTTP_PORT:-8001}:8001"
|
||||
- "${TRADE_HTTP_PORT:-8002}:8002"
|
||||
- "${GETPRICE_HTTP_PORT:-8003}:8003"
|
||||
# API server port (primary interface)
|
||||
# API server port (primary interface for external access)
|
||||
- "${API_PORT:-8080}:8080"
|
||||
# Web dashboard
|
||||
- "${WEB_HTTP_PORT:-8888}:8888"
|
||||
|
||||
Reference in New Issue
Block a user