Skip to content

blustAI/python-paymcp-server-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Image Generator MCP Server (paymcp demo)

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.


Requirements

  • Python 3.10+
  • OpenAI: OPENAI_API_KEY
  • Payments (choose one provider):
    • Walleot: WALLEOT_API_KEY
    • Stripe: STRIPE_SECRET_KEY
      Note: Stripe enforces a minimum charge; set your tool price accordingly (e.g., higher than their minimum) if you use Stripe.

The price is configured in code via @price(0.2, "USD") in server.py.


Install & Run (with uv)

Dev mode (opens Inspector automatically)

uv run mcp dev server.py

This starts the server and launches MCP Inspector automatically; connect and call the generate tool with a prompt.

HTTP mode

uv run server.py

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

Configuration

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)

Note

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.

License

MIT

About

Minimal MCP server demo with paymcp (Stripe/Walleot) that generates images via OpenAI.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages