mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-29 04:14:30 +00:00
feat(mcp): serve Operations over MCP and a generic /api/ops endpoint (#495)
Add a stateless Streamable HTTP MCP server at /api/mcp that exposes every mcp-surface Operation with its input/output schemas and annotations, and POST /api/ops/:name for the CLI. Both require an API token (session cookies are rejected), run Operations as the token's user, honor demo read-only mode, and record via mcp/cli/api in audit logs. Also make list_projects toggleable in agent settings and document MCP client setup.
This commit is contained in:
@@ -11,8 +11,10 @@ import inviteRoute from './invite'
|
||||
import metadataRoute from './metadata'
|
||||
import mcpRoute, { mcpOauthCallbackRoute } from './mcp'
|
||||
import { authMiddleware } from './middleware/auth'
|
||||
import { tokenAuthMiddleware } from './middleware/tokenAuth'
|
||||
import { requireApiTokenMiddleware, tokenAuthMiddleware } from './middleware/tokenAuth'
|
||||
import mcpServerRoute from './mcp-server'
|
||||
import notificationRoute from './notification'
|
||||
import operationsRoute from './operations'
|
||||
import projectRoute from './project'
|
||||
import providerRoute from './provider'
|
||||
import publicInviteRoute from './public-invite'
|
||||
@@ -40,6 +42,12 @@ const apiRoute = new Hono<{ Variables: { user: User } }>()
|
||||
.route('/', localUploadRoute)
|
||||
.route('/', mcpOauthCallbackRoute)
|
||||
|
||||
// Programmatic endpoints: API token required, session cookies not accepted
|
||||
.use('/ops/*', requireApiTokenMiddleware)
|
||||
.use('/mcp', requireApiTokenMiddleware)
|
||||
.route('/', operationsRoute)
|
||||
.route('/', mcpServerRoute)
|
||||
|
||||
// Selected routes supporting API token authentication
|
||||
.use('/projects', tokenAuthMiddleware)
|
||||
.use('/projects/*', tokenAuthMiddleware)
|
||||
|
||||
Reference in New Issue
Block a user