MCP Server

basefyio runs a Model Context Protocol (MCP) server, so an AI agent such as Claude Code or Cursor can work with your projects: list tables, read rows, run SQL, browse storage. The agent signs in with an API token, and the token's permissions decide which tools it sees and what each call may do — reads and writes alike.

1. Create a token

In the dashboard open Account → API Tokens and choose Connect an AI agent, or Create Token for a blank form. Turn on only the permissions the agent needs. The MCP (read-only) preset selects every read tool and nothing that can change data. The token is shown once; copy it then.

2. Put it in your environment

Keep the token out of files you commit. Store it in your project's environment and let the client read it from there:

# .env (keep it out of version control)
BASEFYIO_MCP_TOKEN=bf_pat_...

3. Add the server to your client

Claude Code

claude mcp add --transport http basefyio https://api.basefyio.com/api/mcp \
  --header "Authorization: Bearer ${BASEFYIO_MCP_TOKEN}"

Clients configured with mcpServers

For example a .mcp.json at the root of your project. The ${BASEFYIO_MCP_TOKEN} placeholder is filled from the environment by clients that support it; check your client's documentation for its syntax.

{
  "mcpServers": {
    "basefyio": {
      "type": "http",
      "url": "https://api.basefyio.com/api/mcp",
      "headers": { "Authorization": "Bearer ${BASEFYIO_MCP_TOKEN}" }
    }
  }
}

Tools and the permission each needs

A tool appears in the agent's tool list only when the token holds its permission, and the permission is checked again on every call.

ToolPermissionWhat it does
list_teamsteam:readYour teams, your role in each and how many projects they hold
list_projectsprojects:readActive projects of one team, or of every team the token can reach
get_projectprojects:readOne project's details. Keys and passwords are never returned
list_tablesschema:readTables with their schema and row count
describe_tableschema:readColumns, types, primary key and foreign keys of a table
select_rowsdata:readOne page of rows (up to 200), with free-text search and sorting
insert_rowdata:writeInsert one row and return it as stored
update_rowsdata:writeUpdate the rows that match, return the first one
delete_rowdata:writeDelete the first row that matches
query_sqlsql:readOne read-only statement in a read-only transaction that is always rolled back
run_sqlsql:runAny SQL as the database owner, including writes, DDL and DROP
list_bucketsstorage:readStorage buckets of a project
list_objectsstorage:readOne folder level of a bucket (up to 1,000 entries)
create_bucketstorage:writeCreate a bucket, private unless public is true
delete_bucketstorage:writeDelete a bucket and every file in it
list_s3_keyssecrets:readS3 endpoint, region, bucket names and keys, never a secret
create_s3_keysecrets:writeCreate an S3 access key; the secret is in this answer only
revoke_s3_keysecrets:writeRevoke an S3 access key from its next request
list_auth_usersauth:readEnd users of the project's authentication, 100 per page

How access is enforced

  • Every request is checked afresh. The server keeps no session: a revoked or expired token is refused on its next request.
  • Projects are checked on every call. A tool that names a project only runs when the token's owner is a member of that project's team. A token limited to one team cannot reach any other team's project.
  • Read-only SQL is enforced by the database. query_sql accepts one SELECT, WITH, VALUES, TABLE or EXPLAIN statement, runs it in a read-only transaction and rolls it back, so a write hidden inside a function fails too.
  • No secrets. No tool returns a database password, a project key or a connection string, and no tool rotates or reveals keys or deletes a project. The one exception is create_s3_key (secrets:write): it returns the new key's secret once, as the dashboard does, and the audit log does not keep it.
  • Owner rights. Data and SQL tools act with the project owner's rights, as the dashboard does: row-level security does not filter them. run_sql can drop tables; give it only to agents you would trust in the SQL editor.
  • Limits. 120 requests per minute per token, at most 200 rows per page, and an answer longer than 100,000 characters is cut and says so.
  • Audit. Every tool call is recorded with the token, the tool, the project and the outcome — never the arguments.

Protocol details

  • Endpoint: POST https://api.basefyio.com/api/mcp (Streamable HTTP, stateless, JSON responses)
  • Authentication: Authorization: Bearer bf_pat_...; dashboard sessions are not accepted
  • A missing, revoked or expired token gets 401; a token with no MCP permission gets 403; a denied tool call returns an error result naming the reason