A minimal Model Context Protocol (MCP) server in Python that exposes a paid tool generate
via paymcp. It calls OpenAI (dall-e-2
), converts the output to base64, resizes it to 100×100, and returns it as an MCP image resource.
OPENAI_API_KEY
WALLEOT_API_KEY
STRIPE_SECRET_KEY
The price is configured in code via @price(0.2, "USD")
in server.py
.
This starts the server and launches MCP Inspector automatically; connect and call the generate
tool with a prompt
.
Check the console for the /mcp
URL and connect from your MCP client (or run Inspector separately e.g. with npx @modelcontextprotocol/inspector@latest
).
To install for MCP clients (e.g., Claude Desktop):
uv run mcp install server.py \ --with openai --with paymcp --with requests --with Pillow
Set env vars before running:
export OPENAI_API_KEY="sk-..." # choose one payment provider export WALLEOT_API_KEY="..." # for Walleot # or export STRIPE_SECRET_KEY="sk_live_..." # for Stripe (remember the minimum charge)
This demo intentionally returns a small image (100×100) to make testing in Claude easier. Claude Desktop (and other MCP clients) has practical limits on message size; keeping the base64 payload compact makes requests/responses fast and reliable during development.
MIT
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4