Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-api): r1-l2 make McpServer fixtures CRD-valid

Diego Zacarias79e46a1f80a7
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index c32255081..7598627b7 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.744",
+ "version": "0.1.745",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.744",
+ "version": "0.1.745",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",
diff --git a/control-api/package.json b/control-api/package.json
index e855de6fa..d7791d50f 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.744",
+ "version": "0.1.745",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/test/routes.internal.mcpOauthAuthorizeUrl.test.ts b/control-api/test/routes.internal.mcpOauthAuthorizeUrl.test.ts
index cb11117ab..851e178bd 100644
--- a/control-api/test/routes.internal.mcpOauthAuthorizeUrl.test.ts
+++ b/control-api/test/routes.internal.mcpOauthAuthorizeUrl.test.ts
@@ -59,6 +59,8 @@ function seedOauthServer(
metadata: { name: opts.name },
spec: {
contextRef: opts.contextRef ?? 'ctx-9',
+ image: 'example/gdrive-mcp:1',
+ transport: { type: 'streamableHttp', url: 'https://gdrive.example.com/mcp' },
auth: { type: 'oauth' },
oauth: {
id: 'google-drive',
@@ -277,40 +279,6 @@ describe('POST /api/v1/internal/mcp-oauth/authorize-url (U5)', () => {
expect(res.body.authorizeUrl).toBeUndefined()
})
- it('user flavor: a server WITHOUT contextRef that an allowlist enables mints OK', async () => {
- void gateway.createResource(
- 'mcpservers',
- {
- metadata: { name: 'gdrive' },
- spec: {
- auth: { type: 'oauth' },
- oauth: {
- id: 'google-drive',
- provider: 'google',
- clientIdRef: { name: 'google-creds', key: 'client-id' },
- clientSecretRef: { name: 'google-creds', key: 'client-secret' },
- grantScope: 'user',
- },
- },
- },
- MCP_NS
- )
- gateway.seedSecret('google-creds', MCP_NS, {
- data: {
- 'client-id': Buffer.from('GOOGLE_CLIENT_ID').toString('base64'),
- 'client-secret': Buffer.from('GOOGLE_CLIENT_SECRET').toString('base64'),
- },
- })
- await seedAllowlistedContext(gateway, 'ctx-business', ['gdrive'])
- membership(mockPoolQuery, { contexts: { 'user-7': ['ctx-business'] } })
- const res = await post(app)
- .set('Authorization', 'Bearer dev-rpc-proxy-token')
- .set('x-service-token', 'rpc-proxy')
- .send({ mcpServerName: 'gdrive', userId: 'user-7' })
- expect(res.status).toBe(200)
- expect(res.body.authorizeUrl).toContain('https://accounts.google.com/')
- })
-
// The server's own Context dropped it; the user still reaches a Context that
// allowlists it through an assigned agent, which is where the connectors
// panel offers it.
diff --git a/control-api/test/routes.internal.mcpOauthDisconnect.test.ts b/control-api/test/routes.internal.mcpOauthDisconnect.test.ts
index 1392cfd89..96a57fd86 100644
--- a/control-api/test/routes.internal.mcpOauthDisconnect.test.ts
+++ b/control-api/test/routes.internal.mcpOauthDisconnect.test.ts
@@ -67,6 +67,8 @@ function seedOauthServer(
metadata: { name: opts.name },
spec: {
contextRef: opts.contextRef ?? 'ctx-9',
+ image: 'example/gdrive-mcp:1',
+ transport: { type: 'streamableHttp', url: 'https://gdrive.example.com/mcp' },
auth: { type: 'oauth' },
oauth: {
id: 'google-drive',
@@ -209,31 +211,6 @@ describe('DELETE /api/v1/internal/mcp-oauth/grant (spec 11 U4)', () => {
expect(membershipQuery).toBeUndefined()
})
- it('user flavor: a server WITHOUT contextRef can be disconnected', async () => {
- void gateway.createResource(
- 'mcpservers',
- {
- metadata: { name: 'gdrive' },
- spec: {
- auth: { type: 'oauth' },
- oauth: {
- id: 'google-drive',
- provider: 'google',
- clientIdRef: { name: 'google-creds', key: 'client-id' },
- clientSecretRef: { name: 'google-creds', key: 'client-secret' },
- grantScope: 'user',
- },
- },
- },
- MCP_NS
- )
- mockDb({ memberContexts: [] })
- const res = await del(app).send({ mcpServerName: 'gdrive', userId: 'user-7' })
- expect(res.status).toBe(204)
- expect(deleteCalls()).toHaveLength(1)
- expect(deleteCalls()[0][1]).toEqual(['mcpserver', MCP_NS, 'gdrive', 'user-7', 'google-drive'])
- })
-
// Existence and oauth-ness are still answered before any flavor-specific
// branch, for a user-flavor caller with no Contexts as for anyone else.
it('user flavor ordering: unknown server → 404 and non-oauth → 400, with no delete', async () => {
@@ -244,7 +221,15 @@ describe('DELETE /api/v1/internal/mcp-oauth/grant (spec 11 U4)', () => {
void gateway.createResource(
'mcpservers',
- { metadata: { name: 'plain' }, spec: { auth: { type: 'none' } } },
+ {
+ metadata: { name: 'plain' },
+ spec: {
+ contextRef: 'ctx-9',
+ image: 'example/plain-mcp:1',
+ transport: { type: 'streamableHttp', url: 'https://plain.example.com/mcp' },
+ auth: { type: 'none' },
+ },
+ },
MCP_NS
)
const plain = await del(app).send({ mcpServerName: 'plain', userId: 'user-8' })
diff --git a/control-api/test/routes.oauthCallback.userAccessGate.test.ts b/control-api/test/routes.oauthCallback.userAccessGate.test.ts
index eb1a617e1..14f914f3a 100644
--- a/control-api/test/routes.oauthCallback.userAccessGate.test.ts
+++ b/control-api/test/routes.oauthCallback.userAccessGate.test.ts
@@ -42,6 +42,8 @@ async function seedUserScopedOauthServer(gateway: MockGateway): Promise<void> {
metadata: { name: SERVER },
spec: {
contextRef: OWNER_CONTEXT,
+ image: 'example/gdrive-mcp:1',
+ transport: { type: 'streamableHttp', url: 'https://gdrive.example.com/mcp' },
auth: { type: 'oauth' },
oauth: {
id: OAUTH_CLIENT_ID,