MCP Server
Diafunc runs a Model Context Protocol (MCP) server, so an assistant or an agent that speaks MCP (such as Claude Desktop, an IDE assistant, or a custom agent) can work in your Diafunc account. It can create an analysis from a file, start the run and check on it, read the report, export a model as code, and work with the tables, functions and notebooks of your projects.
Tool names are stable. New tools and new optional arguments are added over time; the server's version is reported when a client connects.
Endpoint
The server's address is https://diafunc.com/mcp. It speaks the Streamable HTTP transport; clients that only know the older Server-Sent Events transport use https://diafunc.com/mcp/sse.
On connecting, the server tells the client what Diafunc does and how an analysis is run: create it, upload data, choose targets, start the run, wait, read the report.
Authentication
Every request carries an API token in an Authorization: Bearer dfat_... header. Tool calls run with the rights of the token, so what an MCP client can see and do is what the token may.
Create the token on your Account page, tab API tokens. It acts for your account across the projects you can reach. A token of one project works too and reaches that project only; it cannot create analyses, because every analysis gets a project of its own. A team token reaches the projects of its team. No token reaches account management: password, sign-in methods, billing and tokens.
See Authentication for the token kinds, scopes, and the error model.
Client configuration
Most MCP clients take a JSON entry with the server's address and the Authorization header. The snippet below registers Diafunc as a remote server; other clients use equivalent fields.
Client configuration
{
"mcpServers": {
"diafunc": {
"type": "http",
"url": "https://diafunc.com/mcp",
"headers": {
"Authorization": "Bearer dfat_..."
}
}
}
}A client with a command line, such as Claude Code, adds the server with one command:
Claude Code
claude mcp add --transport http diafunc https://diafunc.com/mcp \ --header "Authorization: Bearer dfat_..."
Replace dfat_... with your token. Revoking the token disables the connection at once.
Running an analysis
You can ask for the whole job in one sentence. Underneath, the assistant calls these tools in order:
1.create_analysis with a name, and optionally the targets and questions. It returns an analysisId.
2.upload_analysis_data with CSV text of up to 5 MB, or the HTTPS address of a file. get_analysis_columns then lists the columns. Larger files and other formats are uploaded in the app or with the command line.
3.update_analysis_targets names the columns to explain, unless they were given at creation. Questions, columns to leave out as inputs, and the time and credit budgets have tools of their own.
4.run_analysis starts the run and returns a runId at once. A run uses credits from your account, at most its credit budget.
5. An analysis is a long-running job: it takes from about an hour. The assistant starts it and checks on it with get_analysis_run; it does not wait inside one reply. The answer names the state, the phase and the step. You can follow the same run in the app.
6. When the run has completed, get_analysis_report returns the summary: the formula for each target, its quality on held-out rows, the concerns, and the titles of the chapters; with a chapter title it returns that chapter. export_model returns a target's model as a readable formula or as code in Python, R, SQL, JavaScript, Java, Kotlin, C or LaTeX.
Both reading tools work for your own analyses and for every public analysis. An analysis produces one model per target.
Capabilities
The server exposes three kinds of capabilities.
Tools: callable operations the client can invoke on your behalf. Tools are organized by domain:
Analyses: create an analysis, upload data, set targets and questions, start a run, check on it, read the report as text (the summary with formula, quality, concerns and answers, then chapter by chapter), and export a model as code. The owner's notes are read into proposals that apply only when confirmed; shape expectations, requested charts and the report's focus can be set directly. Schedules start runs at set times; saved presets keep settings to reuse. The tools mirror the Analysis API .
Projects: list, read, create, and delete projects; list and create project branches. Deleting a project is permanent, removes everything in it, and requires the project owner role.
Entities: create, read, update, and delete entities; the supported types are function, table, notebook, and text.
Functions: create and update functions, read their source code, run them, and read the result, the outputs, and the logs.
Tables: read a table, add, insert, clear and delete rows and columns, write cells, rename columns, and set column types.
Notebooks: read the outline of a notebook.
Content: download and upload the content attached to an entity, and read its content type.
Links: create, list, and remove relationships between entities.
Versions and triggers: list the versions of an entity and revert to one; list and remove the triggers of a function.
Data sources: connect a table or an analysis to an outside source, import from it, and read the imports; list the available source types.
Formula templates: add, read, list, change, and delete the templates the model search tries.
Search: search entities in a project, find public analyses by subject, and search the Diafunc documentation with search_docs.
Resources: every article of the Diafunc documentation corpus, under the diafunc:///docs/ scheme.
Prompts: analyzing a file, reading a finished analysis, and creating and running a function.
Tools that change something
Every tool carries a title and the standard MCP hints. Tools that only read are marked read-only; tools that delete, overwrite, cancel a run, publish, or spend credits are marked destructive, so your client asks you before calling them.
Credits are spent by run_analysis, execute_function, imports from data sources, and analysis schedules. Publishing an analysis with update_analysis_visibility publishes its whole project, including the uploaded data.
Limits
Each account may send 10 requests per second, with bursts up to 40; each network address 100 requests per second. Over either limit the server answers 429 with a Retry-After header that says how many seconds to wait. A reply holds at most 20,000 characters; a longer one says what it left out and how to read the rest, for example the next part of a report chapter.
Example requests
1. "List my Diafunc analyses and tell me which have finished."
2. "Read the report of my Diafunc analysis 'Wine quality' and tell me which inputs quality relies on. Quote the formula and its quality."
3. "Create a Diafunc analysis 'Concrete strength' from this CSV with strength as the target and start it. I will check back later."
4. "Where does my running Diafunc analysis stand?"
5. "Export the model of my analysis 'Concrete strength' as Python."
6. "Search the Diafunc documentation for how to leave a column out of an analysis."
Troubleshooting
401 Unauthorized: the token is missing, mistyped, expired or revoked. Create a new token and replace it in the client's configuration.
create_analysis is refused: the token belongs to one project. Use a token created on your Account page, or a team token.
The run is still running: an analysis takes from about an hour. Ask again later; get_analysis_run says where it stands.
The Language service
The MCP server is hosted by the platform's Language service, the component that also powers the built-in conversational assistant, including chat sessions, response streaming, file uploads, and token accounting. The Language service itself is an internal platform component: its REST endpoints are not a public API and may change without notice. The MCP server documented on this page is the supported surface for connecting language-driven tooling to the platform.
No MCP tool calls a language model, so the Assistant's token limits do not apply to the MCP server; search_docs counts a small amount against your Assistant quota.
See Assistant for how the assistant is used interactively from the Lab and the command line.