Skip to content

feat(search-mcp): persist client-attributed tool activity - #7892

Merged
waleedlatif1 merged 2 commits into
stagingfrom
codex/mcp-call-attribution
Sep 16, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
codex/mcp-call-attribution

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Persist content-free Search MCP tool activity with OAuth client attribution, outcome, duration, and organization scope.
  • Record activity after the response with a bounded database write, and snapshot client names for future usage reporting.
  • Preserve authenticated client attribution in JSON and OpenTelemetry logs.

Type of Change

  • New feature

Testing

Focused MCP/auth tests and logger tests passed, along with the real PostgreSQL/MCP integration suite. Verified the full migration chain and an idempotent second run against a disposable database. Type checks, lint, all repository audits, API boundary validation, and migration safety checks passed.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Sep 16, 2026 8:58pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/knowledge/mcp/activity.ts Outdated
Comment thread apps/sim/lib/knowledge/__integration__/organization-mcp-search.integration.ts Outdated
@greptile-apps

greptile-apps Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the previous cancellation issue is resolved and no new actionable defects remain.

Summary

This PR adds content-free, organization-scoped persistence for Search MCP tool activity and carries authenticated OAuth client attribution into activity and operational logs.

  • Records tool name, outcome, duration, organization, optional user, authentication kind, and an admission-time OAuth client-name snapshot after the response.
  • Adds the corresponding Drizzle schema, SQL migration, constraints, indexes, and schema mocks.
  • Keeps OAuth display metadata out of serialized workflow authority while propagating authenticated client IDs through JSON and OpenTelemetry logs.
  • Covers successful, erroneous, rate-limited, and cancelled tool calls, including cancellation around rate-limit admission.
Diagram
sequenceDiagram
  participant Client as MCP Client
  participant Auth as OAuth/API-key Auth
  participant MCP as Search MCP Server
  participant Tool as Search Tool
  participant Log as Operational Logs
  participant DB as Activity Store

  Client->>Auth: Authenticated tool request
  Auth-->>MCP: Verified principal and organization scope
  MCP->>MCP: Check cancellation
  MCP->>MCP: Enforce rate limit
  alt Admitted
    MCP->>Tool: Execute with combined abort signal
    Tool-->>MCP: Result or error
  else Rate limited or cancelled
    MCP->>MCP: Produce tool error
  end
  MCP->>Log: Emit content-free completion metadata
  MCP-->>Client: Tool response
  MCP-->>DB: After response, persist attributed activity
Loading

Reviews (2) · Last reviewed commit: "fix(search-mcp): snapshot client attribu..."

Comment thread apps/sim/lib/knowledge/mcp/server.ts
@waleedlatif1
waleedlatif1 force-pushed the codex/mcp-call-attribution branch from 76a3642 to 7ef1087 Compare September 16, 2026 20:56
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 16 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Tip: cubic can generate docs of your entire codebase and keep them up to date. Try it here.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 55ccc5d into staging Sep 16, 2026
36 checks passed
@waleedlatif1
waleedlatif1 deleted the codex/mcp-call-attribution branch September 16, 2026 21:08
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.

1 participant