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
+14 -35
View File
@@ -3,6 +3,7 @@ import { zValidator } from '@hono/zod-validator'
import { versionStackService } from '@shumai/core/src/versionStack/versionStack'
import { assetService } from '@shumai/core/src/asset/asset'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { createVersionStackOp, removeVersionOp, runOperation } from '@shumai/core/src/operations'
import { createVersionStackRequestSchema, changeStackFileVersionRequestSchema } from '@shumai/dtos'
import type { Prisma } from '@shumai/db'
@@ -15,26 +16,14 @@ const route = app
'/projects/:projectId/version_stacks',
zValidator('json', createVersionStackRequestSchema),
async (c) => {
const projectId = c.req.param('projectId')
const user = c.get('user')
const req = c.req.valid('json')
await authzService.hasPermission({
user,
permission: Permission.Edit,
type: ResourceType.Project,
id: projectId,
})
const stack = await versionStackService.createVersionStack({
fileIds: req.fileIds,
projectId,
creatorId: user.id,
})
const stackInfo = await assetService.getAsset({ assetId: stack.id })
return c.json(stackInfo)
// Authorization and the stack's project come from the files, not the path.
const stack = await runOperation(
createVersionStackOp,
{ userId: c.get('user').id, via: 'api' },
{ fileIds: req.fileIds },
)
return c.json(await assetService.getAsset({ assetId: stack.id }))
},
)
.post(
@@ -76,22 +65,12 @@ const route = app
return c.json(versions)
})
.delete('/version_stacks/:stackId/versions/:versionId', async (c) => {
const stackId = c.req.param('stackId')
const versionId = c.req.param('versionId')
const user = c.get('user')
await authzService.hasPermission({
user,
permission: Permission.Edit,
type: ResourceType.Asset,
id: stackId,
})
await versionStackService.removeVersionFromStack({
stackId,
fileId: versionId,
})
// The stack is the version's parent; the path's stackId is not needed.
await runOperation(
removeVersionOp,
{ userId: c.get('user').id, via: 'api' },
{ versionId: c.req.param('versionId') },
)
return new Response(null, { status: 200 })
})