DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to serve an MCP server over HTTP and call it from Python with Python SDK

Run your server with Streamable HTTP and connect the SDK's Client to it with a URL.

Short answer: Install with uv add "mcp[cli]"; then Serve your server with uv run mcp run server.py --transport streamable-http; write a client that opens Client("http://localhost:8000/mcp") and calls call_tool, as in the README. All steps.

Who it is forAn engineer preparing to deploy an MCP server rather than run it as a local subprocess.

The problemLocal stdio servers are fine for one laptop, but a shared server needs an HTTP transport and a client to test it.

The outcomeA server reachable at a URL and a short Python client that calls its tools and prints structured results.

What you need first

  • Python 3.11 or later
  • uv or pip
  • The cli extra for the mcp command-line tool
  • Optional: the MCP Inspector, which mcp dev opens

Steps

  1. Install with uv add "mcp[cli]"
  2. Serve your server with uv run mcp run server.py --transport streamable-http
  3. Write a client that opens Client("http://localhost:8000/mcp") and calls call_tool, as in the README
  4. Read result.structured_content for the output
  5. See the Clients docs to launch a local server as a stdio subprocess instead

Prompt for your agent

Using modelcontextprotocol/python-sdk, serve my server.py with `uv run mcp run server.py --transport streamable-http` and write a Python client that calls <tool> with <arguments> and prints the structured result.

Caveat. The README example runs on localhost with no authentication; add auth before exposing a server beyond your machine.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for modelcontextprotocol/python-sdk and "Serve an MCP server over HTTP and call it from Python"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer