feat(api): add v2 endpoints for MCP servers, skills, custom tools, folders, and credentials - #6150
Conversation
…lders, and credentials
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryHigh Risk Overview Secrets stay write-only on read — MCP headers surface as Session routes are centralized — credential create/list moves into Docs add Reviewed by Cursor Bugbot for commit 2b33a0e. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR adds public v2 CRUD endpoints and OpenAPI documentation for MCP servers, skills, custom tools, folders, and credentials, while extracting shared credential and skill orchestration.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the credential-role issue is fixed, and the folder-lock thread concerned unchanged behavior already reachable through the existing route.
|
| Filename | Overview |
|---|---|
| apps/sim/app/api/v2/credentials/route.ts | Adds credential list/create endpoints and now resolves the actual authorization role for idempotently matched credentials. |
| apps/sim/lib/credentials/orchestration/credential-create.ts | Centralizes credential creation, idempotent source matching, membership creation, and provider-specific validation. |
| apps/sim/app/api/v2/folders/[id]/route.ts | Adds workspace-scoped folder read, update, and cascade-delete handlers using the existing lifecycle implementation. |
| apps/sim/lib/skills/orchestration/skill-lifecycle.ts | Centralizes skill validation and lifecycle behavior so API and copilot callers share the same constraints. |
| apps/docs/openapi-v2-resources.json | Documents the 25 public resource operations, request contracts, secret-redacted response shapes, and standard API errors. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Client[API client] --> Auth[API-key and workspace authorization]
Auth --> V2[Public v2 resource routes]
V2 --> MCP[MCP servers]
V2 --> Skills[Skills]
V2 --> Tools[Custom tools]
V2 --> Folders[Folders]
V2 --> Credentials[Credentials]
Skills --> SkillLifecycle[Shared skill orchestration]
Credentials --> CredentialLifecycle[Shared credential orchestration]
MCP --> DB[(Workspace data)]
SkillLifecycle --> DB
Tools --> DB
Folders --> DB
CredentialLifecycle --> DB
Specs[OpenAPI resource specification] -. documents .-> V2
Reviews (6): Last reviewed commit: "fix(credentials): use the shared outage ..." | Re-trigger Greptile
…tity, and custom-tool conflict mapping
|
@cursor review |
…nd unique-violation conflicts
|
@cursor review |
|
@cursor review |
|
@cursor review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 2b33a0e. Configure here.
Brings the five new v2 resource families (MCP servers, skills, custom tools, folders, credentials) from #6150 onto the branch, alongside the boundary-ratchet fix. Both sides edited the ratchet script in different places; the combined baselines are re-verified below.
#6150 branched before #6134, so skill-lifecycle.ts imports @/lib/workflows/orchestration/types — the module #6134 moved to @/lib/core/orchestration/types. Git merged a file deletion on one side with a new file referencing it on the other: no textual conflict, broken build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…sting them Merges `v2-api-spec` (#6150 — v2 endpoints for MCP servers, skills, custom tools, folders, credentials) and the newer `improvement/v2-endpoints`. ## The generator was list-driven, so none of it would have appeared `DOMAINS` and `SPEC_FILES` were hardcoded. Five new contract modules and a new `openapi-v2-resources.json` had landed, and the generator would have skipped every one — silently, with `--check` still passing, because the generated file matched a generator that never looked. Both are now discovered from disk. That is the same silent-drop class the review rounds kept surfacing, and it is the property the whole pipeline rests on: a new v2 domain should reach the CLI by regenerating, not by remembering to edit a list. Result: 47 → 72 operations, 13 contract modules, and 25 new commands (`sim skills list`, `sim mcp-servers get`, `sim folders delete`, …) with no CLI change beyond the discovery fix. Summaries for the new domains now resolve too, so their `--help` reads properly instead of falling back to `METHOD /path`. ## Confirmation gates for the new destructive operations Five new DELETEs arrived ungated. `deleteFolder` is the sharpest — the route archives the folder *and cascades to its contents* — so its message says so rather than reading like a single-item removal. Added a test asserting every DELETE carries a confirmation, with `undeployWorkflow` the one documented exception (reversible by redeploying). It fails against this commit's own starting state, so the next domain to arrive cannot land ungated the way these did. ## One fix outside the CLI `lib/skills/orchestration/skill-lifecycle.ts`, added by #6150, imports `OrchestrationErrorCode` from `@/lib/workflows/orchestration/types`, which does not exist — the type lives in `@/lib/core/orchestration/types`, where every other consumer reads it. The branch does not type-check without this. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsThUPqZXjwuuyRjBbmVkj
Summary
hasHeaders+headerNames(never values); credential secrets return ashasServiceAccountKey. These shapes were built for a browser session — over an API key the old ones were a token-exfiltration primitive.409on a duplicate URL, checked before the lib's upsert can overwrite the existing server.{{ENV_VAR}}URLs are rejected (they skip the domain allowlist and SSRF resolve, so over a key that's a stored SSRF path), bodies are strict, andurlmust be an absolute http(s) URL.lib/skills/orchestration/andlib/credentials/orchestration/credential-create.ts, then repoints the existing session routes and copilotmanage_skillat them. Skill field limits used to live only in the route's Zod contract, so copilot bypassed them entirely — now every caller gets the same rules.app/api/credentials/route.tswent 720 → 205 lines.apps/docs/openapi-v2-resources.json(5 tags, 25 operations), registered in bothSPEC_FILESlists and all 6 localemeta.jsons.Type of Change
Testing
bun run type-check✅,check:openapi✅ (7 specs, 82 operations, 73 contracts cross-checked),check:api-validation✅ (route baseline 1028 → 1038),lint:check✅vitest app/api/v2 lib/skills app/api/skills app/api/credentials app/api/folders app/api/tools lib/copilot→ 1412 passed{{ENV}}/file://→ 400, built-in skill name → 400, custom-tool rename collision → 409, folder cascade counts, credential idempotent re-create returning the same id. Auth: no key → 401, bad key → 401, foreign workspace → 403. All test artifacts cleaned up.Notes for review
check:api-validation:strictfails on this branch, but not because of this PR. ThedoubleCastsratchet reads 9 vs a baseline of 8; all nine live in files this diff never touches (tools/hosting.ts,contracts/tables.ts,executor/utils/errors.ts,packages/logger,packages/ts-sdk) and all are present at the base commit. improvement(external-endpoints): v2 versions with clean signatures + updated docs based on openapi spec #5273's ownLint and Testis already FAILURE for the same reason. I did not bump the baseline — that would hide an existing regression inside an unrelated PR. Happy to bump it if you'd rather have green CI here.oauth(needs an internalaccount.idfrom the browser flow); create always returns201including the idempotent source replay, because the OpenAPI checker only validates the numerically-smallest 2xx; folders requireresourceTypeexplicitly rather than defaulting toworkflow; the skills list omitscontent(50k chars each) in favour of the detail endpoint;/api/skillsPOST is no longer a single transaction — it applies per item so one authority owns the rules.Checklist