Skip to content

feat(mcp-utils): add bounded request lifecycle observations - #427

Merged
barryroodt merged 15 commits into
mainfrom
feat/mcp-observability-lifecycle
Oct 14, 2026
Merged

barryroodt merged 15 commits into
mainfrom
feat/mcp-observability-lifecycle

Conversation

@barryroodt

@barryroodt barryroodt commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Why

Platform measures hosted MCP request lifecycles (attempts, outcomes and durations) without shipping request payloads. This adds the generic core for that work in AI-1273, and #428 supplies Supabase-owned types and cost facts.

What changed

  • createMcpServer accepts an optional observer and an optional classifyTool function that maps a tool name to a host-defined bucket or other. Only tools/call contexts include a tool bucket; other contexts contain only the method.
  • Tools receive an optional handle with record and setOutcome. Outcomes don't depend on fact contents. Errors and input_required retain precedence.
  • Core forwards no request payloads automatically. Custom fact producers remain responsible for privacy.
  • With no observer, no facts or timings are recorded. onToolCall stays unchanged.

How to test

pnpm --filter @supabase/mcp-utils exec vitest run

36 tests pass.

Trade-offs

  • The host owns collection and export; duration excludes transport and human waiting.
  • Observer factory, classifyTool and sink failures are isolated, but synchronous observer and classifier work can still block requests.

@coveralls

coveralls commented Sep 11, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 38265913768

Coverage remained the same at 96.995%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4474
Covered Lines: 4362
Line Coverage: 97.5%
Relevant Branches: 717
Covered Branches: 673
Branch Coverage: 93.86%
Branches in Coverage %: Yes
Coverage Strength: 88.65 hits per line

💛 - Coveralls

@barryroodt barryroodt self-assigned this Sep 11, 2026

@raulb raulb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. I would only add an example to observability.md to illustrate its use. Maybe we could use what we do in the platform code that uses it as an example.

Additional feedback

The PR description also looks AI written 💀. I was missing a human-readable explanation of what this is trying to solve (a linked Linear issue or who asked for this).

Comment thread docs/observability.md Resolved
Comment thread docs/observability.md Resolved
Comment thread docs/observability.md Resolved
Comment thread docs/observability.md Resolved
Comment thread packages/mcp-utils/src/observation.ts Resolved
Comment thread packages/mcp-utils/src/observation.ts Resolved
Comment thread packages/mcp-utils/src/observation.ts Resolved
Comment thread docs/observability.md Resolved
@barryroodt
barryroodt marked this pull request as ready for review October 5, 2026 14:54
@barryroodt
barryroodt requested a review from a team as a code owner October 5, 2026 14:54
@raulb
raulb self-requested a review October 6, 2026 11:55
@barryroodt
barryroodt merged commit b11d62b into main Oct 14, 2026
5 checks passed
@supabase-releaser supabase-releaser Bot mentioned this pull request Oct 14, 2026
barryroodt added a commit that referenced this pull request Oct 14, 2026
)

## Why

Platform measures how Supabase cost confirmations for `create_project`
and `create_branch` behave, without shipping payloads. This is part of
[AI-1273](https://linear.app/supabase/issue/AI-1273/observability-for-mcp-elicitations-and-requests),
building on [#427](#427), with
[#455](#455) adding SQL confirmation
facts.

## What changed

- Supabase owns concrete tool and fact types plus observer aliases, and
classifies tools with a `CURRENT_ELICITATION_TOOLS` lookup; `mcp-utils`
supplies the generic core.
- `create_project` and `create_branch` report confirmation decisions and
protected-operation durations that exclude observer recording latency.
Consumed responses set the outcome before fact dispatch or changed-quote
validation.
- Built-in facts contain bounded values without raw arguments, results,
state or errors. Custom fact producers remain responsible for privacy.
- Existing confirmation behavior stays intact. With no observer, no
facts or timings are recorded.

## How to test

```sh
pnpm test:packed-platform-consumer
```

All 3 packed-consumer checks pass.

## Trade-offs

- Hosts own collection; synchronous observers can block despite failure
isolation.
- Packed checks don't cover branch or cancellation paths.
barryroodt pushed a commit that referenced this pull request Oct 14, 2026
🤖 I have created a release *beep* *boop*
---


<details><summary>mcp-utils: 0.9.0</summary>

##
[0.9.0](mcp-utils-v0.8.0...mcp-utils-v0.9.0)
(2026-10-14)


### Features

* **mcp-utils:** add bounded request lifecycle observations
([#427](#427))
([b11d62b](b11d62b))
</details>

<details><summary>mcp-server-supabase: 0.14.0</summary>

##
[0.14.0](mcp-server-supabase-v0.13.0...mcp-server-supabase-v0.14.0)
(2026-10-14)


### Features

* **advisors:** add health advisor support
([#420](#420))
([8a26508](8a26508))
* **mcp-server-supabase:** add bounded cost lifecycle observations
([#428](#428))
([657d1f3](657d1f3))
* **mcp-server-supabase:** add destructive SQL observations
([#455](#455))
([4595698](4595698))


### Bug Fixes

* **mcp:** clarify cost and deploy tool descriptions for OpenAI scanner
([#467](#467))
([1f9da03](1f9da03))
* **mcp:** stop double cost confirmation on create_project and
create_branch ([#468](#468))
([3c3b1fc](3c3b1fc))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
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.

3 participants