Skip to content

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

TypeScript

fix(control-api): preserve context spec.displayName on mcp-server install allowlist add (R4-B4)

Diego Zacariasfa508ea93c6b
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index e874f5db2..dc1df7cd9 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.442",
+ "version": "0.1.443",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.442",
+ "version": "0.1.443",
"dependencies": {
"@clerum/image-policy": "file:../packages/image-policy",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-api/package.json b/control-api/package.json
index 6492eff89..df2fba24e 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.442",
+ "version": "0.1.443",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/routes/admin/registry.ts b/control-api/src/routes/admin/registry.ts
index f393aea28..2d937d6ca 100644
--- a/control-api/src/routes/admin/registry.ts
+++ b/control-api/src/routes/admin/registry.ts
@@ -1283,14 +1283,18 @@ export function createAdminRegistryRouter(gateway?: K8sGateway): Router {
// must roll back rather than return a false success.
try {
const ctx = (await gateway.getResource('contexts', contextRef)) as {
- spec?: { contextId?: string; description?: string; mcpServers?: string[] }
+ spec?: Record<string, unknown> & {
+ contextId?: string
+ description?: string
+ mcpServers?: string[]
+ }
}
const existing: string[] = ctx.spec?.mcpServers ?? []
if (!existing.includes(serverName)) {
await gateway.updateResource('contexts', contextRef, {
spec: {
+ ...ctx.spec,
contextId: ctx.spec?.contextId ?? contextRef,
- description: ctx.spec?.description,
mcpServers: [...existing, serverName],
} as Record<string, unknown>,
})
diff --git a/control-api/test/routes.registryInstall.test.ts b/control-api/test/routes.registryInstall.test.ts
index 1ddf306a2..008ff53b2 100644
--- a/control-api/test/routes.registryInstall.test.ts
+++ b/control-api/test/routes.registryInstall.test.ts
@@ -1393,6 +1393,40 @@ describe('POST /admin/registry/install', () => {
})
.expect(404)
})
+
+ it('installing an McpServer preserves spec.displayName on the target context (R4-B4)', async () => {
+ vi.mocked(getEntryVersion).mockResolvedValueOnce(MOCK_ENTRY)
+ vi.mocked(getCredentialSchema).mockResolvedValueOnce(MOCK_SCHEMA_NONE)
+ vi.mocked(reportInstall).mockResolvedValueOnce({ acknowledged: true, stored: true })
+
+ const gw = new MockGateway('mcp-server')
+ // Seed a context that ALREADY carries displayName plus an existing allowlist
+ // entry — displayName is the additive field the allowlist update must not
+ // drop when it rebuilds the context spec.
+ await gw.createResource('contexts', {
+ metadata: { name: 'ctx-keep' },
+ spec: { contextId: 'ctx-keep', mcpServers: ['srv-other'], displayName: 'Keep Me' },
+ })
+ const app = makeApp(gw)
+
+ await request(app)
+ .post('/admin/registry/install')
+ .send({
+ serverName: 'my-airtable',
+ contextRef: 'ctx-keep',
+ registryEntryName: 'airtable-mcp',
+ registryEntryVersion: '1.0.0',
+ })
+ .expect(201)
+
+ // Observable result (T4): re-read the persisted context. displayName survived
+ // and the new server joined the allowlist alongside the pre-existing one.
+ const ctx = (await gw.getResource('contexts', 'ctx-keep', 'mcp-server')) as {
+ spec: { displayName?: string; mcpServers?: string[] }
+ }
+ expect(ctx.spec.displayName).toBe('Keep Me')
+ expect(ctx.spec.mcpServers).toEqual(['srv-other', 'my-airtable'])
+ })
})
describe('POST /admin/registry/install — image allowlist enforce (2.3)', () => {