AI Integration
Agents can work with pen.dev in two ways:
- Use an integrated agent from the desktop app
- Connect an external MCP client to a running pen.dev desktop or IDE host
Use an integrated agent
Open or create a .pen document in the desktop app. Choose a model, then
enter a request in the agent composer.
See Authentication for account and provider setup and AI agents and Skills for sessions, context, skills, and design variants in the desktop app.
Set up a custom provider (desktop)
- Open Settings → Agents and select Add custom provider
- Enter a Name and Base URL, then select the endpoint’s API type: OpenAI Completions, OpenAI Responses or Anthropic Messages
- Enter the endpoint’s API key and Model ID
- Set Context window and Max tokens to the limits supported by your model
- Select Add provider, close Settings, and choose the model in the agent composer
- Send a short request to check that the endpoint responds
For OpenAI Completions, expand Advanced to match the endpoint’s request
format. For example, Output token parameter lets you choose max_tokens
or max_completion_tokens. Leave other options on Automatic unless your
provider requires a specific setting.
To edit the configuration, open the provider’s entry and select Save changes after editing. Select Remove to remove the custom provider.
Add MCP tools to an integrated agent
In the desktop app, open Settings → MCP → Add MCP servers to pen.dev. Under Popular, click a server to add it. Clicking it again removes it. These changes save immediately.
For a server you configure manually, open MCP servers JSON and add its
entry inside mcpServers, alongside any servers you already use. For a local
server, use the command and arguments from its setup instructions. For example,
if you run your server with Node, the entry looks like this:
{
"mcpServers": {
"design-tools": {
"command": "node",
"args": ["/absolute/path/to/server.mjs"]
}
}
}Replace the example path with the path to your server and select Save.
Start a new agent conversation and ask it to use a tool the server provides.
If Save reports an error, check that each entry has a command or url.
The name pencil is reserved. To remove one server, delete just its entry and
select Save. Reset clears the entire list after confirmation.
Connect an external MCP client
- Install the pen.dev desktop app or IDE extension
- Open the
.pendocument the agent should use - Enable the client in Settings → MCP
- Start or reload the external client
- Confirm that
pencilappears in the client’s MCP server list
See Installation for Claude Code, ChatGPT and Codex setup.
Continue with Create your first design to try your connected agent.
MCP tools
The public server registers these top-level tools:
| Tool | Availability |
|---|---|
get_style | Standard |
read_skill | Standard |
get_app_state | Standard |
execute | Standard |
comments | Standard. Works on shared documents open in the desktop app, or in the web app for viewers who can comment. Only the owner can resolve. In headless pen runs, it works for the account that shared the file. Posts carry an [AI] prefix |
save | Unless the MCP server starts with --disable_save_tool |
browser | When the MCP server targets the desktop app |
spawn_agents | Only when the MCP server starts with --enable_spawn_agents |
Check the client’s live tool list for the tools in your installed version.
The external client communicates with the MCP server over stdio. The server connects to the running pen.dev app through a local Unix socket on macOS/Linux or a named pipe on Windows.
Troubleshooting
The integrated agent has no model
Open Settings → Agents and check the selected provider.
The external client cannot connect
- Confirm pen.dev is running and a
.pendocument is open - Reload the client after changing its MCP configuration
For missing tools, failed calls, or configuration changes, see MCP troubleshooting.
A documented tool is missing
Inspect the live tool list. browser, spawn_agents and save are conditional.
An agent is using the wrong document
Open the intended .pen file and include its full path in your prompt. Ask the
agent to check get_app_state() and confirm the active document before editing.