MCP server
Give Claude, ChatGPT or Cursor 26 tools so an agent can analyse a brand, write the script, generate the video and track it to completion — on your behalf, with guard rails on what it may spend.
Model Context Protocol is the open standard for handing an AI assistant a set of tools. This server wraps the Market4Me API, so anything you can do over REST an agent can do in conversation.
Install
You need an API key first — dashboard, Settings → API & integrations.
Claude Desktop & Claude Code
Add this to your MCP config (claude_desktop_config.json, or .mcp.json in a project for Claude Code) and restart.
{
"mcpServers": {
"market4me": {
"command": "npx",
"args": ["-y", "@market4me/mcp-server"],
"env": {
"MARKET4ME_API_KEY": "m4m_live_YOUR_KEY",
"MARKET4ME_MAX_CREDITS_PER_CALL": "250"
}
}
}
}Then just ask: "analyse acmecoffee.com and make me a 10-second product video". It will chain the tools itself.
claude.ai
On the web, add it as a custom connector under Settings → Connectors using the hosted URL — same sign-in flow as ChatGPT, no key to paste:
https://gateway.market4me.ai//api/v1/mcpCursor, Windsurf, Zed & other stdio clients
Same command, same environment variables:
MARKET4ME_API_KEY=m4m_live_YOUR_KEY npx -y @market4me/mcp-serverChatGPT
Nothing to install and no key to paste — ChatGPT signs in to Market4Me directly. In ChatGPT go to Settings → Connectors → Advanced → Developer mode and turn it on, then Connectors → Create and give it this URL:
https://gateway.market4me.ai//api/v1/mcpChoose OAuth as the authentication method. ChatGPT sends you to Market4Me to sign in, shows you what the connector will be allowed to do, and you approve it once. Then enable it in a chat from the + menu.
Developer mode is what lets ChatGPT use every tool on a server. Without it, ChatGPT only accepts connectors that expose search and fetch — it will connect and then appear to have no tools.
Approving mints a normal API key named after the connector, so it appears in Settings → API & integrations alongside your own keys and revoking it there disconnects ChatGPT immediately.
Custom GPTs & function calling
Those two consume OpenAPI rather than MCP, so point them at the spec instead — same API, same key. In the GPT builder add an Action, import this URL, and set authentication to API Key → Bearer.
https://gateway.market4me.ai//api/v1/openapi.jsonConfiguration
| Variable | Default | What it does |
|---|---|---|
MARKET4ME_API_KEY | — | Required for stdio. Your key. |
MARKET4ME_BASE_URL | https://gateway.market4me.ai/ | Point at a different environment. |
MARKET4ME_MAX_CREDITS_PER_CALL | 250 | Price above which a generation needs your explicit approval. |
Spending safety
An agent driving this server is spending real money on your behalf. Three things protect you, and they compose.
1. The confirmation gate
Anything priced above MARKET4ME_MAX_CREDITS_PER_CALL is refused once, with the exact price. The agent has to show you that number and get a yes, then call again with confirm_credits set to it. No large spend happens without the price having been said out loud and agreed to.
NEEDS CONFIRMATION — this video costs 350 credits, above the 250-credit
threshold this server confirms at.
Tell the user it will cost 350 credits and ask them to approve it.
If they approve, call this tool again with exactly the same arguments
plus confirm_credits: 350.It is deliberately a gate rather than a hard ceiling. A 5-second 1080p video costs around 350 credits, so any limit low enough to be meaningful would block the most basic call outright, leaving the agent stuck until you edit a config file and restart your client. The predictable result of that design is people setting the limit to 999999 and forgetting it. A gate you can pass deliberately is safer than a wall you are forced to remove.
2. Per-key spending ceilings
Set a lifetime credit cap when you create the key. Enforced server-side, so it holds even if someone edits the MCP config — and it holds under concurrency, so a runaway loop cannot slip past it.
3. Free-first tool design
estimate_cost, generate_content and draft_ugc_script are free or near-free, and their descriptions tell the model to draft and price before it renders. Failed generations are refunded automatically.
Give an autonomous agent its own key with a modest ceiling and only the scopes it needs. Revoking one key then costs you nothing else.
Tool reference
26 tools. "free" costs no credits; "cheap" is typically a credit or two; "credits" scales with duration and quality.
Account
| Tool | Cost | What it does |
|---|---|---|
get_account | free | Plan, credit balance, brands and what is gated. The first call an agent should make. |
get_credits | free | Balance plus recent transactions. |
estimate_cost | free | Price any generation without running it, and check affordability. |
Brands
| Tool | Cost | What it does |
|---|---|---|
list_brands | free | Every brand with its analysis status. |
create_brand | free | Create a brand and analyse its website into a brand brain. |
get_brand | free | One brand — used to poll until analysis completes. |
analyze_brand | free | Re-crawl a website and rebuild the brain. |
get_brand_intelligence | free | Tone, audience, products, USP, key messages, content pillars. |
Generation
| Tool | Cost | What it does |
|---|---|---|
generate_video | credits | Prompt → a finished video clip, returned synchronously. |
generate_image | credits | Generate, edit or face-swap an image. |
generate_speech | credits | Text → voiceover audio. |
generate_avatar | credits | A portrait plus words → a lip-synced spokesperson video. |
generate_content | cheap | Scripts, hooks, carousels and captions, on-brand. |
create_brand_video | credits | The full pipeline — script, scenes, voiceover, captions. Async. |
create_film | credits | One idea → a multi-scene narrated film. Async, subscription-gated. |
draft_ugc_script | free | A creator-style ad script to iterate on before spending. |
render_ugc | credits | Render an approved UGC script into a finished ad. |
transcribe_video | cheap | Transcribe a video, or burn subtitles into it. |
Jobs
| Tool | Cost | What it does |
|---|---|---|
wait_for_job | free | Block until an async job finishes. Use instead of polling. |
get_job | free | One status snapshot. |
list_jobs | free | Recent jobs — how to find a render that outlived its request. |
Assets
| Tool | Cost | What it does |
|---|---|---|
list_assets | free | Everything the account has produced, newest first. |
upload_media | free | Presigned URL to bring your own image, video or audio in. |
list_models | free | Available quality/price tiers. |
Webhooks
| Tool | Cost | What it does |
|---|---|---|
create_webhook | free | Register a callback endpoint. Returns the signing secret once. |
list_webhooks | free | Registered endpoints and their delivery health. |
How they fit together
create_brand(website_url) → builds the brand brain (30–90s)
└─ get_brand until complete
├─ generate_content → script / caption drafts (cheap)
├─ generate_image → a still (cheap)
│ └─ generate_video(image_url) → animate that still
├─ generate_speech → voiceover audio
│ └─ generate_avatar(audio_url) → a person saying it
├─ create_brand_video → full pipeline (async) ─┐
└─ create_film → multi-scene film (async) ┴─ wait_for_jobEverything after create_brand is automatically on-brand — the agent never has to re-describe the business.
Resources & prompts
Beyond tools, the server exposes resources (context a client can attach to a conversation) and prompts (guided workflows a user can pick from a menu).
| Resource | Contents |
|---|---|
market4me://account | Plan, credit balance, brands. |
market4me://brands/{id}/intelligence | The brand brain — attach it and ask for ad angles directly. |
market4me://openapi | The full REST contract. |
| Prompt | Walks through |
|---|---|
new_brand_setup | Onboarding a business from its URL and reviewing what was learned. |
make_marketing_video | Draft → price → confirm → render, in that order. |
campaign_from_website | Analyse, propose a costed asset plan, wait for approval. |
Remote / hosted
We host the server for you. It is the same tool set as the npm package, at:
https://gateway.market4me.ai//api/v1/mcpIt accepts either credential, because clients differ. ChatGPT and the claude.ai connector UI require OAuth and will not send a static key; Claude Code, Cursor and your own scripts can simply send a header:
Authorization: Bearer m4m_live_YOUR_KEY- Stateless — every request is independent, so there is no session to keep alive or lose.
- Responses come back inline. The server does not hold a long-lived event stream open, because an edge proxy would cut it on a timer and a healthy server would look like it was flapping.
- A blocking call is capped at about 90 seconds.
wait_for_jobreturns "still running, call again" rather than being cut mid-request — your render is unaffected either way.
You can still run it yourself if you would rather not depend on us for the transport — the same binary serves HTTP, and each client sends its own key so no credential lives on the server:
npx -y @market4me/mcp-server --http --port 8787
# clients connect to: http://your-host:8787/mcp
# with header: Authorization: Bearer m4m_live_...If you self-host, put it behind TLS. The API key travels in a header, and over plain HTTP on an untrusted network that is a credential in the clear.
Troubleshooting
| Symptom | Cause & fix |
|---|---|
| The server does not appear in Claude | Config JSON is invalid, or the client was not restarted. Check for a trailing comma, then fully quit and reopen — reloading the window is not enough. |
| Exits immediately | No API key. Set MARKET4ME_API_KEY. The server writes the reason to stderr; your client's MCP log will show it. |
| Every tool returns an auth error | The key is wrong, revoked or expired. Verify it with curl https://gateway.market4me.ai//api/v1/me. |
| A tool says NEEDS CONFIRMATION | Working as designed — see Spending safety. Approve the price, then let the agent retry with confirm_credits. |
| subscription_required on create_film | Director needs an active subscription. Buying credits will not unlock it. Use create_brand_video instead. |
| A generation timed out | Do not retry — you would pay twice. The render is still running; use list_jobs or list_assets to collect it. |
Prefer to call it directly? The REST reference documents every endpoint the tools wrap.