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.
| Tool | Permission | What it does |
|---|---|---|
list_teams | team:read | Your teams, your role in each and how many projects they hold |
list_projects | projects:read | Active projects of one team, or of every team the token can reach |
get_project | projects:read | One project's details. Keys and passwords are never returned |
list_tables | schema:read | Tables with their schema and row count |
describe_table | schema:read | Columns, types, primary key and foreign keys of a table |
select_rows | data:read | One page of rows (up to 200), with free-text search and sorting |
insert_row | data:write | Insert one row and return it as stored |
update_rows | data:write | Update the rows that match, return the first one |
delete_row | data:write | Delete the first row that matches |
query_sql | sql:read | One read-only statement in a read-only transaction that is always rolled back |
run_sql | sql:run | Any SQL as the database owner, including writes, DDL and DROP |
list_buckets | storage:read | Storage buckets of a project |
list_objects | storage:read | One folder level of a bucket (up to 1,000 entries) |
create_bucket | storage:write | Create a bucket, private unless public is true |
delete_bucket | storage:write | Delete a bucket and every file in it |
list_s3_keys | secrets:read | S3 endpoint, region, bucket names and keys, never a secret |
create_s3_key | secrets:write | Create an S3 access key; the secret is in this answer only |
revoke_s3_key | secrets:write | Revoke an S3 access key from its next request |
list_auth_users | auth:read | End 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_sqlaccepts 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_sqlcan 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 gets403; a denied tool call returns an error result naming the reason