vmcp optimizer: OpenAI embeddings batch size hardcoded at 2048 — large MCP catalogs send whole-catalog embed requests
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 62/100
Línea de trabajo
Empieza en pkg/vmcp/optimizer/internal/similarity/openai_client.go, donde openAIMaxBatchSize está fijado en 2048 y la solicitud de embed se envía en una sola llamada. Rastrea cómo se pasan las entradas a la solicitud de embeddings y dónde se usa el tamaño del lote. Se considera terminado cuando las solicitudes de embeddings se dividen en fragmentos de un tamaño configurable, con un valor predeterminado pequeño, y una prueba muestra que una lista de entradas grande produce varias solicitudes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Bug description
pkg/vmcp/optimizer/internal/similarity/openai_client.go hardcodes openAIMaxBatchSize = 2048, so the session optimizer embeds an entire aggregated MCP catalog in a single /v1/embeddings request. Against a self-hosted OpenAI-compatible embedding backend, one request with hundreds of inputs can exhaust the server, and the optimizer failure then kills session creation on the gateway entirely — tools/list stops working for every client.
Steps to reproduce
- Run a gateway (
VirtualMCPServer) aggregating MCP servers whose combined catalog is large (ours: 10 servers → 521 tools, ~530 KB of tool name/description/schema text), withoptimizer.embeddingProvider: openaipointed at a self-hosted backend (litellm → OpenVINO Model Server,Qwen3-Embedding-0.6B-int8-ovon an Intel NPU). - Create a session against the gateway.
- The optimizer sends one embed request with 521 input strings.
Observed on the backend: 521 inputs in one request requires ~8.7 GB of transient host memory (per-input hidden states are accumulated before pooling), which exceeds what the box can give a single request; the request fails and the gateway logs failed to list core tools for session for every session (~every 5 min), so no session can be created at all.
Bisected against the backend: 64 inputs/request → OK; 128 inputs/request → fails. Empty input strings are handled fine; the failure is batch-size driven.
Expected behavior
Session creation succeeds. The optimizer should chunk its embedding requests to a size that self-hosted backends can serve, ideally configurable.
Actual behavior
Every session creation fails; the gateway is unusable for any client while the catalog is large, because the embed request is all-or-nothing (one 521-input request, no chunking below the 2048 cap).
Environment (if relevant)
- OS/version: Talos Linux 1.14.7, Kubernetes 1.34
- ToolHive version:
ghcr.io/stacklok/toolhive/vmcp:v0.69.0(deployed via toolhive-operator,VirtualMCPServerCRD withoptimizer.embeddingProvider: openai) - Backend: litellm → OVMS 2026.4.1, Qwen3-Embedding-0.6B-int8-ov, Intel NPU ( Panther Lake, UMA 64 GB)
Additional context
The OpenAI API's 2048-input cap is a hosted-API rate/abuse limit, not a good default for self-hosted backends where per-request input count drives server memory.
Request: make the optimizer's embed batch size configurable in OptimizerConfig / spec.optimizer (e.g. embeddingBatchSize, defaulting small — 32–64). Adaptive chunking on 4xx/5xx would also work, but an explicit knob is simpler and predictable.
- Lenguaje dominante
- Go
- Estrellas
- 2.3k
- Forks
- 335
- Merge medio
- 18 h 4 min
- PR fusionados (30 d)
- 194
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de stacklok/toolhive
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
enhancement telemetry
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
stacklok/toolhive#6925 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
proxyrunner tool-filter middleware strips SEP-2322 Modern envelope from tools/list, breaking vMCP health checksQuizá libre de nuevo @alex-feel la tomó hace 60 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
stacklok/toolhive#6684 · 5 comentarios · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
HttpClientBuilder.Build() ignores HTTP(S)_PROXY (auth-server OAuth/DCR calls bypass forward proxy)Posiblemente ocupada @schonmann la tomó hace 51 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
stacklok/toolhive#6671 · 2 comentarios · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de stacklok/toolhive
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
nebari-dev/llm-serving-pack#270 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area/controller
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
volcano-sh/kthena#2109 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
unbound-force/replicator#193 ·
Los mantenedores suelen responder en 2 días
-
A Gemini stream that fails partway completes the call with the partial textPosiblemente ocupada @bnaylor la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
go-steer/core-agent#1600 ·
Los mantenedores suelen responder en 1 día