MCP Server

Serving your own users

Give each signed-in person in your app a scoped MCP connection, so the app's AI only reads and writes that person's memory.

Copy page
View as Markdown

How a person gets a connection

Your server calls provision_user with your app key (fsa_). Harny returns that person's key (fsk_) once. Store it on your server, keyed to your user record. Do not send it to the browser.

A person's key scopes these tools to that one person:

ToolWhat it does for that person
ingest_textWrites a note or durable fact into their memory
assemble_contextRecalls ranked context from their memory and connected sources
list_toolsLists the tools their key may call, and whether each source is connected
configure_oauthStarts connecting one source for them
action_historyShows their recorded actions, newest first

Calls are scoped to the key's user. Each call reaches only that person's memory.

Server-side only

  • Keep person keys in your server's secret store or database. Never put one in a browser, a mobile bundle, or a URL.
  • Make the MCP call from your server. Pass the person's key in the Authorization: Bearer header.
  • Use the MCP address https://api.harny.ai/v1/mcp/mcp (Streamable HTTP).
Authorization: Bearer <the person's fsk_ key>

Do not let the model pick the user

Your server chooses which person's key to use. The model never chooses a user id. Look up the key from your own session, then make the call. If the model's output names another person, ignore it.

Setup order

  1. Your server calls provision_user with the app key. It returns the person's key once.
  2. Save the key on your server against the person's record.
  3. For each request from that person, load their key and call the tools above.
  4. To connect a source, call configure_oauth and send the returned approval link to the person. Harny reads only their connected account after they approve.

The MCP server accepts bearer keys and sign-in tokens. Calls follow the same limits and refusals as the REST routes they wrap. A call over the per-minute limit answers 429 with Retry-After.

For how keys work, see Keys and access.

Next