feat: move MCP to /mcp and add teammate operations (#500)

* feat(operations): move MCP to /mcp and add search, comment, metadata, version, and upload operations

- Serve the MCP server at /mcp instead of /api/mcp
- Add search_assets, copy_assets, get_folder_instructions, list_comments,
  create_comment, resolve_comment, list_metadata_fields,
  update_asset_metadata, create_version_stack, list_versions, and
  remove_version on the agent, MCP, and CLI
- Add create_file and create_version (agent, MCP) with Creation Context
  metadata, and complete_upload (MCP) for presigned two-step uploads
- Replace the native agent create_file/create_version tools with
  Operation-backed ones
- Route the comment-complete, metadata, copy, version stack, and
  AGENTS.md read REST endpoints through their Operations

* docs(readme): add built-in MCP server and CLI to features list
This commit is contained in:
Yiling-J
2026-10-27 14:37:26 +08:00
committed by GitHub
parent 50fbd97953
commit b3cae4f2b0
81 changed files with 4111 additions and 1397 deletions
@@ -0,0 +1,29 @@
import { z } from 'zod'
import { defineOperation } from '../define'
import { assetSummarySchema } from '../schemas'
export const createVersionStack = defineOperation({
name: 'create_version_stack',
title: 'Create Version Stack',
description:
'Stack existing files in the same folder as versions of one asset, e.g. "cut_v1.mp4" and ' +
'"cut_v2.mp4". The first file in fileIds becomes the current (latest) version. To add a ' +
'newly uploaded file as a version, use create_version instead.',
input: z.object({
fileIds: z
.array(z.string().min(1))
.min(2)
.describe(
'IDs of the files to stack (at least two, all in the same folder), latest version first.',
),
}),
output: assetSummarySchema,
surfaces: ['agent', 'mcp', 'cli'],
annotations: { readOnly: false, destructive: false },
cli: {
command: ['version', 'stack'],
description: 'Stack files in the same folder as versions; the first file is the latest.',
positional: ['fileIds'],
format: (output) => `Created version stack ${output.id}`,
},
})
@@ -0,0 +1,40 @@
import { z } from 'zod'
import { defineOperation } from '../define'
export const versionSummarySchema = z.object({
id: z.string().describe('The file ID of this version.'),
version: z.number().describe('Version number; the highest is the latest.'),
name: z.string(),
current: z.boolean().describe('Whether this is the current (latest) version.'),
createdAt: z.string(),
creator: z.object({ id: z.string(), name: z.string().nullable() }).nullable(),
agent: z
.object({ id: z.string(), name: z.string() })
.nullable()
.describe('The AI agent that created this version, if any.'),
})
export const listVersions = defineOperation({
name: 'list_versions',
title: 'List Versions',
description:
'List the versions in a version stack, latest first. Each version is a file: pass its ID ' +
'to read_asset or list_comments to look at an older version.',
input: z.object({
stackId: z.string().min(1).describe('The version stack ID.'),
}),
output: z.object({
versions: z.array(versionSummarySchema),
}),
surfaces: ['agent', 'mcp', 'cli'],
annotations: { readOnly: true, destructive: false, idempotent: true },
cli: {
command: ['version', 'ls'],
description: 'List the versions in a version stack, latest first.',
positional: ['stackId'],
format: (output) =>
output.versions
.map((v) => `v${v.version}${v.current ? ' (current)' : ''} ${v.id} ${v.name}`)
.join('\n'),
},
})
@@ -0,0 +1,25 @@
import { z } from 'zod'
import { defineOperation } from '../define'
export const removeVersion = defineOperation({
name: 'remove_version',
title: 'Remove Version',
description:
'Take a version out of its version stack. The file is not deleted: it goes back into the ' +
'folder next to the stack as a separate file.',
input: z.object({
versionId: z.string().min(1).describe('The file ID of the version (from list_versions).'),
}),
output: z.object({
versionId: z.string(),
stackId: z.string().describe('The stack the version was removed from.'),
}),
surfaces: ['agent', 'mcp', 'cli'],
annotations: { readOnly: false, destructive: false },
cli: {
command: ['version', 'unstack'],
description: 'Take a version out of its version stack (the file is kept).',
positional: ['versionId'],
format: (output) => `Removed ${output.versionId} from version stack ${output.stackId}`,
},
})