Build a block with your AI agent: one HTML file written with the MCP Apps SDK, its state, theme, size and integration data, previewed on your machine, then registered, opened in a chat and published.
Building blocks is available on all Infa plans (Free, Pro, and Enterprise). Integration data needs a board connection, a Pro and Enterprise feature.
Anyone can build an App Block: it is one HTML file plus a handful of MCP tool calls. The fastest way is to hand the work to an AI agent. Infa gives you a ready-to-paste prompt, and the MCP server exposes the whole lifecycle from register to publish. This page describes the same contract the server hands to agents, so you can also write a block by hand.
Copy link
Overview
We at Infa write every block as a standard MCP App (the open format AI chats use for interactive panels, built on the @modelcontextprotocol/ext-apps SDK). That is what lets one file run in three places without a change: on your board (in a document, on a canvas, or as an App), on your machine with the Infa CLI, and inside an AI chat that renders MCP Apps.
Copy link
Build with an AI Agent
Copy Infa's ready-made prompt, which includes connection steps, this contract and your board ID:
On an App's picker, Generate this App copies a prompt that ends with the block set as that App's body. See Apps.
In the App Block picker (insert menu → App Block → Community tab), Copy prompt for your agent copies a prompt for a block you insert into a paper. The On this board tab has the same action in its footer.
Paste the prompt into Claude Code, Cursor, or any MCP-enabled agent and describe what the block should do. With the Infa plugin for Claude Code, the /infa:apps skill walks your agent through the same steps.
To set an agent up by hand instead:
Connect it to the Infa MCP server (HTTP transport, OAuth login on first call, no API key):
Claude Code
Copy code
Copy code
claude mcp add --transport http Infa https://infa.ai/api/mcp
Other MCP clients: add an HTTP server with the URL https://infa.ai/api/mcp. For stdio-only clients, use npx -y mcp-remote https://infa.ai/api/mcp. See MCP Server.
Have the agent call the infa_appBlockGuide tool. It returns the server's current version of the contract below. Fetch it before building or updating a block.
Copy link
Talk to the Host with the SDK
A block is one self-contained HTML document: inline CSS and JavaScript. The one import is the MCP Apps SDK, imported by its bare name. Infa adds the import map that resolves it to a copy Infa serves, so the file needs no network for it.
block.html
Copy code
Copy code
<!doctype html>
<html>
<head>
<style>
html, body { margin: 0; background: var(--color-background-primary, #fff); }
Settings (props) arrive as the tool input, through ontoolinput. A change of settings reloads the block.
Host context comes from app.getHostContext(), then onhostcontextchanged on every change: theme (light or dark), styles.variables (the host's colours, fonts and corner radii), containerDimensions, locale and timeZone.
Links open with app.openLink({ url }), never with <a target="_blank">.
Copy link
Match the Host's Theme
A block runs in a sandbox: it cannot read Infa's styles, and prefers-color-scheme follows the operating system, not Infa's light or dark setting. Take every colour from the host instead:
Apply styles.variables with applyHostStyleVariables, as above, and style with them: var(--color-background-primary) for the page, var(--color-background-secondary) for cards, var(--color-text-primary) and var(--color-text-secondary) for text, var(--color-border-secondary) for borders, var(--color-text-info) for accents, var(--border-radius-lg) for corners, var(--font-sans) for type.
Give each variable a fallback, such as var(--color-text-primary, #161616), for a host that sends none.
Give html and body the page background and no border, so the block reads as part of the page.
Copy link
Fit the Frame
On an App page the block is the page. It gets a 4:3 frame as wide as the page column (in Full view, as large as fits the screen), and containerDimensions has its width and height. Fill exactly that: height: 100% from html down and a grid that divides the height, with no page scrollbar. Let long lists scroll inside their own panel. Check it at 1024 × 768 and at 480 × 360.
In a document, on a canvas or in a chat the frame follows the block's height. The SDK reports the height on its own.
Copy link
Save State
A block keeps state through two tools Infa answers for it:
// or replace all of it: arguments: { state: { count: 0, done: [] } }
There is one state per block on the board, shared by everyone who sees it and saved with the block. In a chat it is saved in the App's paper. Where state cannot be saved (a guest on a published board, a reader who cannot edit), infa_setAppState answers with an error, so show the read-only state.
Copy link
Read Your Board
A block can read its own board's components, screens and flows as they are right now, so an App can show a component's anatomy, a screen's states or a flow's scenarios its own way, with real data:
board data
Copy code
Copy code
// The board's components: id, title, description, default picture, page link
if (read.isError) showError(read.content?.[0]?.text);
else render(read.structuredContent.item);
kind
infa_readBoardData returns
component
its views (title, isDefault, screenshot, anatomy: its parts with their boxes, screenId: where it is used) and its declared props
screen
its views: its states, each with its screenshot and persona
flow
its scenarios (kind, persona, lastRun, the screenIds they pass through) and its screens
A block reads only its own board, as the person viewing it. A member sees what they see on the board; a guest on a published board sees what guests may, which leaves out flow scenarios. On your machine a block has no board, so these calls answer with an error.
To let people choose what the block reads, declare the setting with "format": "infa-component-id" (or "infa-screen-id", "infa-flow-id"). Configure then shows a picker of the board's components, screens or flows.
Copy link
Keep the HTML a Template
We at Infa recommend putting no data in a block's HTML. Read everything when the block loads: board data, integration data (below), several requests at once with Promise.all. Offer a Refresh button that reads it all again, so the block always shows what is true now, and a change on the board or in GitHub shows up without anyone editing the block.
Copy link
Get Integration Data
A block cannot fetch a provider's API itself. Ask Infa, which calls the provider with the viewing person's session and the connection bound in the block's settings:
connection request
Copy code
Copy code
const result = await app.callServerTool({
name: "infa_connectorRequest",
arguments: {
connectorId: props.connectorId, // always from a setting, never hardcoded
path: "/repos/owner/repo/pulls?state=open",
// method: "POST", body: { ... } for providers that need it
},
});
if (result.isError) showError(result.content?.[0]?.text);
else render(result.structuredContent.data);
Supported: GitHub, Figma and Slack (GET); Notion (GET and POST); Linear (POST /graphql). The connection must be on the block's own board.
Never hardcode a connection ID or a credential. Take the connection as a setting, and declare it in inputSchema with "format": "infa-connector-id", so Infa shows a dropdown of the board's connections:
inputSchema excerpt
Copy code
Copy code
{
"type": "object",
"properties": {
"connectorId": {
"type": "string",
"title": "GitHub connection",
"format": "infa-connector-id"
}
},
"required": ["connectorId"]
}
Declare the providers you use in contextHints.connections (for example ["github"]), so listings badge the block as needing a connection.
On an App the board agent chosen under Answered by in Configure answers. The person confirms each message, a run is queued, and the agent's report comes back through ontoolresult. In a chat the message lands in the conversation. Offer the action only when getHostCapabilities()?.message says the host takes messages. To tell the agent what the block shows without sending a message, call app.updateModelContext(...); it goes with the next message.
A block reaches only infa_getAppState, infa_setAppState, infa_connectorRequest, infa_listBoardData and infa_readBoardData. Any other tool is refused.
Copy link
Name What a Comment Is On
People can pin comments on an App, on its page and in a chat. A pin is most useful when it says what it is on, so give the block a tool of its own, describe_point. Infa calls it with the click in the block's CSS pixels (x, y) and in percent (xPercent, yPercent), and the label you return names the pin: "Checkout card" instead of "pin (40%, 22%)". There is no zod in the sandbox, so describe the arguments with a small schema of your own:
Register it before app.connect(), so the host knows about it, and answer within a second and a half. Where there is nothing worth naming, throw: the pin is still placed, without a name. Infa also keeps the block's saved state with each comment, so the agent knows what the person was looking at.
Copy link
What a Block May Load
Infa runs every block under a security policy:
✓ Inline scripts and styles, and the SDK Infa serves
✓ Fonts and stylesheets from Google Fonts
✓ Images and media from any https: address, data: and blob:
✗ fetch, XHR or WebSocket requests to anywhere
✗ A script from a CDN, such as a charting library loaded with <script src>
✗ Nested frames, form submissions and eval
These are refused silently, so a block that loads a library from a CDN shows up blank. Paste the library inline or draw with SVG, and get data from settings, state or infa_connectorRequest.
Copy link
Build and Preview Locally
You can build and check a block on your machine before anything reaches a board, with no Infa account:
Save the block as a file whose name ends in .app.html, anywhere in your repository (for example apps/release-checklist.app.html).
Run the Infa CLI on it:
npx infa preview apps/release-checklist.app.html
Your browser opens the local board at infa.ai/local with the App in the same 4:3 frame and theme a board App gets. Save the file and the page reloads it.
The local board lists every .app.html file of the repository beside your docs and components. A local App keeps its state for the open page only; it has no connections and no agent. A file larger than 5 MB is refused.
Copy link
Lifecycle (Infa MCP Tools)
Step
Tool
Fetch the contract
infa_appBlockGuide: the server's current version of this page
Register
infa_registerAppBlock{ boardId, name, description, icon, category, sourceHtml, inputSchema?, defaultProps?, contextHints? }: returns a blockTypeId and installs the block on the board
Preview
infa_appBlockPreview{ blockTypeId, props?, storage? }: runs the block in a chat panel
Iterate
infa_updateAppBlock{ blockTypeId, ...changedFields }: updates in place; never register duplicates
Make it an App
infa_createPaper{ type: "app", app: { appBlockTypeId, props?, state? } }: a new App page with the block as its body, starting from state
Insert in a paper
infa_insertAppBlock: embeds the block in a document or canvas paper
Open in a chat
infa_openApp{ paperId } for an App, or { blockTypeId, props? } for a block type. Open it by its App to see real data: a block type on its own has no board, so no board or integration data
Read comments
infa_getAppFeedback{ paperId }: the comments people pinned on the App, with where each sits, what the block said is there and its state at the time; reply with infa_createCommentReply, then resolve with infa_resolveCommentThread
List connections
infa_listConnections{ boardId }: the board's connections, bound to a block in its settings
Publish
infa_publishAppBlock{ blockTypeId, visibility: "published" }: shares the block with the community; "board" takes it back
Updates apply immediately
There is no version pinning yet: every existing install renders the new source the moment you update it, including installs on other people's boards if the block is published. Preview before updating a widely installed block.
Copy link
Quality Bar
Before publishing to the community, check that your block clears the same bar as Infa's own blocks:
Escape all data you put into HTML (use textContent or an esc() helper). Settings, state and API responses are untrusted.
Follow the host's theme: every colour from a host variable, updated on every context change. Do not rely on prefers-color-scheme.
Fill the 4:3 frame on an App page with no page scrollbar.
Handle the empty state (no settings yet) with a short placeholder that says what to configure.
Validate settings, and list required ones in inputSchema.required.
Never embed credentials, tokens, or personal data in the source. Published blocks are public.
Copy link
Blocks Written Before the SDK
Older blocks talk to the host with Infa's own infa:* messages instead of the SDK, and every Infa surface still answers them. infa_registerAppBlock warns when a block uses them. Write new blocks with the SDK; to keep an older one working:
A block receives (on window, as message events): infa:props (its settings, on load and on every edit), infa:theme (Infa's light or dark theme as CSS values), infa:context (where it is shown, and its frame) and infa:storage (its saved state).
It sends with window.parent.postMessage(message, "*"): { type: "infa:ready" } once its listener is set (Infa then sends the theme, context, settings and state again, so a block that starts listening late misses nothing), { type: "infa:resize", height } after each render (not on an App page), { type: "infa:storage-update", detail: { key, value } } to save one key, and { type: "infa:connector-request", requestId, connectorId, request: { path, method?, body? } } for integration data, answered with infa:connector-response.
Building Apps and App Blocks
Building blocks is available on all Infa plans (Free, Pro, and Enterprise). Integration data needs a board connection, a Pro and Enterprise feature.
Anyone can build an App Block: it is one HTML file plus a handful of MCP tool calls. The fastest way is to hand the work to an AI agent. Infa gives you a ready-to-paste prompt, and the MCP server exposes the whole lifecycle from register to publish. This page describes the same contract the server hands to agents, so you can also write a block by hand.
We at Infa write every block as a standard MCP App (the open format AI chats use for interactive panels, built on the
@modelcontextprotocol/ext-appsSDK). That is what lets one file run in three places without a change: on your board (in a document, on a canvas, or as an App), on your machine with the Infa CLI, and inside an AI chat that renders MCP Apps.Copy Infa's ready-made prompt, which includes connection steps, this contract and your board ID:
Paste the prompt into Claude Code, Cursor, or any MCP-enabled agent and describe what the block should do. With the Infa plugin for Claude Code, the
/infa:appsskill walks your agent through the same steps.To set an agent up by hand instead:
Connect it to the Infa MCP server (HTTP transport, OAuth login on first call, no API key):
Other MCP clients: add an HTTP server with the URL
https://infa.ai/api/mcp. For stdio-only clients, usenpx -y mcp-remote https://infa.ai/api/mcp. See MCP Server.Have the agent call the
infa_appBlockGuidetool. It returns the server's current version of the contract below. Fetch it before building or updating a block.A block is one self-contained HTML document: inline CSS and JavaScript. The one import is the MCP Apps SDK, imported by its bare name. Infa adds the import map that resolves it to a copy Infa serves, so the file needs no network for it.
ontoolinput. A change of settings reloads the block.app.getHostContext(), thenonhostcontextchangedon every change:theme(light or dark),styles.variables(the host's colours, fonts and corner radii),containerDimensions,localeandtimeZone.app.openLink({ url }), never with<a target="_blank">.A block runs in a sandbox: it cannot read Infa's styles, and
prefers-color-schemefollows the operating system, not Infa's light or dark setting. Take every colour from the host instead:styles.variableswithapplyHostStyleVariables, as above, and style with them:var(--color-background-primary)for the page,var(--color-background-secondary)for cards,var(--color-text-primary)andvar(--color-text-secondary)for text,var(--color-border-secondary)for borders,var(--color-text-info)for accents,var(--border-radius-lg)for corners,var(--font-sans)for type.var(--color-text-primary, #161616), for a host that sends none.htmlandbodythe page background and no border, so the block reads as part of the page.containerDimensionshas its width and height. Fill exactly that:height: 100%fromhtmldown and a grid that divides the height, with no page scrollbar. Let long lists scroll inside their own panel. Check it at 1024 × 768 and at 480 × 360.A block keeps state through two tools Infa answers for it:
There is one state per block on the board, shared by everyone who sees it and saved with the block. In a chat it is saved in the App's paper. Where state cannot be saved (a guest on a published board, a reader who cannot edit),
infa_setAppStateanswers with an error, so show the read-only state.A block can read its own board's components, screens and flows as they are right now, so an App can show a component's anatomy, a screen's states or a flow's scenarios its own way, with real data:
kindinfa_readBoardDatareturnscomponentviews(title,isDefault,screenshot,anatomy: its parts with their boxes,screenId: where it is used) and its declaredpropsscreenviews: its states, each with itsscreenshotandpersonaflowscenarios(kind, persona,lastRun, thescreenIdsthey pass through) and itsscreensA block reads only its own board, as the person viewing it. A member sees what they see on the board; a guest on a published board sees what guests may, which leaves out flow scenarios. On your machine a block has no board, so these calls answer with an error.
To let people choose what the block reads, declare the setting with
"format": "infa-component-id"(or"infa-screen-id","infa-flow-id"). Configure then shows a picker of the board's components, screens or flows.We at Infa recommend putting no data in a block's HTML. Read everything when the block loads: board data, integration data (below), several requests at once with
Promise.all. Offer a Refresh button that reads it all again, so the block always shows what is true now, and a change on the board or in GitHub shows up without anyone editing the block.A block cannot fetch a provider's API itself. Ask Infa, which calls the provider with the viewing person's session and the connection bound in the block's settings:
Supported: GitHub, Figma and Slack (GET); Notion (GET and POST); Linear (POST
/graphql). The connection must be on the block's own board.Never hardcode a connection ID or a credential. Take the connection as a setting, and declare it in
inputSchemawith"format": "infa-connector-id", so Infa shows a dropdown of the board's connections:Declare the providers you use in
contextHints.connections(for example["github"]), so listings badge the block as needing a connection.A block can hand a request to an agent:
On an App the board agent chosen under Answered by in Configure answers. The person confirms each message, a run is queued, and the agent's report comes back through
ontoolresult. In a chat the message lands in the conversation. Offer the action only whengetHostCapabilities()?.messagesays the host takes messages. To tell the agent what the block shows without sending a message, callapp.updateModelContext(...); it goes with the next message.A block reaches only
infa_getAppState,infa_setAppState,infa_connectorRequest,infa_listBoardDataandinfa_readBoardData. Any other tool is refused.People can pin comments on an App, on its page and in a chat. A pin is most useful when it says what it is on, so give the block a tool of its own,
describe_point. Infa calls it with the click in the block's CSS pixels (x,y) and in percent (xPercent,yPercent), and thelabelyou return names the pin: "Checkout card" instead of "pin (40%, 22%)". There is no zod in the sandbox, so describe the arguments with a small schema of your own:Register it before
app.connect(), so the host knows about it, and answer within a second and a half. Where there is nothing worth naming, throw: the pin is still placed, without a name. Infa also keeps the block's saved state with each comment, so the agent knows what the person was looking at.Infa runs every block under a security policy:
https:address,data:andblob:fetch, XHR or WebSocket requests to anywhere<script src>evalThese are refused silently, so a block that loads a library from a CDN shows up blank. Paste the library inline or draw with SVG, and get data from settings, state or
infa_connectorRequest.You can build and check a block on your machine before anything reaches a board, with no Infa account:
Save the block as a file whose name ends in
.app.html, anywhere in your repository (for exampleapps/release-checklist.app.html).Run the Infa CLI on it:
Your browser opens the local board at
infa.ai/localwith the App in the same 4:3 frame and theme a board App gets. Save the file and the page reloads it.The local board lists every
.app.htmlfile of the repository beside your docs and components. A local App keeps its state for the open page only; it has no connections and no agent. A file larger than 5 MB is refused.infa_appBlockGuide: the server's current version of this pageinfa_registerAppBlock{ boardId, name, description, icon, category, sourceHtml, inputSchema?, defaultProps?, contextHints? }: returns ablockTypeIdand installs the block on the boardinfa_appBlockPreview{ blockTypeId, props?, storage? }: runs the block in a chat panelinfa_updateAppBlock{ blockTypeId, ...changedFields }: updates in place; never register duplicatesinfa_createPaper{ type: "app", app: { appBlockTypeId, props?, state? } }: a new App page with the block as its body, starting fromstateinfa_insertAppBlock: embeds the block in a document or canvas paperinfa_openApp{ paperId }for an App, or{ blockTypeId, props? }for a block type. Open it by its App to see real data: a block type on its own has no board, so no board or integration datainfa_getAppFeedback{ paperId }: the comments people pinned on the App, with where each sits, what the block said is there and its state at the time; reply withinfa_createCommentReply, then resolve withinfa_resolveCommentThreadinfa_listConnections{ boardId }: the board's connections, bound to a block in its settingsinfa_publishAppBlock{ blockTypeId, visibility: "published" }: shares the block with the community;"board"takes it backBefore publishing to the community, check that your block clears the same bar as Infa's own blocks:
textContentor anesc()helper). Settings, state and API responses are untrusted.prefers-color-scheme.inputSchema.required.Older blocks talk to the host with Infa's own
infa:*messages instead of the SDK, and every Infa surface still answers them.infa_registerAppBlockwarns when a block uses them. Write new blocks with the SDK; to keep an older one working:A block receives (on
window, asmessageevents):infa:props(its settings, on load and on every edit),infa:theme(Infa's light or dark theme as CSS values),infa:context(where it is shown, and its frame) andinfa:storage(its saved state).It sends with
window.parent.postMessage(message, "*"):{ type: "infa:ready" }once its listener is set (Infa then sends the theme, context, settings and state again, so a block that starts listening late misses nothing),{ type: "infa:resize", height }after each render (not on an App page),{ type: "infa:storage-update", detail: { key, value } }to save one key, and{ type: "infa:connector-request", requestId, connectorId, request: { path, method?, body? } }for integration data, answered withinfa:connector-response.