Add MCP bridge local verification harness (TELE-WP-0002)

Introduce pytest smoke tests, run/verify scripts, and Makefile targets so
the bridge can be developed and validated without a full cluster deploy.
Document the local workflow and agent quickstart in README.
This commit is contained in:
2026-06-24 18:18:00 +02:00
parent f061364951
commit 8f2584c1a0
10 changed files with 218 additions and 11 deletions

View File

@@ -15,7 +15,68 @@ TeleMcp deploys a standard observability stack onto a Linux Kubernetes host via
| **OpenTelemetry Collector** | `observability` | Optional OTLP fan-out to Prometheus and Loki |
| **mcp-telemetry-bridge** | `mcp` | FastAPI service exposing MCP resources, tools, and prompts |
## Quick Start
## Local development (no cluster)
Work on the MCP bridge without deploying the full observability stack.
### Install and verify
```bash
make bridge-install # venv + deps (once)
make bridge-test # pytest smoke: /healthz, /mcp/schema, /mcp/resource
```
Or from `mcp-telemetry-bridge/`:
```bash
./scripts/verify-local.sh
```
### Run locally
```bash
make bridge-run
# or: cd mcp-telemetry-bridge && ./scripts/run-local.sh
```
With the server up, optional live HTTP checks:
```bash
make bridge-smoke
# or: RUN_LIVE=1 ./mcp-telemetry-bridge/scripts/verify-local.sh
```
Manual curls:
```bash
curl http://127.0.0.1:8080/healthz
curl http://127.0.0.1:8080/mcp/schema | jq .
curl "http://127.0.0.1:8080/mcp/resource?uri=res://dashboards/top-pods-by-cpu.promql"
```
Tool calls use `POST /tools/<name>` with a JSON body (Prometheus/Loki/K8s backends are only reachable in-cluster).
### Agent quickstart
When changing the bridge, agents should:
1. Run `make bridge-test` after edits — fast, no cluster needed.
2. Introspect `GET /mcp/schema` for the current tools, resources, and prompts.
3. Call tools via `POST /tools/<tool-name>` (e.g. `POST /tools/promql.query` with `{"expr":"up"}`).
4. Fetch saved queries via `GET /mcp/resource?uri=<uri>`.
Expected smoke-test surface:
| Endpoint | Method | Purpose |
|----------|--------|---------|
| `/healthz` | GET | Liveness |
| `/mcp/schema` | GET | MCP catalog (tools, resources, prompts) |
| `/mcp/resource` | GET | Saved PromQL/LogQL query by URI |
| `/tools/*` | POST | Execute a tool (needs in-cluster backends) |
---
## Quick Start (full cluster deploy)
### 0) Prereqs
@@ -75,6 +136,8 @@ tele-mcp/
values/ # Chart values for monitoring, logging, OTel
mcp-telemetry-bridge/ # Bridge Helm chart
mcp-telemetry-bridge/ # FastAPI bridge application
scripts/ # run-local.sh, verify-local.sh
tests/ # pytest smoke tests
environments/ # Per-environment overrides
wiki/ # Extended project and design docs
```