Skip to content

Commit 017472e

Browse files
authored
Merge branch 'main' into fix/hide-deactivated-prompts-tools-resources
2 parents f871f06 + 298b32d commit 017472e

357 files changed

Lines changed: 70377 additions & 10550 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/pr-review/SKILL.md

Lines changed: 89 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,99 @@
11
---
22
name: pr-review
3-
description: Use when a feature branch is ready for code review, needs rebasing onto main, or before creating/updating a pull request. Also use when asked to review changes, check code quality, or verify a branch is merge-ready.
3+
description: >-
4+
Review code changes for quality, security, correctness, and design. Use when
5+
a feature branch is ready for review, before creating or updating a pull
6+
request, when asked to check code quality, review changes, look at a diff,
7+
or verify a branch is merge-ready. Also triggers on phrases like "review my
8+
code", "what do you think of these changes", or "is this ready to merge".
49
---
510

611
# PR Review
712

8-
Review all changes between `main` and the current branch HEAD, plus any staged
9-
and unstaged working-tree changes.
13+
A review-only skill. **Do not modify any files** — produce a report the author
14+
uses to make their own changes.
1015

11-
## Setup
16+
## Gather context
1217

13-
1. **Rebase** — Unless the user says otherwise, fetch `origin` and rebase onto
14-
`origin/main`, resolving conflicts. If the branch has Alembic migrations,
15-
run `alembic heads` after rebase — if multiple heads exist, update
16-
`down_revision` to restore a single linear history.
18+
1. **Diff** — Collect all changes between `origin/main` and HEAD, plus any
19+
staged/unstaged working-tree changes. This is the review scope. Treat
20+
all of these changes as a single unit — assume everything will be
21+
committed before merge. Do not report on git staging status (uncommitted,
22+
unstaged, etc.) as a finding.
1723

18-
2. **Gather context** — If a PR exists (`gh pr view`):
19-
- PR description, title, review comments (`gh pr view --comments`)
20-
- Linked issues (`gh issue view N`) to understand requirements
21-
If no PR exists, review from the diff alone.
24+
2. **PR metadata** — If a PR exists (`gh pr view`), read the description,
25+
review comments (`gh pr view --comments`), and linked issues
26+
(`gh issue view N`) to understand requirements and prior feedback.
2227

23-
3. **Read project docs**Check for `AGENTS.md`, `CONTRIBUTING.md`,
24-
`CLAUDE.md`. These are authoritative for test commands, linter config, and
25-
conventions — use their commands exactly, not generic substitutes.
28+
3. **Project conventions**Read `AGENTS.md`, `CONTRIBUTING.md`, or
29+
`CLAUDE.md` if present. These are authoritative for linter commands, test
30+
commands, and coding conventions — use their commands exactly.
2631

2732
## Review checklist
2833

29-
Review the diff in priority order. Fix blocking issues directly when
30-
straightforward; flag issues that need human judgment.
34+
Review the diff in priority order. Report all findings for human review.
3135

