Skip to content

feat(copilot): expose server-managed tools over MCP#156

Closed
BruzWJ wants to merge 284 commits into
stagingfrom
feat/copilot-mcp
Closed

feat(copilot): expose server-managed tools over MCP#156
BruzWJ wants to merge 284 commits into
stagingfrom
feat/copilot-mcp

Conversation

@BruzWJ

@BruzWJ BruzWJ commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a TradingGoose Copilot MCP JSON-RPC endpoint backed by personal API-key authentication.
  • Add browser-approved MCP device login plus local setup scripts for Codex, Cursor, Claude, and OpenCode.
  • Move Copilot entity, workflow, monitor, knowledge, credential, and MCP operations onto the server-managed tool router with review-token acceptance for mutations.
  • Make workflow and saved-entity writes flow through Yjs first, then materialize persisted database state from the applied snapshot.
  • Add/update MCP auth, server tool routing, review acceptance, Yjs persistence, workflow, editor, and API-key test coverage.

Why

Copilot and external MCP clients need one authoritative server-side tool surface. This centralizes auth, workspace scoping, review staging, result validation, and persistence so Studio Copilot and MCP clients execute the same contracts instead of relying on browser-managed tools or direct state writes that can diverge from Yjs/editor state.

Affected Areas

  • apps/tradinggoose
  • apps/docs
  • packages/*
  • Workflows / execution
  • Realtime / sockets
  • Market data / charting
  • Dev tooling / CI / infra
  • Documentation only
  • Other: Copilot MCP/auth, server-managed tools, saved entity editors

Issue Links( if any )

N/A

Validation

# Not run locally in this PR-draft pass.
# Branch diff was reviewed against staging; CI should run the full test/type-check suite.

Risk / Rollout Notes

This is a high-surface-area Copilot/MCP and persistence change. Validate in staging before promotion:

  • MCP setup/login for Codex, Cursor, Claude, and OpenCode.
  • /api/copilot/mcp initialize, tools/list, ping, and tools/call flows.
  • Studio Copilot server-managed tool execution and review acceptance.
  • Workflow save, import, duplicate, revert, deploy, and variable preservation flows.
  • Saved entity editor flows for skills, custom tools, indicators, MCP servers, and knowledge bases.
  • Socket-server internal Yjs snapshot/apply endpoints.

Backout plan: revert this PR. If test MCP personal API keys were created during rollout, revoke those keys after rollback.

Config / Data Changes

  • Env vars added or changed: None.
  • Database schema or migration impact: None; uses existing verification, apiKey, workflow, and Yjs persistence tables.
  • External services or provider behavior changed: Adds TradingGoose MCP endpoints and local client setup for Codex/Cursor/Claude/OpenCode. MCP clients authenticate with personal API bearer tokens. Workspace-scoped Copilot/MCP tools now require explicit workspace context where applicable.

Screenshots / Video

Not captured. The new MCP authorization flow uses existing auth-page components and localized copy.

Checklist

  • I kept the change focused and reviewed my own diff
  • I validated the change locally and documented the results above
  • I updated docs, examples, or copy if behavior/user-facing flows changed
  • I called out any env, schema, provider, or rollout impact
  • I did not include secrets, tokens, or private credentials in this PR

BruzWJ and others added 30 commits June 23, 2026 11:20
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
BruzWJ and others added 21 commits June 28, 2026 02:16
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Return a consistent error when API-key storage is unavailable, short-circuit matching helpers, cover the behavior in tests, and rename the MCP setup key label to match the personal API key flow.

Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Delete the database record first, then run realtime cleanup as a best-effort follow-up so cleanup failures do not block a successful delete.

Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Comment thread apps/tradinggoose/lib/copilot/tools/server/router.ts
@BruzWJ BruzWJ closed this Jun 29, 2026
@BruzWJ BruzWJ reopened this Jun 29, 2026
@BruzWJ

BruzWJ commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai

BruzWJ and others added 4 commits June 29, 2026 00:11
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: BWJ2310 <brucewj2310@gmail.com>
Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
…tion

Update shared entity list contracts to carry enabled state and make rename payloads strict.

Co-authored-by: Codex <codex@openai.com>

Co-authored-by: BWJ2310 <brucewj2310@gmail.com>

Co-authored-by: BWJ2310-backup <jun.1216.wei@gmail.com>
@BruzWJ BruzWJ closed this Jun 29, 2026
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