Skip to content

MCP and OAuth

How an agent reaches a network. For the steps in a given tool, see connect an agent; this page is for people who build agents.

POST https://inseam.io/mcp

MCP over Streamable HTTP, stateless, JSON-RPC 2.0, one message or a batch per request. The bearer token is an agent’s token from the OAuth flow below, or an API token. Without a valid token the answer is 401 with WWW-Authenticate: Bearer resource_metadata="https://inseam.io/.well-known/oauth-protected-resource", which is how an MCP host discovers that it must sign in. GET /mcp and DELETE /mcp are 405: there is no session to open or close.

The server speaks protocol version 2026-07-28 and still answers the 2025-11-25 initialize. initialize returns short instructions: what inseam is, when to search it, what your network holds, that every result carries an address, that read gets the text behind a hit, and where the agent’s own folder is.

An agent uses inseam when it knows that your data is there. So the instructions and the description of the search tool both tell the agent to search inseam first when the answer may be in your own data, and both list the hosts the agent may search: each host’s name, what it is and how many items it holds. The list is made when the MCP host connects or asks for the tools; hosts gives the current state.

The usual flow for MCP hosts. Discovery is standard:

document
/.well-known/oauth-protected-resource RFC 9728: the resource, its authorization server, the scopes
/.well-known/oauth-authorization-server RFC 8414: the endpoints, code_challenge_methods_supported: ["S256"], token_endpoint_auth_methods_supported: ["none"]
  1. Register, or bring a client id. POST /oauth/register (RFC 7591) with {"client_name": "…", "redirect_uris": […], "token_endpoint_auth_method": "none"} returns {"client_id": "…"}. Or use an https URL as the client id that serves a Client ID Metadata Document: JSON with client_id equal to the URL, client_name and redirect_uris. Public clients only.
  2. Send the person to GET /oauth/authorize?response_type=code&client_id=…&redirect_uri=…&code_challenge=…&code_challenge_method=S256&state=…&scope=search%20read. PKCE is required. They sign in, pick a network, the scopes, the hosts and a duration, and approve.
  3. The browser returns to redirect_uri?code=…&state=…. Exchange it: POST /oauth/token with grant_type=authorization_code, code, client_id, redirect_uri, code_verifier.
  4. The answer is {"access_token": "ias_…", "token_type": "Bearer", "expires_in": …, "refresh_token": "rt_…", "scope": "search read"}.

