Skip to content

improvement(mship): mcp persistence in chat - #5974

Merged
Sg312 merged 1 commit into
stagingfrom
feat/mship-mcp
Jul 27, 2026
Merged

improvement(mship): mcp persistence in chat#5974
Sg312 merged 1 commit into
stagingfrom
feat/mship-mcp

Conversation

@Sg312

@Sg312 Sg312 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

MCP persistence in chat for mship

Type of Change

  • Bug fix

Testing

Manual

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 Jul 27, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 27, 2026 5:22pm

Request Review

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes MCP servers persistently enabled across subsequent chat turns.

  • Collects and deduplicates MCP server IDs from the conversation history and current request.
  • Makes enabled MCP tools directly callable instead of requiring deferred loading.
  • Updates model instructions and tests to reflect persistent server enablement.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or non-blocking defects identified in the changed behavior.

The implementation consistently unions persisted and current MCP contexts, deduplicates server IDs, and aligns the emitted tool metadata and model instructions with persistent direct invocation.

Important Files Changed

Filename Overview
apps/sim/lib/copilot/chat/post.ts Collects unique MCP server IDs from persisted conversation contexts and the current turn before payload construction.
apps/sim/lib/copilot/mcp-tools.ts Marks explicitly enabled MCP tools as directly callable rather than deferred.
apps/sim/lib/copilot/chat/process-contents.ts Updates MCP prompt context to describe chat-lifetime enablement and direct invocation.
apps/sim/lib/copilot/chat/post.test.ts Adds coverage for inherited MCP enablement and deduplication across turns.
apps/sim/lib/copilot/mcp-tools.test.ts Updates the schema assertion for non-deferred MCP tools.

Sequence Diagram

sequenceDiagram
  participant User
  participant Chat as Chat handler
  participant History as Conversation history
  participant Payload as Payload builder
  participant MCP as MCP tools
  participant Model as Mothership

  User->>Chat: Tag MCP server
  Chat->>History: Persist user message and MCP context
  Chat->>Payload: Current and historical server IDs
  Payload->>MCP: Resolve enabled servers' tools
  MCP-->>Payload: Directly callable tool schemas
  Payload->>Model: Send message and enabled tools
  User->>Chat: Send later message without tag
  Chat->>History: Read earlier MCP context
  Chat->>Payload: Reuse enabled server IDs
  Payload->>Model: Send later message with same tools
Loading

Reviews (1): Last reviewed commit: "Fixes" | Re-trigger Greptile

@Sg312 Sg312 changed the title Fixes improvement(mship): mcp persistence in chat Jul 27, 2026
@Sg312
Sg312 merged commit 67ffdac into staging Jul 27, 2026
21 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/mship-mcp branch July 27, 2026 22:49
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