3236
| # | Category | Severity | Focus |
3337
|---|----------|----------|-------|
3438
| 1 | Security | Blocking | Injection, leaked secrets, auth gaps, OWASP top 10 |
3539
| 2 | Correctness | Blocking | Logic errors, edge cases, mismatch with linked issues |
36-
| 3 | Test coverage | Blocking | 100% differential coverage — verify changed code has tests |
37-
| 4 | Linter compliance | Blocking | Run project linters on touched files; resolve all findings |
40+
| 3 | Test coverage | Blocking | Differential coverage — verify changed code has tests |
41+
| 4 | Linter compliance | Blocking | Run project linters on touched files; report findings with exact commands |
3842
| 5 | Performance | High | N+1 queries, unnecessary allocations, bottlenecks |
39-
| 6 | Code quality | Medium | Redundancy, over-complexity, code smells |
40-
| 7 | Consistency | Medium | Follow documented conventions; suggest undocumented ones |
41-
| 8 | Alembic migrations | Conditional | Idempotence, reversibility, cross-DB compat, data safety, `batch_alter_table` for SQLite |
43+
| 6 | Redundancy | High | Duplicated logic, copy-paste patterns, shared-utility opportunities |
44+
| 7 | Design | High | Structural quality — see guidance below |
45+
| 8 | Consistency | Medium | Adherence to documented conventions |
46+
| 9 | Alembic migrations | Conditional | Idempotence, reversibility, cross-DB compat, `batch_alter_table` for SQLite |
47+
48+
## Design review guidance
49+
50+
### Structure and modularity
51+
52+
- **Single-responsibility violations** — functions or classes doing more than
53+
one thing. Name what each responsibility is and suggest how to split.
54+
- **God functions** — functions with >50 lines of logic or >3 levels of
55+
nesting. Identify extraction points.
56+
- **Long parameter lists** — >5 parameters often indicate a missing config
57+
object or dataclass.
58+
- **Tight coupling** — modules reaching into each other's internals. Suggest
59+
interface boundaries.
60+
- **Deep nesting** — suggest early returns, guard clauses, or extracted helpers.
61+
62+
### Object-oriented design and polymorphism
63+
64+
This codebase tends toward long if/elif/else chains where polymorphic dispatch
65+
would be cleaner. **Actively look for these opportunities** in changed code and
66+
in code adjacent to changes:
67+
68+
- **Type-switching conditionals** — e.g., `if transport == "sse": ... elif
69+
transport == "websocket": ...`. Suggest an ABC or Protocol with concrete
70+
implementations per variant.
71+
- **Conditional behavior by enum/string** — functions branching on a type field.
72+
Suggest the Strategy or Template Method pattern.
73+
- **Scattered object creation** — conditionals that construct different objects
74+
by type. Suggest a factory method or registry pattern.
75+
- **Dict-dispatch** — for simpler cases where class hierarchies are overkill,
76+
`dict[key, callable]` dispatch tables are a good stepping stone.
77+
- **Copy-paste behavior across classes** — suggest a `Protocol` (structural
78+
subtyping) or mixin.
79+
- **Missing abstract parents** — when classes share an interface but lack a
80+
common base, suggest an `ABC` with `@abstractmethod`.
81+
82+
### Missing abstractions
83+
84+
- **Repeated patterns** across 3+ call sites → shared utility or base class.
85+
- **Data bags with scattered behavior** — pure data classes whose related logic
86+
lives in other modules. The behavior should live with the data.
4287

4388
## Second opinions
4489

45-
After your own review, run available second-opinion tools in parallel as
46-
background tasks. If a tool is missing from `$PATH` or fails, skip it and note
47-
reduced coverage.
90+
After your own review, attempt to run these tools as background tasks. If a
91+
tool is not installed or fails, skip it and note the reduced coverage.
4892

49-
- **Codex**: `codex exec review --base origin/main`
50-
- **Bob**: Pipe the diff inline — `git diff origin/main..HEAD | bob "Review this
51-
diff for correctness, security, and code quality. Be specific about
52-
line-level issues."` Tailor the prompt to the PR content.
93+
- `codex exec review --base origin/main`
94+
- `git diff origin/main..HEAD | bob "Review this diff for correctness, security, and design quality. Be specific about line-level issues."`
5395

54-
Attribute findings to their source (Claude/Codex/Bob) and resolve contradictions.
96+
Attribute findings to their source and resolve contradictions.
5597

5698
## Output format
5799

@@ -62,23 +104,28 @@ Attribute findings to their source (Claude/Codex/Bob) and resolve contradictions
62104
[1-2 sentence overview: what changed, whether it meets PR/issue goals]
63105

64106
## Findings
65-
| # | Severity | Category | File:Line | Issue | Source |
66-
|---|----------|----------|-----------|-------|--------|
67107

68-
## Fixes Applied
69-
[Issues fixed directly, with commit refs]
108+
### Blocking
109+
| File:Line | Category | Issue | Suggestion |
110+
|-----------|----------|-------|------------|
70111

