A single MCP server can expose tools like image generation to multiple AI agents without sharing any code between them. The Model Context Protocol (MCP) acts as a universal connector, letting one Python server serve Claude Code, a Google ADK agent, and a Rust CLI simultaneously. This approach eliminates the need for custom integrations for each AI platform.
What is MCP?
MCP is best understood as USB-C for AI tools. Before it, each AI app required its own plugin format — a ChatGPT plugin wouldn't work in Claude, and a Claude tool wouldn't work in a custom Python agent. MCP splits the problem into two parts: an MCP server that offers tools with names, descriptions, and typed parameters, and an MCP client inside the AI app that discovers and calls those tools. Communication happens over JSON messages, typically via stdio, where the client launches the server as a child process and they talk through standard input/output. A key rule is that the server must never print to stdout, as that would corrupt the protocol; all logging goes to stderr.
The server: four image tools in ~300 lines
The example server, built with FastMCP from the official MCP Python package, wraps Google's Gemini image model. Writing a tool is as simple as decorating a function — FastMCP reads the signature and docstring to automatically describe the tool to any connected AI. The server exposes four tools: generate_image, edit_image, describe_image, and list_tools. Under the hood, they all call Google's gemini-3.1-flash-lite-image model via the Interactions API, which is stateful — each generation returns an interaction_id that can be passed back for edits. This allows a conversation where the AI generates an image, then edits it while preserving style and details. The server itself stays stateless; Google's servers store the session, and the agent's memory holds the ID.
Tools return file paths instead of raw images to save tokens — a base64 PNG would waste thousands of tokens without benefit. Errors are caught and returned as readable strings, so the AI can retry with corrected parameters.
Three consumers, zero shared code
Claude Code requires only a .mcp.json config file that tells it to launch the Python server. Once configured, users can type a natural language request like "generate a 16:9 image of a mountain sunrise" directly in their coding session. The Google ADK agent uses MCPToolset to handle all the plumbing — spawning the server, discovering tools, and converting them into callable functions. The agent's instruction explicitly tells the LLM to track interaction IDs for follow-up edits, but the tool definitions come from the server automatically. The Rust CLI proves the protocol is language-agnostic: it uses the rmcp SDK to spawn the same Python server as a child process and call tools directly, without any AI model involved. Users can list tools, generate images, and edit them from the command line.
Why this matters
MCP decouples tool development from AI platform choice. A single server written once can be reused across any MCP-compatible client, whether it's a coding assistant, a custom agent, or a plain command-line tool. The protocol turns tool calls into simple function calls over a pipe — callable by an LLM or directly by a developer. This project demonstrates that with about 300 lines of Python and a config file, you can give image-generation superpowers to three completely different programs, all without duplicating a single line of integration code.