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
+11 -18
View File
@@ -4,9 +4,8 @@ import projectRoute from './project'
import { authzService, Permission, ResourceType } from '@shumai/core/src/authz/authz'
import { projectService } from '@shumai/core/src/project/project'
import { assetService } from '@shumai/core/src/asset/asset'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import type { ProjectInfo } from '@shumai/dtos'
import { moveAssetsOp, runOperation } from '@shumai/core/src/operations'
import { copyAssetsOp, moveAssetsOp, runOperation } from '@shumai/core/src/operations'
vi.mock('./middleware/auth', () => ({
authMiddleware: async (
@@ -209,9 +208,11 @@ describe('project api', () => {
)
})
it('POST /projects/:projectId/copy', async () => {
vi.mocked(projectService.getProjectTeam).mockResolvedValue('t1')
vi.mocked(assetService.copyAssets).mockResolvedValue(undefined)
it('POST /projects/:projectId/copy runs copy_assets', async () => {
vi.mocked(runOperation).mockResolvedValue({
copiedAssetIds: ['copy_1'],
newParentId: 'new_parent_id',
})
const res = await app.request('/projects/p/copy', {
method: 'POST',
@@ -223,19 +224,11 @@ describe('project api', () => {
})
expect(res.status).toBe(204)
expect(assetService.copyAssets).toHaveBeenCalledWith({
newParentId: 'new_parent_id',
assetIds: ['asset_1'],
withComments: false,
creatorId: 'user1',
})
expect(auditLogService.logAction).toHaveBeenCalledWith({
action: 'asset_copy',
teamId: 't1',
userId: 'user1',
projectId: 'p',
itemId: 'asset_1',
})
expect(runOperation).toHaveBeenCalledWith(
copyAssetsOp,
{ userId: 'user1', via: 'api' },
{ assetIds: ['asset_1'], newParentId: 'new_parent_id', withComments: false },
)
})
it('POST /projects/:projectId/empty-trash', async () => {