step mcp add accepts server names that produce invalid MCP tool names
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
- 75/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- nodejs, typescript
- Área
- backend-api-design, cli
Línea de trabajo
El problema está en apps/cli/src/main.ts, donde el comando step mcp add acepta nombres de servidor sin validación. Compara con sanitizeServerName en packages/coding-agent/src/step/mcp-import.ts. La solución debe validar o sanitizar el nombre del servidor para que coincida con el conjunto de caracteres del nombre de la herramienta ([a-zA-Z0-9_-]). Prueba agregando un servidor con un nombre no válido y verifica que sea rechazado o sanitizado, y que los nombres de herramientas resultantes (por ejemplo, my.server__hello) sean válidos.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happened?
step mcp add accepts any string as the server name — no charset or length validation. That name is then used verbatim as the model-facing tool-name prefix: packages/coding-agent/src/step/mcp.ts:461 builds
const name = `${server.name}__${sanitizeName(remote.name)}`;
The remote tool name is sanitized; the server name is not, and the provider layer sends it through unchanged. A server added as my.server therefore registers tools like my.server__hello, which violates the tool-name charset both wire protocols require (OpenAI ^[a-zA-Z0-9_-]{1,64}$, Anthropic ^[a-zA-Z0-9_-]{1,128}$). Once such a server connects, every request fails with an API error that doesn't point at the config entry.
The MCP import path already enforces exactly this invariant — sanitizeServerName in packages/coding-agent/src/step/mcp-import.ts, with a comment saying the server name is "restricted to what a tool name may contain". step mcp add (in apps/cli/src/main.ts) is the one path that skips it. Long names can also push server__tool past the 64-char limit.
Steps to reproduce
step mcp add "my.server" -- npx -y some-mcp-server # accepted, stored as-is
step mcp list
cat ~/.stepcode/config.toml
Verified on 0.1.0 built from source (main @ cb5fc14): names like my server/x and my.server demo are accepted and written to config.toml unchanged, and createRemoteTool registers <name>__<tool> with the raw prefix. The TUI /mcp command and the plugin marketplace are not affected — step mcp add is the only unvalidated write path.
Expected behavior
step mcp add should reject (or sanitize with a notice, like the import path does) names outside [a-zA-Z0-9_-], or registration should sanitize the prefix defensively. I'd be happy to implement this — let me know which side you prefer.
Version
0.1.0 (built from source, main @ cb5fc14)
Note: I used an AI assistant to help polish the wording of this report; the repro steps and code reading are my own and were run locally.
- Lenguaje dominante
- TypeScript
- Estrellas
- 850
- Forks
- 62
- Merge medio
- 1 d 10 h
- PR fusionados (30 d)
- 51
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 stepfun-ai/Step-Code
-
area/build bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#190 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
area/tools bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#186 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area/tools bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#185 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area/tools bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#184 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
stepfun-ai/Step-Code#179 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de stepfun-ai/Step-Code
Issues similares
-
Unsampled pageload span is profiled when profileLifecycle is 'trace' (browser UI profiling)Posiblemente ocupada @Jxxunnn la tomó hoy. AbiertoBrowser Waiting for: Product Owner
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
getsentry/sentry-javascript#25497 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
e2e-failure ready-to-code
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
redhat-developer/rhdh-plugin-export-overlays#4438 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
resource: destroying a resource calls AbortController.abort() without a reason, creating an AbortError with a stack trace each timePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea: core
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
angular/angular#71422 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
facebook/docusaurus#12739 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
factory-active task-identify-harness-labels-done task-identify-issue-type-done
Dificultad 1/5 1-3 horas Aptitud para principiantes 68/100
vercel/ai#23537 · 1 comentario ·
Los mantenedores suelen responder en 1 día