MCP server
DataPad can run a local Model Context Protocol (MCP) server so an AI agent on the same machine can read your connections and scripts and answer questions about using DataPad. The server is off by default and **Pro**-gated.
MCP server
DataPad can run a local Model Context Protocol (MCP) server so an AI agent on the same machine can read your connections and scripts and answer questions about using DataPad. The server is off by default and Pro-gated.
Enable the server
Open Settings → MCP server and tick Enable the MCP server. The section reports the live status:
whether the server is running and the URL, for example http://127.0.0.1:29211/mcp.
- The Port defaults to
29211. If it is busy, DataPad scans forward for the next free port and reports the one it actually bound. - The server binds 127.0.0.1 only, so it is never reachable from another machine.
Security
The endpoint is localhost-only and additionally protected:
- every request must carry the bearer token the section shows,
- a request carrying an
Originheader (a browser cross-origin request) is refused, and - a request whose
Hostheader is not loopback is refused.
The token is created once, on the first time the server starts, and kept across restarts — so the agent configuration you paste once stays valid and you do not have to re-copy it after every launch. It is stored in DataPad’s own local settings folder (plain text, alongside your connections), which is local to your account only. If the token ever leaks, regenerate it from Settings → MCP server and update the agent configuration with the new value.
Connect an agent
The Connect an agent area provides a copy-ready configuration snippet for the supported clients (for example OpenCode and Claude Desktop), including the URL and the current token. Open the client’s config file at the path DataPad names, paste the snippet, and restart the client so it connects.
Choose which scripts an agent may read
Under Scripts agents may read:
- Open scripts only (recommended) — every open script is visible unless you mark it Never on its tab.
- Only scripts marked Always allowed — only scripts you mark Always allowed (and scripts an agent creates) are visible.
- No scripts — the agent cannot read any script.
Right-click a script tab (or use its tab menu) to set a per-script access override: Default, Always allowed, or Never. A saved script’s override is persisted; an unsaved tab’s override lives with its autosave entry.
Tools
Each tool has its own switch under Tools. A switch is hot: turning a tool off takes effect with no restart, and calling a switched-off tool returns a “this tool is disabled” result rather than the tool silently disappearing. The tools are:
- list_connections — lists your connections by id, name, and type, never the connection string.
- get_connection_schema — returns a connection’s raw (database-spelled) and C#-named schema trees.
- list_open_scripts — lists the open scripts the agent may see (id and name).
- get_code_from_script — returns one script’s code, usings, and packages.
- create_script — creates a new open script, optionally with packages and an attached connection.
- update_script — updates an open script’s code and usings and adds or removes its packages.
- list_help_topics — lists the in-app How-To topics as id, title, and description summaries, with an optional query.
- get_help_topic — returns one How-To topic’s markdown and sections by id, optionally narrowed by a query.
The list_help_topics and get_help_topic tools read the same instructions as the in-app Help → How to… dialog, so the agent and the UI cannot disagree.
Agent-created scripts
An agent can create or update a script. Such a change arrives in the app as a new or updated tab (the agent-created default is Always allowed), so you see exactly what was changed. The script visibility setting and the per-script override are both honoured on every read.