# Agent Marketplace — local integrations

Run your purchased agents **from anywhere** — your terminal, scripts, cron, or a local AI client — with
**no paid SaaS and nothing to register**. Everything here talks to the one integration point: the buyer API.

```
POST https://theagentmarketplace.ai/api/v1/agents/<slug>/run
Authorization: Bearer <your-key>
content-type: application/json
{ "prompt": "..." }   ->   { "slug", "output", "creditsCharged" }
```

Create a key in your dashboard → **API keys**. Each run costs 1 run credit (your balance, or an org pool
for an org-scoped key). The API is enabled per-account by the operator.

## Get the connectors

They're served straight from the live site — no repo, no install:

```bash
curl -O https://theagentmarketplace.ai/integrations/tam-run.mjs
curl -O https://theagentmarketplace.ai/integrations/mcp-server.mjs
```

(The dashboard → API keys section links to them too.)

## Why not Slack / Zapier?

They're **paid external platforms** that require a registered, reviewed app on *their* side and lock the
integration to a vendor. You don't need them — anything that can POST to a URL drives an agent. Prefer the
**free / local** options below.

## Free + local options

| Option | Local? | Cost | Use it for |
|---|---|---|---|
| **`tam-run.mjs` (CLI)** | ✅ runs on your machine | free | terminal, scripts, cron, CI |
| **`mcp-server.mjs` (MCP)** | ✅ stdio, runs locally | free | tools inside Claude Desktop / Cursor |
| **n8n** (self-hosted) | ✅ self-host = fully local | free / open-source | the real no-code Zapier replacement |
| **Make / Pipedream** | ☁️ hosted | generous free tier | quick no-code webhooks |
| **plain curl / fetch** | ✅ | free | anything |

### CLI

```bash
TAM_API_KEY=tam_live_... node tam-run.mjs my-email-writer "Turn these notes into a polite reply: ..."
# TAM_BASE_URL overrides the host (self-host / staging)
```

### MCP server (Claude Desktop / Cursor — local, free)

Add to `claude_desktop_config.json` (or your client's MCP config):

```jsonc
{ "mcpServers": {
  "agent-marketplace": {
    "command": "node",
    "args": ["/abs/path/to/integrations/mcp-server.mjs"],
    "env": { "TAM_API_KEY": "tam_live_..." }
  }
}}
```

Restart the client; the agent shows up as a `run_agent` tool. Zero dependencies — the JSON-RPC/stdio
transport is implemented inline, so there's nothing to `npm install`.

### n8n / Make / Pipedream (no-code)

Add an **HTTP Request** node: `POST` the URL above with the `Authorization: Bearer` header and a JSON body
`{"prompt": "..."}`. n8n is open-source and **self-hostable**, so the whole automation runs on your own
box — the genuinely local, free Zapier alternative.

## Test the connectors

```bash
node --check tam-run.mjs && node --check mcp-server.mjs   # syntax
node selftest.mjs                                          # MCP protocol framing (no network)
```
