Metadata-Version: 2.5
Name: crewai-paymid
Version: 0.1.0
Summary: Commission protection for middlemen: the commission is paid first, then the seller is paid. CrewAI tools backed by the hosted Paymid MCP server.
Project-URL: Homepage, https://paymid.com.br
Project-URL: Documentation, https://paymid.com.br/docs
Author-email: Paymid <contact@aufwassen.com>
License: MIT
License-File: LICENSE
Keywords: commission,crewai,mcp,middleman,model-context-protocol,payments
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Office/Business :: Financial
Requires-Python: >=3.10
Requires-Dist: crewai-tools[mcp]
Description-Content-Type: text/markdown

# crewai-paymid

**The middleman gets paid first.**

Commission protection for middlemen: the commission is paid first, then the seller is paid. CrewAI tools backed by the hosted Paymid MCP server.

Paymid protects a middleman's commission on a deal: the buyer accepts a commission agreement (12-month non-circumvention) and pays the commission; only then does the payment to the seller open. Paymid sequences the two payments and keeps the proof record — it never processes or holds the money itself.

This package is a thin wrapper over CrewAI's native `MCPServerAdapter`, pre-configured for the Paymid server — no URL to paste, no config to write.

## Install

```bash
pip install crewai-paymid
```

## Use

```python
from crewai import Agent
from crewai_paymid import get_paymid_tools

agent = Agent(
    role="Deal coordinator",
    goal="Protect the middleman's commission on every introduction",
    tools=get_paymid_tools(),
)
```

Or manage the connection lifetime yourself:

```python
from crewai_paymid import paymid_tools

with paymid_tools() as tools:
    agent = Agent(..., tools=tools)
```

## Tools

| Tool | What it does |
|---|---|
| `create_bridge` | Create a commission-protected bridge (optionally from an existing agreement's text — Paymid extracts the parties, values and does the math). Returns the payment link to send the buyer. |
| `get_bridge_status` | Current status: commission paid? seller contact unlocked (blind mode)? service payment confirmed? |
| `list_my_bridges` | Your bridges, with statuses and amounts. |
| `get_bridge_link` | The payment link of an existing bridge, to resend to the buyer. |
| `get_bridge_record` | The proof record: accepted agreement, timestamps, amounts, both payment receipts. |
| `cancel_bridge` | Cancel a bridge. |

Two modes: `padrao` (default — payment order enforced, parties may already know each other) and `blind` (the seller's contact stays sealed until the commission is confirmed — for deals where the seller's identity is the secret).

## Authentication

The Paymid server uses OAuth 2.1 with dynamic client registration. Validated live against crewai-tools 1.15.41 + mcpadapt 0.1.20:

- The adapter does **not** run the interactive OAuth sign-in. Without a token, the connection reaches the server, receives its **401**, and the adapter raises after its connect timeout.
- If you already have a Paymid access token, the package injects it for you — set the environment variable and connect:

  ```bash
  export PAYMID_ACCESS_TOKEN=<your-token>
  ```

  (or pass `access_token=` to `get_paymid_tools()` / `paymid_tools()`). With a valid token the handshake completes and all 6 tools load — this path is validated end to end against the production server.
- To obtain a token, sign in through any client with native remote-MCP OAuth (or the npm bridge, `npx -y paymid-mcp`, which performs the full browser flow).

## Links

- Website: https://paymid.com.br
- Docs: https://paymid.com.br/docs
- Privacy: https://paymid.com.br/privacy
- Support: contact@aufwassen.com
- Official MCP Registry: `br.com.paymid/mcp-server`

## License

MIT
