Cookbook · 16 min

Build a Python MCP client from scratch.

No desktop app required. Connect directly to Fluenta's Remote MCP endpoint, run free sandbox analysis first, then optionally trigger full paid X-Ray runs.

What you will ship

  • Direct MCP connection over HTTP to Fluenta.
  • Tool discovery via `list_tools` for runtime safety checks.
  • A free sandbox call for fast triage.
  • Optional paid full X-Ray call with explicit spend gate.

Prerequisites

requirements.txt
mcp>=1.9.0
httpx>=0.27.0

Step 1 — Export credentials

terminal
export FLUENTA_API_KEY="fl_live_..."
export FLUENTA_MCP_URL="https://dev.fluenta.space/backend/api/v1/mcp"

Step 2 — Run the client

fluenta_mcp_client.py
"""
fluenta_mcp_client.py

Minimal Remote MCP client for Fluenta.
Flow:
1) connect (streamable HTTP)
2) list tools
3) run sandbox tool (free)
4) optionally run full paid tool
"""

import asyncio
import os

from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

MCP_URL = os.getenv("FLUENTA_MCP_URL", "https://dev.fluenta.space/backend/api/v1/mcp")
API_KEY = os.environ["FLUENTA_API_KEY"]

HEADERS = {"Authorization": f"Bearer {API_KEY}"}


async def main():
    async with streamablehttp_client(MCP_URL, headers=HEADERS) as (read_stream, write_stream, _):
        async with ClientSession(read_stream, write_stream) as session:
            await session.initialize()

            tools = await session.list_tools()
            print("tools:", [t.name for t in tools.tools])

            sandbox = await session.call_tool(
                "fluenta_idea_x-ray_sandbox",
                {
                    "title": "AI assistant for startup PRDs",
                    "description": "Tool that turns founder voice notes into structured PRDs + launch checklist."
                }
            )
            print("\n--- sandbox ---")
            print(sandbox)

            run_full = False  # flip to True only when user consents to 2,000-credit spend
            if run_full:
                paid = await session.call_tool(
                    "fluenta_idea_x-ray",
                    {
                        "title": "AI PRD co-pilot for pre-seed founders",
                        "description": "Converts raw founder notes into investor-ready PRDs and GTM action plans."
                    }
                )
                print("\n--- paid submission ---")
                print(paid)

                # Typical response includes analysis_id. Polling pattern:
                # result = await session.call_tool("fluenta_idea_x-ray", {"analysis_id": "an_..."})
                # print(result)


if __name__ == "__main__":
    asyncio.run(main())

Screenshot placeholders

Real desktop screenshots were intentionally left out to keep this release zero-cost. Add them later when you have live capture time:

  • `/public/docs/cookbook/python-client-01-tools.png` — list_tools output.
  • `/public/docs/cookbook/python-client-02-sandbox.png` — sandbox response.
  • `/public/docs/cookbook/python-client-03-result.png` — final xray_result payload.

Next recipe

Prefer UI-first workflows? Follow Claude Desktop or Cursor versions.