Skip to content

feat: add via and middleware to X-Client-Info on clients - #197

Open
yannbf wants to merge 1 commit into
mainfrom
yannbraga/sdk-1877-add-mcp-middleware-telemetry-to-server
Open

yannbf wants to merge 1 commit into
mainfrom
yannbraga/sdk-1877-add-mcp-middleware-telemetry-to-server

Conversation

@yannbf

@yannbf yannbf commented Nov 23, 2026 •

Copy link
Copy Markdown

🔍 Description

What changed?

Adds via=supabase-server/<version> to X-Client-Info on clients created by @supabase/server.

Client middleware running after withOAuthProtectedResource also adds middleware=oauth-protected-resource. Caller tokens are merged and deduplicated; caller via takes precedence. Applies to user and lazy admin clients.

Adds a Release Please-managed version constant, tests and MCP documentation.

Why was this change needed?

To query BYO-MCP usage through outgoing Supabase API requests in gateway logs and the warehouse.

🔄 Breaking changes

  • This PR contains no breaking changes

Older v2 SDKs continue to work without the new tags. The peer range remains ^2.0.0.

📋 Checklist

📝 Additional notes

Depends on supabase-js#2887 and CI will be failing until that PR is release and I update the version of the SDK in this repo.

Validation: 591 unit tests, typecheck and lint pass against a local build of that supabase-js branch. Hosted Edge Functions, Compute and warehouse verification remain pending.

Linear: SDK-1877.

AI-assisted generated summary

Written with Claude Code and reviewed by me.

Files: src/core/client-info.ts (new), src/core/create-context-client.ts, src/core/create-admin-client.ts, src/middleware/client/index.ts, src/middleware/admin-client/index.ts, src/version.ts and release-please-config.json, docs/mcp.md, docs/core-primitives.md, and src/client-info.test.ts and src/version.test.ts.

🤖 Generated with Claude Code

Clients created by @supabase/server now send via=supabase-server/<version> in
X-Client-Info, and middleware=oauth-protected-resource when the client
middleware runs after withOAuthProtectedResource, so BYO-MCP usage can be
queried in gateway logs and the warehouse.

Refs SDK-1877

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@supabase/server@197

commit: 4c79d50

@yannbf
yannbf marked this pull request as ready for review November 24, 2026 10:18
@yannbf
yannbf requested review from a team as code owners November 24, 2026 10:18

This branch has not been deployed

No deployments
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