Repository navigation
feat(labs): Hook B — labs-trading-data MCP service + openclaw wiring #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6b20e60
feat(labs/trading-data): new MCP service for Bybit/Bitget WS CVD + ne…
2181bfb
feat(labs/openclaw): wire trading-data MCP server into openclaw runtime
df358e8
chore(labs/trading-data): bump to 0.2.0 + switch news upstream to Cry…
871c4d8
fix(labs/openclaw): trading-data proxy validates upstream payloads (c…
ab18b89
fix(labs/openclaw): proxy notification-aware + SSE block-parsing (cod…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
platform-gitops/services/labs/trading-data/catalog-info.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| apiVersion: backstage.io/v1alpha1 | ||
| kind: Component | ||
| metadata: | ||
| name: trading-data | ||
| namespace: labs | ||
| description: "Bybit + Bitget WS taker aggregation + CryptoPanic + Etherscan MCP service for labs-openclaw" | ||
| annotations: | ||
| backstage.io/kubernetes-label-selector: app.kubernetes.io/instance=labs-trading-data | ||
| backstage.io/kubernetes-id: trading-data | ||
| backstage.io/kubernetes-namespace: labs | ||
| argocd/app-name: labs-trading-data | ||
| github.com/source-repo: mctlhq/mctl-trading-data | ||
| # Auto-deploy disabled — image bumps land via manual mctl_deploy_service | ||
| # so the operator can stage Vault changes for new tools alongside. | ||
| mctl.me/auto-deploy: "false" | ||
| links: | ||
| - url: https://ops.mctl.ai/applications/argocd/labs-trading-data | ||
| title: ArgoCD | ||
| icon: dashboard | ||
| - url: https://github.com/mctlhq/mctl-trading-data | ||
| title: Source Repository | ||
| icon: github | ||
| labels: | ||
| team: labs | ||
| env: apps | ||
| spec: | ||
| type: service | ||
| lifecycle: production | ||
| owner: group:default/labs | ||
| system: system:default/team-labs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,141 @@ | ||
| # Service: trading-data | ||
| # Team: labs | ||
| # Chart: base-service | ||
| # | ||
| # Stateful WebSocket service that aggregates Bybit V5 + Bitget V2 public-trade | ||
| # streams into rolling 24h taker buckets and exposes them — alongside | ||
| # CryptoPanic news + Etherscan gas/whale REST helpers — as MCP tools over | ||
| # streamable-HTTP with Bearer auth. Consumed by labs-openclaw via the | ||
| # `trading-data-mcp-proxy.js` stdio bridge declared in the openclaw chart. | ||
| # | ||
| # replicaCount=1 is a HARD INVARIANT — buckets live in process memory. | ||
| # Scaling > 1 requires WS leader election + Redis-backed buckets first. | ||
|
|
||
| image: | ||
| repository: ghcr.io/mctlhq/mctl-trading-data | ||
| tag: "0.2.0" | ||
| imagePullSecrets: | ||
| - name: ghcr-credentials | ||
| service: | ||
| port: 8080 | ||
| backstage: | ||
| kubernetesId: trading-data | ||
| replicaCount: 1 | ||
| autoscaling: | ||
| enabled: false | ||
| resources: | ||
| requests: | ||
| cpu: 200m | ||
| memory: 384Mi | ||
| limits: | ||
| cpu: 1000m | ||
| memory: 768Mi | ||
| env: | ||
| APP_ENV: production | ||
| LOG_LEVEL: info | ||
| WATCH_SYMBOLS: "ETHUSDT" | ||
| envFrom: | ||
| # CryptoCompare News + Etherscan free-tier API keys; sourced from Vault at | ||
| # secret/data/teams/labs/trading-data/{cryptocompare,etherscan}. CryptoPanic | ||
| # was the original choice but its free tier was discontinued April 2026 — | ||
| # CryptoCompare News v2 (Apikey header auth, ~100K calls/month free) is | ||
| # the drop-in replacement that mctl-trading-data 0.2.0 ships against. | ||
| - secretRef: | ||
| name: labs-trading-data-upstream | ||
| # TRADING_DATA_TOKEN — server-side bearer; same secret value also lands in | ||
| # labs-openclaw via the matching client-side ExternalSecret in that chart. | ||
| - secretRef: | ||
| name: labs-trading-data-server | ||
| probes: | ||
| liveness: | ||
| path: /healthz | ||
| port: http | ||
| initialDelaySeconds: 60 | ||
| periodSeconds: 30 | ||
| readiness: | ||
| path: /readyz | ||
| port: http | ||
| initialDelaySeconds: 30 | ||
| periodSeconds: 10 | ||
| ingress: | ||
| enabled: false | ||
| extraObjects: | ||
| # Pod-to-pod only — no ingress controller, no inter-tenant traffic. | ||
| # Egress is restricted to public internet (443) + cluster DNS (kube-system). | ||
| - apiVersion: networking.k8s.io/v1 | ||
| kind: NetworkPolicy | ||
| metadata: | ||
| name: labs-trading-data | ||
| spec: | ||
| podSelector: | ||
| matchLabels: | ||
| app.kubernetes.io/instance: labs-trading-data | ||
| policyTypes: | ||
| - Ingress | ||
| - Egress | ||
| ingress: | ||
| - from: | ||
| - podSelector: | ||
| matchLabels: | ||
| app.kubernetes.io/instance: labs-openclaw | ||
| ports: | ||
| - protocol: TCP | ||
| port: 8080 | ||
| egress: | ||
| # Cluster DNS | ||
| - to: | ||
| - namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: kube-system | ||
| ports: | ||
| - protocol: UDP | ||
| port: 53 | ||
| - protocol: TCP | ||
| port: 53 | ||
| # Public internet (exchanges + APIs); RFC1918 ranges denied. | ||
| - to: | ||
| - ipBlock: | ||
| cidr: 0.0.0.0/0 | ||
| except: | ||
| - 10.0.0.0/8 | ||
| - 172.16.0.0/12 | ||
| - 192.168.0.0/16 | ||
| ports: | ||
| - protocol: TCP | ||
| port: 443 | ||
| extraExternalSecrets: | ||
| ghcr-credentials: | ||
| refreshInterval: 24h | ||
| targetSecret: ghcr-credentials | ||
| targetTemplateType: kubernetes.io/dockerconfigjson | ||
| targetTemplateMetadataAnnotations: | ||
| argocd.argoproj.io/compare-options: IgnoreExtraneous | ||
| data: | ||
| - secretKey: .dockerconfigjson | ||
| remoteKey: platform/backstage/ghcr-credentials | ||
| property: dockerconfigjson | ||
| # Free-tier upstream API keys. Operator provisions these in Vault at | ||
| # secret/data/teams/labs/trading-data/{cryptocompare,etherscan} (field | ||
| # `api_key`). NEWS_API_KEY is consumed by mctl-trading-data's news.py | ||
| # (CryptoCompare News v2 since 0.2.0) — vendor-neutral env name so a | ||
| # future swap stays a one-file change. | ||
| labs-trading-data-upstream: | ||
| refreshInterval: 1h | ||
| targetSecret: labs-trading-data-upstream | ||
| data: | ||
| - secretKey: NEWS_API_KEY | ||
| remoteKey: secret/data/teams/labs/trading-data/cryptocompare | ||
| property: api_key | ||
| - secretKey: ETHERSCAN_API_KEY | ||
| remoteKey: secret/data/teams/labs/trading-data/etherscan | ||
| property: api_key | ||
| # Server-side bearer for incoming MCP requests. Same Vault path is consumed | ||
| # client-side by labs-openclaw — see ExternalSecret labs-trading-data-client | ||
| # in services/labs/openclaw/values.yaml. | ||
| labs-trading-data-server: | ||
| refreshInterval: 1h | ||
| targetSecret: labs-trading-data-server | ||
| data: | ||
| - secretKey: TRADING_DATA_TOKEN | ||
| remoteKey: secret/data/teams/labs/trading-data/client-token | ||
| property: bearer_token |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
trading-datais configured with onlyTRADING_DATA_URLinmcp.servers.trading-data.env, but the proxy script requires bothTRADING_DATA_URLandTRADING_DATA_TOKENand immediately returns an error when the token is missing. In this same file, the setup comment explains that the bundle-mcp path usesmcp.servers.<name>.envverbatim for the spawned process, so pod-levelenvFromsecrets are not sufficient here; as committed, every call to this MCP server will fail with the proxy-not-configured error instead of reachinglabs-trading-data.Useful? React with 👍 / 👎.