markaDocs
MCP

Claude Code MCP connection

Connect Claude Code to Marka — the hosted gateway over OAuth, an API key for headless use, or the SDK's stdio bridge.

Claude Code speaks streamable HTTP and handles OAuth for MCP servers itself, so connecting takes one command and a browser.

claude mcp add --transport http marka https://joinmarka.com/api/mcp

No header, no key. Then, inside Claude Code:

/mcp

Pick marka, then Authenticate. Your browser opens on Marka, you sign in if you are not already, and a consent screen names the client and the address it will send you back to. Press Allow and the browser hands the code back to Claude Code, which exchanges it for a token and stores it for you.

/mcp afterwards shows the server as connected and lists its tools. The same menu offers Clear authentication if you want the client to forget its token.

This gives you the hosted server's six operations. Claude Code lists two tools for them by default: search_tools returns the operations, and execute_typescript runs a program that calls them as external_<operation>(input). See Tools.

Add --scope project to share the server with your team through a checked-in .mcp.json, or --scope user to make it available across all your projects. The default scope is local: private to you, in this project only. With OAuth there is nothing secret in the file, so --scope project is safe to commit — each teammate authenticates as themselves.

As a config file

The equivalent .mcp.json:

{
  "mcpServers": {
    "marka": {
      "type": "http",
      "url": "https://joinmarka.com/api/mcp"
    }
  }
}

Disconnecting

Two independent halves, and both are worth knowing:

  • /mcp → Clear authentication makes Claude Code forget the token on this machine.
  • Marka → Settings → Connected apps → Disconnect invalidates the token itself, everywhere, immediately. That is the one to use if a machine is lost or a token may have leaked.

With an API key instead

Scripts and CI have no browser to open. An mk_ key works on the same endpoint:

claude mcp add --transport http marka https://joinmarka.com/api/mcp \
  --header "x-api-key: mk_YOUR_KEY_HERE"

Do not commit your key

--scope project writes the config — including the header — into .mcp.json at the project root, which is a file you check in. Prefer OAuth for anything shared; if you must use a key, keep the default local scope or reference an environment variable (${MARKA_API_KEY}) rather than pasting the literal value.

Authorization: Bearer mk_… is accepted as an equivalent header if your tooling prefers it.

The stdio bridge

If you would rather run the SDK's local server — for example to develop against a local Marka, or to use get_me — point Claude Code at the bridge instead. This needs a checkout of the Marka repository with dependencies installed, and it does need a key: the bridge talks to /api/v1, which is API-key authenticated.

claude mcp add --env MARKA_API_KEY=mk_YOUR_KEY_HERE --transport stdio marka \
  -- node /absolute/path/to/marka/packages/sdk/bin/mcp-stdio.mjs

Two bits of syntax that are easy to get wrong:

  • The -- separator is required. Everything before it is Claude Code's own options; everything after it is the command to run.
  • --transport stdio is required here even though stdio is the default transport. --env is variadic, so without something to terminate it the CLI reads the server name marka as another KEY=value pair and rejects the command with Invalid environment variable format: marka. Putting --transport stdio between the two ends the --env list.

As a config file:

{
  "mcpServers": {
    "marka": {
      "type": "stdio",
      "command": "node",
      "args": ["/absolute/path/to/marka/packages/sdk/bin/mcp-stdio.mjs"],
      "env": {
        "MARKA_API_KEY": "${MARKA_API_KEY}"
      }
    }
  }
}

Add MARKA_BASE_URL (origin only — no /api, no /v1) to target a local web app.

Which tools you get

The two routes expose different tool sets — this is the thing to keep straight:

Hosted (--transport http)Bridge (stdio)
Readssearch_listings, get_listing, list_categories, get_seller_infosearch_listings, get_listing, list_categories, get_me
Writescreate_listing_draft, update_listing_draftcreate_listing, update_listing
AuthOAuth in the browser, or an API keyan API key
Write gatemonthly AI copilot run quotaapi_write entitlement (Pro+)

Neither can publish a listing. See MCP overview for why.

Checking it worked

Ask the assistant to search Marka. A working hosted connection answers from the live catalogue; a working bridge connection can additionally report your plan via get_me.

If a tool call comes back 401:

  • On OAuth, the token has expired past its refresh window or was disconnected from Settings → Connected apps. Run /mcp and authenticate again.
  • On an API key, the key is missing, malformed, revoked, or expired — check it against GET /api/v1/me first (see Getting started).

On this page