Skip to content

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

TypeScript

feat(mcp-host): register the grok image family and Grok source identity

Alfredo Lopezfca7ac628942
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 69a172cf9..cf4ea675d 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.441",
+ "version": "0.1.442",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.441",
+ "version": "0.1.442",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index efdd06341..7c2897178 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.441",
+ "version": "0.1.442",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/llm/grokSubscription.ts b/mcp-host/src/llm/grokSubscription.ts
index 3adfd3a2d..19612fa27 100644
--- a/mcp-host/src/llm/grokSubscription.ts
+++ b/mcp-host/src/llm/grokSubscription.ts
@@ -16,7 +16,7 @@ import { logger } from '../logger'
import { classifyUnknown } from './errorClassification'
import { GrokLlmProxyClient, GrokProxyError } from './grokLlmProxyClient'
import { CodexAuthorizeError, ProviderAttemptAuthorizer } from './providerAttemptAuthorizer'
-import type { LlmProvider } from './registryCore'
+import { type LlmProvider, descriptorFor } from './registryCore'
import type { ClassifiedError, SingleTurnProvider } from './types'
export type GrokAttemptContext = {
@@ -159,6 +159,8 @@ function assertTerminalGrokOutcome(result: {
}
export class GrokSubscriptionProvider implements SingleTurnProvider {
+ readonly requiresImageSourceIdentity =
+ descriptorFor('grok-subscription').requiresImageSourceIdentity === true
private nextProviderAttemptIndex = 1
constructor(
diff --git a/mcp-host/src/llm/imageInput.ts b/mcp-host/src/llm/imageInput.ts
index 1020902b7..d1553d8a3 100644
--- a/mcp-host/src/llm/imageInput.ts
+++ b/mcp-host/src/llm/imageInput.ts
@@ -19,6 +19,7 @@
* vertex yes yes n/a user
* bedrock yes yes n/a user
* codex-subscription yes yes n/a user
+ * grok-subscription yes yes n/a user
*
* `complete` is the tool-less, cache-less path (`completeSingleTurn`): OpenAI,
* OpenAI-compatible and Azure rebuild `role/content` and drop `contentParts`,
@@ -79,6 +80,7 @@ export type ImageWireFamily =
| 'vertex'
| 'bedrock'
| 'codex'
+ | 'grok'
/**
* No covered serializer exists for this id (unknown string, or a registered
* provider with no factory arm we have proven). Every capability answer is
@@ -100,6 +102,7 @@ const EXPLICIT_DRIVER_FAMILY: Readonly<Record<string, ImageWireFamily>> = {
bedrock: 'bedrock',
azure: 'openai-compatible',
'codex-subscription': 'codex',
+ 'grok-subscription': 'grok',
}
export function imageWireFamilyFor(providerType: string): ImageWireFamily {
@@ -147,6 +150,14 @@ const TRANSPORT_SUPPORT: Readonly<
completeAndCache: false,
completeWithToolsAndCache: false,
},
+ // #784: Grok V2 carries ordered user image parts on the same two paths.
+ // Cache variants are not implemented on this transport.
+ grok: {
+ complete: true,
+ completeWithTools: true,
+ completeAndCache: false,
+ completeWithToolsAndCache: false,
+ },
unregistered: {
complete: false,
completeWithTools: false,
@@ -161,6 +172,7 @@ const IMAGE_ROLES_BY_FAMILY: Readonly<Record<ImageWireFamily, readonly MessageRo
vertex: ['user'],
bedrock: ['user'],
codex: ['user'],
+ grok: ['user'],
unregistered: [],
}
@@ -248,6 +260,9 @@ export interface ImageInputRequestFacts {
* omission — callers must not pass `capability === undefined` unless they have
* a row. Curated `unsupported` / dated evidence still wins. Never invent
* models.dev rows.
+ *
+ * #784 applies the same rule to Grok Subscription: the recorded Grok catalog
+ * carries no modality field either.
*/
export function resolveHostImageInput(
providerType: string,
@@ -255,8 +270,9 @@ export function resolveHostImageInput(
options: { transportSupported: boolean; now?: number }
): ImageInputDecision {
const decision = resolveImageInputCapability(capability, options)
+ const family = imageWireFamilyFor(providerType)
if (
- imageWireFamilyFor(providerType) === 'codex' &&
+ (family === 'codex' || family === 'grok') &&
options.transportSupported === true &&
capability === undefined &&
decision.state === 'unknown' &&
diff --git a/mcp-host/src/llm/registryCore.ts b/mcp-host/src/llm/registryCore.ts
index 592ddeafa..339584ded 100644
--- a/mcp-host/src/llm/registryCore.ts
+++ b/mcp-host/src/llm/registryCore.ts
@@ -236,6 +236,7 @@ const RUNTIME_FIELDS: Record<LlmProvider, RuntimeProviderFields> = {
},
'grok-subscription': {
tokenizer: 'fallback',
+ requiresImageSourceIdentity: true,
maxMessages: GROK_CONTRACT_LIMITS.maxMessages,
defaultContextWindowTokens: SUBSCRIPTION_DEFAULT_CONTEXT_WINDOW_TOKENS,
},