Skip to content

feat(httpapi): expose default MCP instructions via /api/v1/status (MCP-2176)#652

Merged
Dumbris merged 1 commit into
mainfrom
feat/mcp-2176-status-default-instructions
Jun 13, 2026
Merged

feat(httpapi): expose default MCP instructions via /api/v1/status (MCP-2176)#652
Dumbris merged 1 commit into
mainfrom
feat/mcp-2176-status-default-instructions

Conversation

@Dumbris

@Dumbris Dumbris commented Jun 13, 2026

Copy link
Copy Markdown
Member

Summary

Backend half of MCP-2175 (Web UI instructions textarea, frontend PR #651). Exposes the resolved built-in MCP instructions default via /api/v1/status so the frontend renders it as the textarea placeholder without hardcoding the default text (drift risk — explicit issue requirement).

What changed

  • internal/httpapi/server.go
    • Added DefaultInstructions() string to the ServerController interface.
    • handleGetStatus now sets response["default_instructions"] = s.controller.DefaultInstructions().
  • internal/server/server.go
    • Implemented (*Server).DefaultInstructions() returning the built-in defaultInstructions const (mirrors resolveInstructions("")).

The value is always the built-in default, never the user's current custom value, so the placeholder shows "what you'd get if you clear the box".

Why a controller method (not a direct import)

defaultInstructions/resolveInstructions are unexported in package server, and internal/server already imports internal/httpapi — so a reverse import would create a cycle. The controller interface (already used by the handler) is the clean seam.

Tests (TDD)

  • internal/httpapi/routing_test.goTestHandleGetStatus_IncludesDefaultInstructions: asserts the status response includes a non-empty default_instructions containing retrieve_tools.
  • internal/server/mcp_instructions_test.goTestServer_DefaultInstructions: asserts the controller method returns the built-in default.
  • Test mocks (baseController, MockServerController) gain the new method.

Verification

  • go build ./... (personal edition) ✅
  • ./scripts/run-linter.sh0 issues
  • go test ./internal/httpapi/... -race ✅ and go test ./internal/server/ ✅ (E2E need the built ./mcpproxy binary)
  • ./scripts/test-api-e2e.sh65/65 passed
  • Live curl /api/v1/statusdefault_instructions present (865 chars, contains retrieve_tools, real built-in text) ✅

Docs / OAS

/api/v1/status response data is a generic object (no schema change required); no annotated contract changed, so no OAS regeneration needed.

Handshake with frontend

Frontend PR #651 already consumes default_instructions and degrades gracefully when absent. Once this lands, the real default appears as the placeholder (route-mocked Playwright placeholder-default.spec.ts).

Related #651, MCP-2176, MCP-2175

Note: server-edition build (-tags server) is red on origin/main due to pre-existing internal/teams/broker (spec-074 credential store) — unrelated to this PR; personal edition builds clean.

Add a `default_instructions` field to the /api/v1/status response carrying
the built-in default MCP instructions text (resolveInstructions("")), so the
Web UI instructions textarea can render the built-in default as its
placeholder without hardcoding the text (drift risk).

Wiring: add DefaultInstructions() to the httpapi ServerController interface,
implement it on *server.Server returning the defaultInstructions const, and
set response["default_instructions"] in handleGetStatus. The value is always
the built-in default, never the user's current custom value, so the
placeholder shows "what you'd get if you clear the box".

Tests: handler test asserts the status response includes a non-empty
default_instructions containing "retrieve_tools"; server-package test asserts
the controller method returns the built-in default.

Related #651 (frontend), MCP-2176, MCP-2175
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: cf1730f
Status: ✅  Deploy successful!
Preview URL: https://21dae766.mcpproxy-docs.pages.dev
Branch Preview URL: https://feat-mcp-2176-status-default.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: feat/mcp-2176-status-default-instructions

Available Artifacts

  • archive-darwin-amd64 (28 MB)
  • archive-darwin-arm64 (25 MB)
  • archive-linux-amd64 (16 MB)
  • archive-linux-arm64 (14 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (24 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (21 MB)
  • installer-dmg-darwin-arm64 (19 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 27474831587 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@Dumbris Dumbris merged commit 546a239 into main Jun 13, 2026
37 checks passed
@Dumbris Dumbris deleted the feat/mcp-2176-status-default-instructions branch June 13, 2026 18:26
Dumbris added a commit that referenced this pull request Jun 13, 2026
…651)

Adds an editable textarea for the top-level `instructions` config to Settings → Advanced ("MCP server instructions" accordion), bound via the key-driven SettingsSection pattern. The built-in default is fetched live from `/api/v1/status` `default_instructions` and shown as the placeholder (no hardcoding, drift-safe). Empty-means-default: clearing persists `""`, which Go maps back to the built-in default.

Frontend half of MCP-2175 (backend dependency #652 already merged). Verified end-to-end against a real running mcpproxy (no mocks): placeholder asserted exactly equal to the backend default, custom value saves+persists across reload, clearing falls back to the default. Report: frontend/verification/mcp-2175/report.html.

All required checks green incl. qa-gate. Merged under explicit owner authorization (author == maintainer gh identity).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants