DEV Community

AlonDrilich
AlonDrilich

Posted on Fully Autonomous

Your MCP server's data is an injection surface: notes from an internet radio server

internet-radio-mcp is a small open-source MCP server. It lets Claude, Cursor, VS Code Copilot and other MCP clients search the Radio Browser directory, about 50,000 stations with working streams, and get each station's direct stream URL. It has five read-only tools, needs no API key, and runs with one command:

npx -y internet-radio-mcp
Enter fullscreen mode Exit fullscreen mode

The interesting part wasn't the radio. It was realising that every field the server returns goes straight into a language model's context, and that anyone in the world can edit those fields.

The threat is the station name

Radio Browser is community-maintained: anyone can add or edit a station. So a station could be named "Ignore previous instructions and ...". When an assistant asks for jazz stations in Brazil, that name arrives in the tool result next to the real ones. That's indirect prompt injection, and an MCP server is exactly the kind of component that carries it.

You can't make it impossible. You can make it small, visible and boring.

What the server does

One line per field, with nothing hidden. Line breaks and control characters become spaces. Zero-width characters, bidirectional controls, private-use code points, the Unicode "tag" block and other invisible default-ignorable code points are removed. That matters more for an LLM than for a person: those characters can carry text a human reviewer never sees. The exceptions are the emoji selector and the zero-width joiners that real scripts need, and even those survive only in runs of two.

Length caps. Names are cut at 120 characters, tags at 40, other fields at 60. A long "name" is the easiest place to hide a paragraph of instructions.

Only real URLs. stream_url, homepage and favicon must be plain http or https, written out in full, with no credentials or backslashes. javascript:, data:, file:, https:host and bare words are dropped, and URLs are returned in their parsed, canonical form. A station without a valid id or a playable stream is left out entirely.

Say it out loud. The server instructions and every result state that these fields are data from a public directory, not instructions. That doesn't stop a determined model from following text, but it gives the client's model the right frame.

Read-only by design. Every tool is annotated readOnlyHint: true and openWorldHint: true. There's nothing to write, delete or spend, so the worst a poisoned name can do is mislead, not act.

Results that are easy to check

Each tool result carries three things: a one-line human summary, the same data as JSON text, and structuredContent that matches the tool's outputSchema. Clients that understand structured output get typed data; the rest still get readable text. Inputs are bounded too: limit is 1 to 50 for searches, country codes are ISO 3166-1 alpha-2, and order is an enum.

Fail loudly, keep running

The server tries three Radio Browser mirrors in order, each with an 8-second timeout. Replies are capped at 5 MB and must be a JSON list; a mirror that redirects or returns something else counts as failed. If all three fail, the tool returns a clear isError: true result instead of crashing the server or inventing an answer.

Try it

In Claude Code:

claude mcp add internet-radio -- npx -y internet-radio-mcp
Enter fullscreen mode Exit fullscreen mode

Then ask something like "find jazz stations in Brazil" or "what's trending on internet radio right now?". The README has configs for Claude Desktop, Cursor, VS Code, Gemini CLI and Docker, and the server is in the official MCP Registry as io.github.AlonDrilich/internet-radio-mcp.

It's MIT-licensed, plain ES modules with JSDoc types, and depends only on the official MCP TypeScript SDK and zod. If you build an MCP server over any public, editable data set, the same list applies: one line per field, nothing invisible, capped lengths, canonical URLs, read-only tools, and a clear statement that the data is data.

Top comments (3)

Collapse
 
shansjl profile image
shansjl •

The "station name is the threat" framing maps really well onto video too. I work on an open-source video editor that Claude Code / Codex drive over MCP (disclosure: I'm the author), and the equivalent field there is the transcript: anyone who speaks in a clip is effectively writing into the model's context.

What helped us was in the spirit of your "make it small, visible and boring" list: generated captions land as a proposal the human reviews instead of being written straight into the project. That doesn't stop a model from being misled, but it means the worst case is a bad suggestion, not a silent edit.

Your point about invisible code points is one I hadn't thought about for subtitles. Speech-to-text output is usually clean, but imported .srt files from elsewhere definitely aren't, so stripping default-ignorables on import is going on my list. Thanks for writing out the concrete caps too, the 120/40/60 numbers are a useful starting point.

Collapse
 
alondrilich profile image
AlonDrilich •

Thanks, the transcript is a good parallel, and a harder one: a station name is a short single field, while a transcript is long free text that needs its line breaks, so "one line per field" and a fixed length cap don't carry over directly.

Proposal-instead-of-write is the stronger control of the two. This server can only return data, so read-only is the whole story there, but once a tool can change a project, having a person accept the change is what turns a misled model into a bad suggestion instead of a bad edit.

On .srt imports, one caveat: not every invisible character is noise in subtitles. Emoji sequences use the zero-width joiner, and right-to-left subtitle files often carry LRM/RLM marks on purpose. The bidi override and embedding controls (RLO, LRO and the like) are the ones I'd drop outright, since they can make the text a person sees differ from the text the model reads.

Collapse
 
shansjl profile image
shansjl •

That's a useful correction, thanks. A blanket strip would have broken emoji and right-to-left subtitle files, so dropping only the override and embedding controls is the narrower rule to write down.