Add hosted MCP endpoint at POST /mcp for remote agents.
Bearer-auth JSON-RPC exposes engines, generate, and job tools without duplicating the aigen API path. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -48,13 +48,20 @@ test('aigen generate request validates like Studio 2 with recommended krea steps
|
||||
})
|
||||
|
||||
test('aigen routes exist, stay on the studio-2 enqueue path, and 404 on xAIGen', () => {
|
||||
const generate = readFileSync(join(root, 'server/api/aigen/generate.post.ts'), 'utf8')
|
||||
const job = readFileSync(join(root, 'server/api/aigen/jobs/[id].get.ts'), 'utf8')
|
||||
const generateRoute = readFileSync(join(root, 'server/api/aigen/generate.post.ts'), 'utf8')
|
||||
const generate = readFileSync(join(root, 'server/utils/aigenGenerate.ts'), 'utf8')
|
||||
const jobRoute = readFileSync(join(root, 'server/api/aigen/jobs/[id].get.ts'), 'utf8')
|
||||
const job = readFileSync(join(root, 'server/utils/aigenJob.ts'), 'utf8')
|
||||
const auth = readFileSync(join(root, 'server/utils/aigenApi.ts'), 'utf8')
|
||||
const authPaths = readFileSync(join(root, 'server/utils/aigenApiAuth.ts'), 'utf8')
|
||||
const middleware = readFileSync(join(root, 'server/middleware/auth.ts'), 'utf8')
|
||||
const mcp = readFileSync(join(root, 'server/routes/mcp.ts'), 'utf8')
|
||||
const mcpUtil = readFileSync(join(root, 'server/utils/aigenMcp.ts'), 'utf8')
|
||||
const nuxt = readFileSync(join(root, 'nuxt.config.ts'), 'utf8')
|
||||
const bench = readFileSync(join(root, 'components/studio2/Bench.vue'), 'utf8')
|
||||
|
||||
assert.match(generateRoute, /queueAigenGenerate/)
|
||||
assert.match(jobRoute, /readAigenJob/)
|
||||
assert.match(generate, /assertAigenApiAccess/)
|
||||
assert.match(generate, /validateRequest/)
|
||||
assert.match(generate, /addStudioJob/)
|
||||
@@ -65,11 +72,20 @@ test('aigen routes exist, stay on the studio-2 enqueue path, and 404 on xAIGen',
|
||||
assert.match(auth, /assertAigenFeature/)
|
||||
assert.match(job, /stillUrl/)
|
||||
assert.match(job, /stillId/)
|
||||
assert.match(job, /stillAbsoluteUrl/)
|
||||
assert.match(middleware, /aigenBearerAuthorized/)
|
||||
assert.match(middleware, /aigenApiPathAllowed/)
|
||||
assert.match(authPaths, /path === '\/mcp'/)
|
||||
assert.match(mcp, /assertAigenApiAccess/)
|
||||
assert.match(mcp, /tools\/list/)
|
||||
assert.match(mcp, /tools\/call/)
|
||||
assert.match(mcpUtil, /aigen_engines/)
|
||||
assert.match(mcpUtil, /aigen_generate/)
|
||||
assert.match(mcpUtil, /aigen_job/)
|
||||
assert.match(mcpUtil, /queueAigenGenerate/)
|
||||
assert.match(mcpUtil, /readAigenJob/)
|
||||
assert.match(nuxt, /aigenApiKey:\s*process\.env\.AIGEN_API_KEY/)
|
||||
assert.match(bench, /studio2EngineDefaults/)
|
||||
assert.match(generate, /assertAigenApiAccess/)
|
||||
})
|
||||
|
||||
test('defaultLibraryFolderId prefers Inbox then the first folder', () => {
|
||||
|
||||
Reference in New Issue
Block a user