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
+62
View File
@@ -0,0 +1,62 @@
import type { CommentInfo } from '@shumai/dtos'
import { assetService } from '@shumai/core/src/asset/asset'
import { notificationService } from '@shumai/core/src/notification/notification'
export interface PostCommentParams {
assetId: string
userId: string
message: string
replyToId?: string
/** Markup drawn on the frame or page (web app only). */
annotations?: unknown
/** Timecode in seconds (or the encoded viewing angle for 3D models). */
second?: number
attachmentIds?: string[]
/** Whether mentions of agents start a chat with them (default true). */
triggerAgents?: boolean
}
export class CommentService {
/**
* Posts a comment or reply and notifies the people involved: team members for a new
* comment, the thread's author for a reply, and anyone mentioned.
*/
async postComment(params: PostCommentParams): Promise<CommentInfo> {
const comment = await assetService.createComment(
{
assetId: params.assetId,
userId: params.userId,
replyToId: params.replyToId,
message: params.message,
annotations: params.annotations,
second: params.second,
attachmentIds: params.attachmentIds ?? [],
},
{ triggerAgents: params.triggerAgents },
)
const context = await assetService.getAssetContext(params.assetId)
let targetUserId: string | undefined
if (params.replyToId) {
const parentComment = await assetService.getComment(params.replyToId).catch(() => null)
if (parentComment?.creator?.id) {
targetUserId = parentComment.creator.id
}
}
// Delivery happens in the background; this only schedules it.
await notificationService.create({
type: params.replyToId ? 'reply_created' : 'comment_created',
teamId: context.teamId,
creatorId: params.userId,
assetId: params.assetId,
userId: targetUserId,
commentMessage: params.message,
})
return comment
}
}
export const commentService = new CommentService()