71-
## Remaining Issues
72-
[Issues needing human decision or outside scope]
112+
### High
113+
| File:Line | Category | Issue | Suggestion |
114+
|-----------|----------|-------|------------|
115+
116+
### Medium
117+
| File:Line | Category | Issue | Suggestion |
118+
|-----------|----------|-------|------------|
73119

74120
## Recommendation
75-
Pick exactly ONE: Ready to merge | Ready after fixing remaining issues | Needs significant rework
121+
[Pick exactly ONE: "Ready to merge" | "Ready after addressing findings" | "Needs significant rework"]
122+
[1 sentence justification]
76123
```
77124

78125
## Rules
79126

80-
- Never mention Claude, Claude Code, or AI in commits or PR text.
81-
- Never push unless explicitly asked.
82-
- Sign commits with `git commit -s`. Verify Git author matches `gh auth status`.
83-
- Create new commits rather than amending existing ones when rebasing or fixing.
84-
- After fix-up commits, re-run linters and tests to confirm no regressions.
127+
- **Do not modify any files.** Report findings for the author to address.
128+
- Never mention Claude, Claude Code, or AI in any output.
129+
- Include exact linter commands and output so the author can reproduce.
130+
- Make suggestions concrete — name the method to extract, the class to create,
131+
the interface to define. "Consider refactoring" is not actionable.

.env.example

Lines changed: 104 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BASIC_AUTH_PASSWORD=changeme
1919

2020
# JWT secret used to sign tokens
2121
# PRODUCTION: Use a strong, unique value
22-
JWT_SECRET_KEY=my-test-key
22+
JWT_SECRET_KEY=my-test-key-but-now-longer-than-32-bytes
2323

2424
# Passphrase used to encrypt stored auth secrets
2525
# PRODUCTION: Use a strong, unique value
@@ -731,7 +731,7 @@ OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
731731
# Secret used to sign JWTs (required for HMAC algorithms: HS256, HS384, HS512)
732732
# PRODUCTION: Use a strong, random secret (minimum 32 characters)
733733
# Generate with: openssl rand -base64 32
734-
# JWT_SECRET_KEY=my-test-key
734+
# JWT_SECRET_KEY=my-test-key-but-now-longer-than-32-bytes
735735

736736
# === RSA/ECDSA (Asymmetric) Configuration - Recommended for Production ===
737737
# Public and private key paths (required for asymmetric algorithms: RS*, ES*)
@@ -2707,22 +2707,121 @@ PLUGINS_CLI_MARKUP_MODE=rich
27072707
# Copy resource attributes to span attributes (for Arize compatibility)
27082708
# Some observability backends like Arize require certain attributes as span attributes
27092709
# rather than resource attributes. Enable this to copy arize.project.name and model_id.
2710-
# Direct env read (mcpgateway/observability.py)
2710+
# Read via mcpgateway/config.py
27112711
# OTEL_COPY_RESOURCE_ATTRS_TO_SPANS=false
27122712

27132713
# Deployment environment label for observability resource attributes
2714-
# Direct env read (mcpgateway/observability.py)
2714+
# Read via mcpgateway/config.py
27152715
# DEPLOYMENT_ENV=development
27162716

27172717
# Jaeger exporter auth (only used when OTEL_TRACES_EXPORTER=jaeger)
2718-
# Direct env read (mcpgateway/observability.py)
2718+
# Read via mcpgateway/config.py
27192719
# OTEL_EXPORTER_JAEGER_USER=
27202720
# OTEL_EXPORTER_JAEGER_PASSWORD=
27212721

27222722
# Test mode for observability (disables tracing when set to 1)
27232723
# Direct env read (mcpgateway/observability.py)
27242724
# MCP_TESTING=0
27252725

2726+
# =============================================================================
2727+
# Langfuse LLM Observability Integration
2728+
# =============================================================================
2729+
# Langfuse provides trace visualization, prompt management, evaluations,
2730+
# cost tracking, and LLM analytics. Integrates via OTLP/HTTP.
2731+
#
2732+
# Quick start: make langfuse-up
2733+
# Access: http://localhost:3100
2734+
# Combined: make langfuse-monitoring-up (Langfuse + Grafana/Tempo; gateway traces still go to Langfuse by default)
2735+
#
2736+
# Usage: docker compose -f docker-compose.yml -f docker-compose.with-langfuse.yml up -d
2737+
2738+
# Langfuse OTLP endpoint override for the gateway.
2739+
# Defaults to the local compose service when unset in the overlay.
2740+
# LANGFUSE_OTEL_ENDPOINT=http://localhost:3100/api/public/otel/v1/traces
2741+
2742+
# Langfuse API keys used by ContextForge to connect to Langfuse via OTLP.
2743+
# For the local self-hosted compose overlay, unset values fall back to the
2744+
# compose-local dev defaults `pk-lf-contextforge` / `sk-lf-contextforge`.
2745+
# Set these when you want a different local project or when connecting to an
2746+
# external Langfuse instance.
2747+
# LANGFUSE_PUBLIC_KEY=pk-lf-<optional-override>
2748+
# LANGFUSE_SECRET_KEY=sk-lf-<optional-override>
2749+
2750+
# Optional OTEL auth override: base64("publicKey:secretKey")
2751+
# When LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY are set, the gateway can
2752+
# derive the Authorization header automatically and this override is not needed.
2753+
# LANGFUSE_OTEL_AUTH=<base64-of-publicKey:secretKey>
2754+
2755+
# Langfuse UI host port (default: 3100 to avoid Grafana conflict on 3000)
2756+
# LANGFUSE_PORT=3100
2757+
2758+
# Langfuse worker metrics port (localhost only)
2759+
# LANGFUSE_WORKER_PORT=3130
2760+
2761+
# Langfuse UI URL (used for NEXTAUTH_URL and CORS)
2762+
# LANGFUSE_URL=http://localhost:3100
2763+
2764+
# Auto-provisioned admin user override for the local self-hosted Langfuse overlay
2765+
# LANGFUSE_INIT_USER_EMAIL=admin@example.com
2766+
# LANGFUSE_INIT_USER_PASSWORD=<optional-override>
2767+
2768+
# Auto-provisioned organization and project
2769+
# LANGFUSE_INIT_ORG_ID=contextforge
2770+
# LANGFUSE_INIT_ORG_NAME=ContextForge
2771+
# LANGFUSE_INIT_PROJECT_ID=contextforge-gateway
2772+
# LANGFUSE_INIT_PROJECT_NAME=ContextForge Gateway
2773+
2774+
# Optional overrides for the local self-hosted Langfuse overlay only.
2775+
# ContextForge does not read these. They are used only by docker-compose.with-langfuse.yml.
2776+
# If unset, the overlay uses local-only defaults defined in that compose file.
2777+
# LANGFUSE_POSTGRES_PASSWORD=<optional-override>
2778+
# LANGFUSE_CLICKHOUSE_USER=clickhouse
2779+
# LANGFUSE_CLICKHOUSE_PASSWORD=<optional-override>
2780+
# LANGFUSE_MINIO_USER=minio
2781+
# LANGFUSE_MINIO_PASSWORD=<optional-override>
2782+
# LANGFUSE_REDIS_AUTH=<optional-override>
2783+
# LANGFUSE_NEXTAUTH_SECRET=<optional-override>
2784+
# LANGFUSE_SALT=<optional-override>
2785+
# LANGFUSE_ENCRYPTION_KEY=<optional-override>
2786+
2787+
# Langfuse optional features
2788+
# LANGFUSE_TELEMETRY_ENABLED=true
2789+
# LANGFUSE_ENABLE_EXPERIMENTAL_FEATURES=false
2790+
2791+
# Monitoring stack host port overrides for `make monitoring-up` and
2792+
# `make langfuse-monitoring-up`. These are compose-only and are not read by
2793+
# mcpgateway/config.py.
2794+
# NGINX_PORT=8080
2795+
# GRAFANA_PORT=3000
2796+
# LOKI_PORT=3101
2797+
# PROMETHEUS_PORT=9090
2798+
# TEMPO_PORT=3200
2799+
# TEMPO_OTLP_GRPC_PORT=4317
2800+
# TEMPO_OTLP_HTTP_PORT=4318
2801+
# TEMPO_IMAGE_TAG=2.10.0
2802+
# PGADMIN_PORT=5050
2803+
# REDIS_COMMANDER_PORT=8081
2804+
# POSTGRES_EXPORTER_PORT=9187
2805+
# REDIS_EXPORTER_PORT=9121
2806+
# PGBOUNCER_EXPORTER_PORT=9127
2807+
# NGINX_EXPORTER_PORT=9113
2808+
# CADVISOR_PORT=8085
2809+
2810+
# OTEL trace controls for Langfuse and other OTLP backends
2811+
# Langfuse-specific attributes auto-enable when LANGFUSE_OTEL_ENDPOINT points to
2812+
# Langfuse. Set these explicitly only when you want to override that behavior.
2813+
# OTEL_EMIT_LANGFUSE_ATTRIBUTES=
2814+
# OTEL_CAPTURE_IDENTITY_ATTRIBUTES=
2815+
#
2816+
# Payload capture is allowlist-based. By default the gateway does not capture
2817+
# observation input or output payloads unless the relevant span names are listed.
2818+
# The local `docker-compose.with-langfuse.yml` overlay sets a dev-friendly input
2819+
# allowlist for `tool.invoke,prompt.render,llm.proxy,a2a.invoke`.
2820+
# OTEL_REDACT_FIELDS=password,secret,token,api_key,authorization,credential,auth_value,access_token,refresh_token,auth_token,client_secret,cookie,set-cookie,private_key
2821+
# OTEL_MAX_TRACE_PAYLOAD_SIZE=32768
2822+
# OTEL_CAPTURE_INPUT_SPANS=tool.invoke,prompt.render
2823+
# OTEL_CAPTURE_OUTPUT_SPANS=
2824+
27262825
# --- Auxiliary tools and CLIs (non-gateway runtime) --------------------------
27272826

27282827
# These are used by helper tools, CLIs, and SDK wrappers (not the main gateway server).

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# All files in the repo
22
* @crivetimihai
3+
/.github/workflows/ @crivetimihai
34

45
# Plugin framework
56
/mcpgateway/plugins @araujof @terylt @jonpspri

.github/actionlint.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
self-hosted-runner:
2+
labels:
3+
- ubuntu-24.04-s390x
4+
- ubuntu-24.04-ppc64le

.github/workflows/alembic-upgrade-validation.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,15 @@ jobs:
4343

4444
steps:
4545
- name: Checkout code
46-
uses: actions/checkout@v5
46+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
47+
with:
48+
persist-credentials: false
4749

4850
- name: Set up Docker Buildx
49-
uses: docker/setup-buildx-action@v3
51+
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
5052

5153
- name: Build candidate image
52-
uses: docker/build-push-action@v6
54+
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6
5355
with:
5456
context: .
5557
file: Containerfile.lite
@@ -66,7 +68,7 @@ jobs:
6668
6769
- name: Upload upgrade validation logs
6870
if: always()
69-
uses: actions/upload-artifact@v4
71+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
7072
with:
7173
name: alembic-upgrade-validation-logs
7274
path: artifacts/upgrade-validation
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ concurrency:
3232
group: ${{ github.workflow }}-${{ github.ref }}
3333
cancel-in-progress: true
3434

35+
permissions:
36+
contents: read
37+
3538
jobs:
3639
bandit:
3740
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
@@ -48,7 +51,9 @@ jobs:
4851
# 0️⃣ Check out the repository
4952
# -----------------------------------------------------------
5053
- name: ⬇️ Checkout code
51-
uses: actions/checkout@v5
54+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
55+
with:
56+
persist-credentials: false
5257

5358
# -----------------------------------------------------------
5459
# 1️⃣ Run Bandit with custom filters

0 commit comments

Comments
 (0)