mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-28 20:04:26 +00:00
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:
@@ -15,17 +15,31 @@ describe('operation registry', () => {
|
||||
expect(new Set(names).size).toBe(names.length)
|
||||
})
|
||||
|
||||
it('contains the asset and project operations', () => {
|
||||
it('contains the asset, project, comment, metadata, version, and upload operations', () => {
|
||||
expect(operationDefinitions.map((d) => d.name).sort()).toEqual([
|
||||
'complete_upload',
|
||||
'copy_assets',
|
||||
'create_comment',
|
||||
'create_file',
|
||||
'create_folder',
|
||||
'create_version',
|
||||
'create_version_stack',
|
||||
'delete_asset',
|
||||
'download_asset',
|
||||
'get_asset_render',
|
||||
'get_folder_instructions',
|
||||
'list_assets',
|
||||
'list_comments',
|
||||
'list_metadata_fields',
|
||||
'list_projects',
|
||||
'list_versions',
|
||||
'move_assets',
|
||||
'read_asset',
|
||||
'remove_version',
|
||||
'rename_asset',
|
||||
'resolve_comment',
|
||||
'search_assets',
|
||||
'update_asset_metadata',
|
||||
])
|
||||
})
|
||||
|
||||
@@ -50,12 +64,29 @@ describe('operation registry', () => {
|
||||
expect(readOnly.map((d) => d.name).sort()).toEqual([
|
||||
'download_asset',
|
||||
'get_asset_render',
|
||||
'get_folder_instructions',
|
||||
'list_assets',
|
||||
'list_comments',
|
||||
'list_metadata_fields',
|
||||
'list_projects',
|
||||
'list_versions',
|
||||
'read_asset',
|
||||
'search_assets',
|
||||
])
|
||||
})
|
||||
|
||||
it('exposes uploads on the agent and MCP only, and complete_upload on MCP only', () => {
|
||||
// The CLI uploads with its own `upload` and `create-version` commands, and the agent's
|
||||
// create tools complete their uploads themselves.
|
||||
const surfaces = (name: string) => getOperationDefinition(name)?.surfaces
|
||||
expect(surfaces('create_file')).toEqual(['agent', 'mcp'])
|
||||
expect(surfaces('create_version')).toEqual(['agent', 'mcp'])
|
||||
expect(surfaces('complete_upload')).toEqual(['mcp'])
|
||||
const cli = getOperationDefinitionsForSurface('cli').map((d) => d.name)
|
||||
expect(cli).not.toContain('create_file')
|
||||
expect(cli).not.toContain('complete_upload')
|
||||
})
|
||||
|
||||
it.each(operationDefinitions.map((d) => [d.name, d] as const))(
|
||||
'%s exports an object JSON Schema with described fields',
|
||||
(_name, definition) => {
|
||||
@@ -85,20 +116,30 @@ describe('operation registry', () => {
|
||||
)
|
||||
|
||||
it('keeps legacy CLI invocations mapped', () => {
|
||||
const commands = operationDefinitions.map((d) => [
|
||||
d.name,
|
||||
[...(d.cli?.command ?? []), ...(d.cli?.aliases ?? [])],
|
||||
])
|
||||
const commands = operationDefinitions
|
||||
.filter((d) => d.cli)
|
||||
.map((d) => [d.name, [...(d.cli?.command ?? []), ...(d.cli?.aliases ?? [])]])
|
||||
expect(commands).toEqual([
|
||||
['list_projects', ['project', 'ls']],
|
||||
['list_assets', ['ls']],
|
||||
['search_assets', ['search']],
|
||||
['create_folder', ['mkdir']],
|
||||
['rename_asset', ['rename']],
|
||||
['move_assets', ['move', 'mv']],
|
||||
['copy_assets', ['copy', 'cp']],
|
||||
['delete_asset', ['delete', 'rm']],
|
||||
['read_asset', ['read']],
|
||||
['get_asset_render', ['render']],
|
||||
['download_asset', ['download']],
|
||||
['get_folder_instructions', ['instructions']],
|
||||
['list_comments', ['comment', 'ls']],
|
||||
['create_comment', ['comment', 'add']],
|
||||
['resolve_comment', ['comment', 'resolve']],
|
||||
['list_metadata_fields', ['field', 'ls']],
|
||||
['update_asset_metadata', ['meta', 'set']],
|
||||
['create_version_stack', ['version', 'stack']],
|
||||
['list_versions', ['version', 'ls']],
|
||||
['remove_version', ['version', 'unstack']],
|
||||
])
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user