Redirect URIs must match exactly; loopback URIs (http://127.0.0.1:…, http://localhost:…) may change their port. A refresh token rotates the access token with grant_type=refresh_token and lives 90 days. POST /oauth/revoke with token revokes either kind.

For a script on a server or a scheduled job.

  1. POST /oauth/device with client_id and scope. The answer is {"device_code", "user_code", "verification_uri", "verification_uri_complete", "expires_in", "interval"}.
  2. Show the person user_code and verification_uri (https://inseam.io/activate). They type the code and see the same approval page.
  3. Poll POST /oauth/token with grant_type=urn:ietf:params:oauth:grant-type:device_code, device_code and client_id, every interval seconds. Until approved the answer is authorization_pending; slow_down means wait 5 seconds; access_denied and expired_token end it. Codes expire after 15 minutes.

OAuth endpoints answer in RFC 6749 shape: 400 {"error": "invalid_grant", "error_description": "…"}.

scope lets the agent default at approval
search search the network, read records, list prefixes, browse folders, see hosts and status on
read read the text and the bytes behind an address on
write write and delete on the hosts the person picked off
connect add plugins: connect a new host, such as a cloud account, or add a converter. Write a plugin or install one from the registry, try it, ask to install it. A person approves every host off
registry manage the plugins you published (or, for inseam staff, any plugin): retire a version, restore it, put it in a line, ask to revoke it. You confirm each revocation in the app. A platform cannot grant it off

Whatever the scopes, every agent may read, write and delete in its own folder on the pad: inseam://{network}/pad/agents/{client id}/. The hosts tool returns it as padFolder.

tool input needs returns
search {q, hosts?: [id], topK?: 1-100, filter?: {mime?, ext?, after?, before?, prefix?, name?, minSize?, maxSize?}} (the filter of the REST search) search {hits: [{address, host, score, title, snippet, meta}], hosts: [{id, name, searched, reason?, coverage, items}]}
get {address, follow?: true} search {record, readAs}: the catalog record (a forward carries deleted: true and movedTo), and the types the object can be read as
read {address, maxBytes?: ≤ 262144, as?, with?, options?} read {address, mime, source: "index" | "host", truncated, text}, or {…, base64} for non-text. With as, the object converted to that type: {…, source: "converter", converter, cached, title}
list {prefix, after?, limit?: ≤ 1000} search {entries: [{address, id}], more, next}
browse {prefix, recursive?: false, limit?: 1-1000 (200), after?, filter?}: prefix is a host’s root or a folder that ends with / (the browse of the REST API) search {prefix, folders: [{address, name}], entries: [{address, name, path, title?, mime?, size?, mtime?, depth?}], more, next}. A page can be empty and still have more: call again with after: next
hosts {} {hosts: [{id, name, kind, state, items, coverage, writes, writable, writePolicy, youMayWrite}], padFolder}. youMayWrite is true when your grant, the connector and the write policy all let you write somewhere in the host
write {address, mime?, ifMatch?, content?, contentBase64?} write {entry: {address, content, etag, size, depth, created}}; the object is searchable when the call returns
delete {address} write {address}; the old address keeps a forward

read serves text from the index when it has it (source: "index") and from the host otherwise, so a read of an indexed document works while its device is off. A tool that cannot do what was asked returns isError: true with the reason (forbidden: not allowed: write: …, which says whether your grant or the host’s write policy refused it), not a JSON-RPC error. Addresses are full location addresses or the short form {host}/{path}; see addresses.

An agent with the connect scope extends the network with plugins: a connector for a source inseam has no built-in support for, or a converter that makes a file type searchable or readable in another form. It installs one from the registry, or writes one: a small JavaScript module that inseam tests, has reviewed and installs. For a connector, a person approves twice in the browser: before anything runs, and before the install. A converter reaches nothing, so it needs no approval unless the network asks for one.

The tools, the contract, the checks and the registry are in the plugins reference. In short:

tool input returns
connect_host {describe} the host plugin contract (TypeScript types), a complete example, the rules, the steps, and matching registry entries
add_plugin {slot, describe} the same for a slot: convert, enrich or host
find_plugins {q?, slot?, from?, to?} registry entries, with the hash to install
trial_plugin {name, code | registry, config?, examples?, for?, replaces?} accepted: {accepted: true, trial}. Refused: {accepted: false, stage, violations, findings}; nothing is stored
trial_status {trialId} {trial}: the state, and the report once the trial ran
review_plugin {trialId}, then {trialId, codeHash, verdict, summary, checks, tests?, paths?} the review prompt (numbered code, scan findings, checklist), then the recorded review
install_plugin {trialId} {trial}: waits for the person to confirm
plugins {} what is installed, the routes, the policy, the rollbacks
registry_versions {hash} a registry entry, the versions of its line, and whether you may change it
retire_plugin, join_plugin_line, revoke_plugin {hash, …} the publisher’s changes to an entry; a revocation waits for the person to confirm it

trial_connector, review_connector and install_connector are the earlier names, and still work.

Every result has a next field: who acts (agent or person), which tool to call with which arguments, or which page the person opens. An agent that follows next completes the work. The same information is in the result’s text.

For a connector:

  1. Look. connect_host returns the contract and the registry’s matches. A match is an install: trial_plugin {registry, name, config}, with no code to write and no review to make.
  2. Write. A module exports { manifest, host: { list, stat, read } }. The manifest says what it is, which origins it reaches and what credential it needs; it is data, which inseam reads without running the code.
  3. Submit. trial_plugin checks the module against the contract and scans it. A problem comes back as {at, problem, fix}, for example at: "manifest.origins[0]", problem: "got \"api.example.com\"", fix: "write the origin only: \"https://\" then a public host name…".
  4. The person approves. They open the page in next.open, see the origins the connector may reach, and type the credential there, or sign in with the provider for an OAuth connector. The agent never sees it: inseam attaches it to the connector’s requests.
  5. Trial. inseam runs the connector against the real host: it lists a page, checks that stat agrees, reads two small objects, and checks that no request went anywhere else. trial_status returns the report. Fix what failed and submit again with replaces; the person’s approval is kept when the origins, the credential fields and the settings did not change.
  6. Review. review_plugin returns the code with line numbers and eight security checks. The agent answers each with evidence and line numbers, and may give paths that stat must survive. The person reads this review before they install. A connector from the registry comes with the registry’s review.
  7. Install. install_plugin, then the person presses Install on the same page. The host appears in hosts, and search finds its objects as the first crawl indexes them.

What a connector can do today:

  • Read-only. A connected host cannot be written to.
  • The host has an HTTP API over https. It takes a fixed credential (an API token, an API key, or a user name and password) or a sign-in with GitHub or Google (see below). Other OAuth providers, such as Microsoft 365, are not yet supported.
  • It reaches only the origins it declares, with GET and HEAD. It may POST only to URLs it declares for queries, which the person sees before they approve.
  • inseam reads up to 8 MiB of each object for search. Larger objects are found by name.
  • A host is crawled again every hour (every six hours when the connector says listing is metered). Changes on the host appear after the next crawl; there are no push updates yet.
  • A trial waits 24 hours for the person.

The review is also an MCP prompt, connector_security_review, for agent hosts that offer prompts.

A connector for GitHub or Google declares auth: { "type": "oauth2", "provider": "github" | "google", "scopes": [ … ] } in its manifest, with scopes from the provider’s list that connect_host returns. It names no token endpoint and no header: inseam sends Authorization: Bearer {access token} to the declared origins that belong to the provider’s API, and to no other origin. A connector in the earlier form (contract: 1 or 2, with a describe() function) still loads.

On the approval page, the person signs in with the provider and allows the scopes. A consent that grants fewer scopes than the connector declares is refused. inseam refreshes the token before it expires. When the provider refuses a refresh, the host’s connector reports connected: false and the person connects the account again.

The sign-in uses inseam’s own app with the provider. When inseam has none, the approval page shows the provider’s steps to register an app in the person’s own account, with the redirect URI to copy. The network’s owner or an admin pastes the client ID and secret; inseam checks them with the provider and uses that app for every connection of the network to that provider. Removing or replacing it stops the refresh of accounts connected with the old app.

path
/llms.txt plain-text pointers to the endpoint and these docs
/.well-known/mcp/server-card.json the server card: name, endpoint, authentication