The endpoint#
All clients use one URL:
https://mcp.bastn.ai/mcpIt speaks MCP over Streamable HTTP. The credential the client sends decides which team's servers and tools it sees.
There are two ways to authenticate:
- A virtual key in the
Authorizationheader. Works with every client. Best for agents and automation, because the key can be attached to a registered agent. - OAuth sign-in with your dashboard account. Works with clients that implement MCP authorization, such as Claude Code. No key to copy.
With a virtual key#
Every new key is minted for an agent. A team admin gets a key when creating the agent (Agents, New agent, with Create a key for it now ticked), in the agent's drawer (Mint key for this agent), or with Agents › Keys › New key, which asks for the agent. A team member who is not an admin asks a team admin for a key, or connects with OAuth sign-in. After minting, the dashboard shows ready-to-paste configs for the clients below. Check that the MCP endpoint above them reads https://mcp.bastn.ai/mcp first.
Claude Code#
claude mcp add --transport http bastn https://mcp.bastn.ai/mcp --header "Authorization: Bearer bastn-sk-..."Or in .mcp.json at the project root:
{
"mcpServers": {
"bastn": {
"type": "http",
"url": "https://mcp.bastn.ai/mcp",
"headers": { "Authorization": "Bearer bastn-sk-..." }
}
}
}Cursor and Claude Desktop#
In ~/.cursor/mcp.json or claude_desktop_config.json:
{
"mcpServers": {
"bastn": {
"url": "https://mcp.bastn.ai/mcp",
"headers": { "Authorization": "Bearer bastn-sk-..." }
}
}
}VS Code#
In .vscode/mcp.json:
{
"servers": {
"bastn": {
"type": "http",
"url": "https://mcp.bastn.ai/mcp",
"headers": { "Authorization": "Bearer bastn-sk-..." }
}
}
}Any other client#
Any Streamable HTTP MCP client works with the URL and one header:
URL: https://mcp.bastn.ai/mcp
Authorization: Bearer bastn-sk-...Warning
Treat a key like a password. Do not commit it to a repository. If one leaks, revoke it under Agents › Keys and mint a new one.
With OAuth sign-in#
Add the server without a header:
claude mcp add --transport http bastn https://mcp.bastn.ai/mcpThen run /mcp in Claude Code and pick Authenticate:
- A browser opens the bastn sign-in page at
mcp.bastn.ai. Sign in with your dashboard account, and your Two-step code if you turned two-step verification on. The field takes a recovery code too. - Check the application asking for access. An application that names itself is shown as Unverified app, with the address its details come from, so you can tell what it is.
- Pick the team the access is for, if you are in several.
- Under Acts as agent, pick the agent the application acts as. You can bind an agent of a team you administer. If you administer no team, the sign-in is refused: ask a team admin for a key minted for an agent instead.
- Choose Allow.
Warning
Calls from a sign-in that acts as no agent are refused (HTTP 403). An older sign-in made without an agent stops working: sign in to the app again with an agent, then revoke the old sign-in under Agents › Connected apps.
The client receives its own tokens and refreshes them on its own. A grant ends when you revoke it, when your password, login email or role changes, or when you leave the team. After 90 days you sign in and consent again.
Manage grants under Agents › Connected apps, where you can pause a grant (its tokens stop working and cannot refresh until you resume it) or revoke it for good. A team admin also sees the grants that act as an agent in the Access view of that agent's drawer. An org admin can block an app for the whole org; see Stop other credentials.
Note
Clients that only support dynamic client registration cannot sign in. Use a virtual key with them.
Agents with no one signing in#
A scheduled job or a service can get its own OAuth token with a key pair, so it never borrows a person's sign-in. The private key stays with the agent; bastn only holds the public key.
- Make a key pair the agent keeps: Ed25519, EC P-256 or EC P-384.
- In the dashboard, open Agents, then the agent, switch its drawer to the Access view, and under Client keys paste the public key as a JWK and choose Register key. Copy the client_id it shows. A team admin of the agent's team registers keys.
- When the agent needs a token, it signs a short JWT with its private key and posts it to
https://mcp.bastn.ai/oauth/token:
curl -s https://mcp.bastn.ai/oauth/token \
-d grant_type=client_credentials \
-d client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer \
-d client_assertion="$JWT"The JWT is signed with the key's algorithm (EdDSA, ES256 or ES384). Its claims are iss and sub set to the client_id, aud set to https://mcp.bastn.ai/oauth/token, an exp at most 5 minutes ahead, and a jti that is new for every request. Most JWT libraries build this as a "private_key_jwt client assertion".
The answer is an access token for https://mcp.bastn.ai/mcp, valid for an hour. There is no refresh token: sign a new JWT for the next one.
Calls with the token are the agent's, with its category, risk profile and stops. Revoking the key in Client keys ends its tokens at once, and killing or retiring the agent revokes its keys.
What the client sees#
tools/list returns every tool the credential may call, named <server>__<tool>. Tools that policy denies are left out, so a client never sees a tool it cannot call.
To give a client fewer tools, do not use a different URL. Give it its own agent and key, assign the agent a category, or narrow the server's policy.
Tool search#
Besides the listed tools, three helper tools can be called on every connection: search_tools finds allowed tools by text and returns their names, tool_schema returns one tool's input schema, and call_tool calls a tool by name through the same checks as a direct call. They help agents that work with a large catalog.
Asking for a tool#
An agent whose key is attached to it also sees propose_tool and proposal_status, unless its team turned proposals off. With them, the agent can ask its team admins for a tool, more access or other flags. A person decides every proposal under Approvals, Requests, and nothing is applied automatically. Home shows how many are waiting.
Long calls#
A tool call can run for minutes, such as a backup, a deploy or a long query.
How long a call may run#
Every tool call has a time limit. It starts once the call has passed policy and approvals, so time waiting for an approval does not count. By default a call gets 5 minutes.
- Org admins set the org's own default and maximum under Settings, Organization, Advanced, Tool call duration, in minutes. The card also shows the most bastn allows. Leave a field blank to use bastn's value.
- An agent asks for more time on one call in
params._meta:
{"jsonrpc": "2.0", "id": 7, "method": "tools/call",
"params": {"name": "ops__backup_db", "arguments": {},
"_meta": {"ai.bastn/timeout_seconds": 1800}}}The call gets what it asked for, up to the org's maximum. Asking for more is not an error: the call gets the maximum. A call that runs out of time fails with a message that says what its limit was and how to get more.
Progress and cancel#
A call through a connector that has not answered within 5 seconds switches its response to an event stream, when the client accepts one (MCP clients do). bastn sends keepalives on it, so a proxy or load balancer does not cut a silent response. The answer, checked and recorded like any other, comes last.
- A client that sent a
progressTokenalso getsnotifications/progress, saying how long the call has run. Progress never carries output. - A client that disconnects, or sends
notifications/cancelled, stops the call on the connector.
Durable calls#
Most MCP clients give up on a request after about a minute. So a call still running 45 seconds after it started keeps running on bastn, and the agent gets a normal tool result at once, with a call id. Three tools on every connection work with it:
| Tool | What it does |
|---|---|
call_status | Says whether the call is working, completed, failed or cancelled. It does not wait. |
call_result | Returns the call's answer, as the original call would have. While the call is still working it waits up to 40 seconds, then says it is still running. |
call_cancel | Stops the call. |
A call id works only for the credential that made the call. Policy and approvals ran before the call started; the result is checked and recorded once, when it ends. Calls are kept for 24 hours. Pausing, killing or retiring the agent cancels its running calls.
When a call is refused#
A refused call returns an MCP error with the reason, for example a tool not permitted by policy, a paused agent or a call held for approval. Every refusal is also in the audit log. See Troubleshooting for common errors.