Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

step mcp add accepts server names that produce invalid MCP tool names

Aperta Adatta ai principianti
#140 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
nodejs, typescript

Direzione di ricerca

Il problema si trova in apps/cli/src/main.ts, dove il comando step mcp add accetta nomi di server senza validazione. Confronta con sanitizeServerName in packages/coding-agent/src/step/mcp-import.ts. La correzione deve convalidare o sanificare il nome del server in modo che corrisponda al set di caratteri del nome dello strumento ([a-zA-Z0-9_-]). Testa aggiungendo un server con un nome non valido e verifica che venga rifiutato o sanificato, e che i nomi degli strumenti risultanti (ad esempio, my.server__hello) siano validi.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

untriaged
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.

Lingua principale
TypeScript
Stelle
850
Fork
62
Merge medio
1g 7h
PR unite (30g)
56

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di stepfun-ai/Step-Code

Tutte le issue di stepfun-ai/Step-Code

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.