Skip to main content
Glama
buildingagentswithdeepak-beep

MarketIntel MCP Server

README.md
# MarketIntel MCP Server (Azure Container Apps)

Cloud-hosted MCP server exposing market-research tools over SSE, per
`MarketIntel_MCP_Server_Azure_Spec.md`. Developers connect from VS Code
(Copilot Chat Agent mode) to a shared Azure HTTPS endpoint — no local server.

## Layout
```
MCPServer/
├── server.py                # Entrypoint (spec §7.3): binds 0.0.0.0:8000, SSE
├── market_intel/
│   ├── config.py            # Env-driven settings; secrets via env only (§9)
│   ├── providers.py         # SearchProvider seam: Tavily (prod) / Fake (offline)
│   ├── tools.py             # 5 tools + resource + prompt logic (§6, §10)
│   └── mcp_app.py           # FastMCP wiring (lazy import)
├── tests/test_tools.py      # 17 offline unit tests (§11)
├── Dockerfile               # python:3.12-slim + uv (§7.2)
├── infra/deploy.sh          # az containerapp up + scale rules (§7.4, §8)
├── .vscode/mcp.json         # VS Code MCP client config (§7.5)
└── .env.example
```

## Run locally (offline, no key)
```bash
python -m pytest -q                 # 17 passing
SEARCH_PROVIDER=fake python server.py   # serves SSE on :8000 (needs fastmcp)
```

## Run with real Tavily
```bash
pip install fastmcp tavily-python uvicorn
export TAVILY_API_KEY=tvly-...      # SEARCH_PROVIDER defaults to tavily
python server.py
```

## Deploy to Azure
```bash
export TAVILY_KEY=tvly-...
bash infra/deploy.sh                # prints the *.azurecontainerapps.io FQDN
```
Then set the `/sse` URL in `.vscode/mcp.json`.

## Design note
The Tavily dependency is behind a `SearchProvider` adapter (spec-driven offline
seam): `FakeSearchProvider` makes the full tool pipeline + tests run with zero
network and no API key; `TavilyProvider` (lazy-imported SDK) is selected by
`SEARCH_PROVIDER=tavily` for production. Same contract, one config flag.