Skip to main content
Connect FinalSay as a Model Context Protocol server and your agent gets tools to ask a person before it acts. The server forwards each call to the Agent API, so payloads, limits and results are the same.

Connect

There are two ways to connect, with the same tools either way:
  • Hosted server over Streamable HTTP. Nothing to install; credentials go in HTTP headers.
  • Local server over stdio. Your MCP client starts npx finalsay mcp on your machine, which calls the API directly. Use it when your client only supports stdio, or can’t send custom headers.

Hosted server (Streamable HTTP)

Credentials go in HTTP headers on every request, never in tool arguments. Any client that supports Streamable HTTP with custom headers works. The dashboard’s Quickstart (pick AI agent (MCP)) fills these in for you.
Most clients (Claude Desktop, Cursor, and others) accept this mcpServers shape:
mcp.json
Read the key from an environment variable where your client supports it, so it stays out of the config file.

Local server (stdio)

The finalsay CLI includes an MCP server. It needs Node.js 20 or newer. Your MCP client runs it:
mcp.json
Credentials are resolved the same way as for every CLI command: FINALSAY_AGENT_ID, FINALSAY_API_KEY and FINALSAY_API_URL from the environment, otherwise the login saved by finalsay login. If you’ve already run finalsay login on that machine, you can leave out env. --agent <id> and --api-url <url> work as flags too. The credentials are fixed when the server starts, so one server acts as one agent. To use two agents, add two servers with different names. If the credentials are missing, the server exits straight away with a message on stderr, which most clients show in their MCP logs. Then tell the agent when to ask, for example: “Before you send anything to a customer, call request_human_approval, then check get_approval_result until it isn’t pending.” See Writing good requests.

Tools

request_human_approval

Creates an approval and returns right away with JSON from the API: request_id, approval_id, status, expires_at, idempotent. Use request_id (not approval_id) with get_approval_result. There’s no timeout input: approvals created over MCP always use the agent’s defaults (its General tab). Use the API or CLI if you need a per-request timeout.

create_approval

The same inputs and behaviour, described for flows where something else does the waiting, like an n8n Wait node with callback.url set to the execution’s resume URL.

get_approval_result

Takes request_id. Returns status: "pending" until someone answers or the approval expires, then the full result. Call it again after a short delay while it’s pending.

Errors

  • Invalid input is rejected before anything is sent. The tool error names each bad field (for example options: Too small: expected array to have >=1 items), so the agent can fix the call and retry.
  • API errors come back as tool errors carrying the HTTP status and the API’s code, for example FinalSay API error 409 idempotency_conflict: …. Codes include invalid_api_key, idempotency_conflict, rate_limited, USAGE_APPROVAL_LIMIT, and the rest in Errors.
  • Missing headers (hosted): if x-agent-id or x-api-key isn’t sent, every tool call fails with a message saying so. Check your client really sends custom headers, or use the local server.
  • Sessions (hosted): the hosted server is stateless. It doesn’t issue an mcp-session-id, so there is no session to expire, and every request is handled on its own with the headers it carries.

Using MCP inside n8n

n8n’s MCP Client Tool can connect to the same URL with the two headers. For human approval inside n8n workflows, the FinalSay community nodes are usually simpler: they include a ready-made AI Agent tool.