Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
327 changes: 327 additions & 0 deletions integrations/mcp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
---
title: "MCP"
description: ""
---

Connect your AI tools to TabPFN using the [Model Context Protocol](https://modelcontextprotocol.io/) (MCP).

## What is TabPFN MCP?

TabPFN MCP is a remote MCP with OAuth that gives AI tools secure access to TabPFN-2.5, our SOTA tabular foundation model. Our MCP server is available at:

```
https://api.priorlabs.ai/mcp/server
```

It integrates with popular AI assistants like Claude, enabling you to run predictions using natural language. TabPFN MCP implements the latest
[MCP Authorization](https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization) and [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http) specifications.

<Note>
To use the TabPFN MCP you need a Prior Labs account. You can sign up or log in at [ux.priorlabs.ai](https://ux.priorlabs.ai).
</Note>

## Available tools

The TabPFN MCP Server exposes two core tools for performing classification and regression on Prior Labs’ managed GPU infrastructure:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we write what is the request schema for the tools? As we've learned, sometimes it's hard to find for end user and can cause confusion for Claude, esp. with enum values

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would personally keep it lightweight for the start and we can re-iterate on that if needed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that, but e.g. with n8n you don't see the schema as a person, and then you've seen that Claude often doesn't follow it from first try, which basically makes it extremely hard to build a flow that actually works repeatedly. If schema is exposed, it's easier to know a) what I can do with MCP b) how can I prompt my model to be more predictable


* `fit_and_predict` - Fit and generate predictions in a single step using TabPFN-2.5.
* `predict` - Generate predictions using a previously fitted model.

## Setup

Connect your AI client to TabPFN MCP and authorize access to run inference through a natural language interface.

#### Claude Code

```bash
# If you haven't, install Claude Code
npm install -g @anthropic-ai/claude-code

# Navigate to your project
cd your-tabpfn-project

# Add TabPFN MCP (general access)
claude mcp add --transport http tabpfn https://api.priorlabs.ai/mcp/server

# Start coding with Claude
claude

# Authenticate the MCP tools by typing /mcp
# This will trigger the OAuth flow
/mcp
```

#### Claude.ai and Claude for desktop

<iframe
className="w-full aspect-video rounded-xl"
src="https://www.youtube.com/embed/p-yNAqdWQIg"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
></iframe>

1. Open Settings in the sidebar
2. Navigate to Connectors and select Add custom connector
3. Configure the connector:
- Name: TabPFN
- URL: https://api.priorlabs.ai/mcp/server

<Note>
Custom connectors using remote MCP are available on Claude and Claude Desktop for users on Pro, Max, Team, and Enterprise plans.
</Note>

Alternatively, you may add the MCP server by editing the Claude Desktop config file:

1. Locate your Claude Desktop config file based on your operating system:
2. Get your API key from Prior Labs:
- Navigate to [ux.priorlabs.ai](https://ux.priorlabs.ai)
- Log in to your account (or sign up if you don't have one)
- Copy your API key from the dashboard
3. Edit the config file to add the TabPFN server:
```json
{
"mcpServers": {
"tabpfn": {
"url": "https://api.priorlabs.ai/mcp/server",
"headers": {
"Authorization": "Bearer YOUR_API_KEY_HERE"
}
}
}
}
```
4. Replace `YOUR_API_KEY_HERE` with your actual API key from step 2
5. Save the config file and restart Claude Desktop for the changes to take effect

#### ChatGPT

<iframe
className="w-full aspect-video rounded-xl"
src="https://www.youtube.com/embed/kMsvhawptgc"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
></iframe>

Follow these steps to set up TabPFN as a connector in ChatGPT:

1. Enable Developer mode:
- Go to Settings → Connectors → Advanced settings → Developer mode
2. Open ChatGPT settings
3. In the Connectors tab, `Create` a new connector:
- Give it a name: TabPFN
- MCP server URL: https://api.priorlabs.ai/mcp/server
- Authentication: OAuth
4. Click Create

<Note>
Custom connectors using MCP are available on ChatGPT for Pro and Plus accounts on the web.
</Note>

#### Codex CLI

Codex CLI is OpenAI's local coding agent that can run directly from your terminal.

```bash
# Install Codex
npm i -g @openai/codex

# Add TabPFN MCP
codex mcp add tabpfn --url https://api.priorlabs.ai/mcp/server

# Start Codex
codex
```

When adding the MCP server, Codex will detect OAuth support and open your browser to authorize the connection.

#### Cursor

To add TabPFN MCP to your Cursor environment, add the snippet below to your project-specific or global `.cursor/mcp.json` file manually. For more details, see the [Cursor documentation](https://docs.cursor.com/en/context/mcp).

```json
{
"mcpServers": {
"tabpfn": {
"url": "https://api.priorlabs.ai/mcp/server"
}
}
}
```

Once the server is added, Cursor will attempt to connect and display a Needs login prompt. Click on this prompt to authorize Cursor to access your Prior Labs account.

#### n8n

Watch the video below to learn how to integrate TabPFN with n8n workflows.

<iframe
className="w-full aspect-video rounded-xl"
src="https://www.youtube.com/embed/Po8r77MBmow"
title="YouTube video player"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
></iframe>

## Tool Reference

### `fit_and_predict`

<Info>
Fit the TabPFN-2.5 model on your data and generate predictions.
</Info>

Use this tool when you want to fit a new model from scratch. It fits on your data and immediately returns predictions for your test set, along with a `model_id` for future reuse.

#### Required Parameters

<ParamField path="X_train" type="Matrix" required>
Training features as a 2D array where rows represent samples and columns represent features.

- **Shape:** `(n_train_samples, n_features)`
- **Data types:** Numeric (int/float) or categorical (string) values
- **Flexibility:** Handles missing values, outliers, and mixed data types automatically

<Accordion title="Example">
```python
X_train = [
[1.5, "red", 3],
[2.0, "blue", 4],
[1.8, "red", 5]
]
```
</Accordion>
</ParamField>

<ParamField path="y_train" type="Vector" required>
Training targets as a 1D array that must align with `X_train` rows.

- **Shape:** `(n_train_samples,)`
- **Classification:** Class labels (e.g., `[0, 1, 0]` or `["cat", "dog", "cat"]`)
- **Regression:** Numeric values (e.g., `[23.5, 45.2, 12.8]`)
</ParamField>

<ParamField path="X_test" type="Matrix" required>
Test features as a 2D array for generating predictions.

- **Shape:** `(n_test_samples, n_features)`
- **Critical:** Must have the **same number of features** as `X_train`

<Accordion title="Example">
```python
X_test = [
[1.8, "red", 5],
[2.3, "green", 2]
]
```
</Accordion>
</ParamField>

<ParamField path="task_type" type="Literal" required>
Prediction task type. Must be specified explicitly.

- `"classification"` - For classification tasks.
- `"regression"` - For regression tasks.
</ParamField>

#### Optional Parameters

<ParamField path="output_type" type="String" default="preds">
Format of the prediction output.

- `"preds"` - Predicted class labels (classification) or mean values (regression)
- `"probas"` - Class probability distributions (**classification only**)

<Warning>
`output_type="probas"` is only valid for classification tasks and will return an error for regression.
</Warning>

<Accordion title="Example probability output">
```python
# For a binary classification problem
predictions = [
[0.8, 0.2], # 80% probability class 0, 20% class 1
[0.3, 0.7] # 30% probability class 0, 70% class 1
]
```
</Accordion>
</ParamField>

#### Returns

<ResponseField name="model_id" type="String">
Unique identifier for the fitted model. **Save this value** to reuse the model later with the `predict` tool.
</ResponseField>

<ResponseField name="predictions" type="Array">
Prediction results based on the specified `output_type`. Format varies by task type and output type.
</ResponseField>

---

### `predict`

<Info>
Generate new predictions using a previously fitted TabPFN model.
</Info>

Use this tool after calling `fit_and_predict` to make predictions on new data using an existing model.

#### Required Parameters

<ParamField path="model_id" type="String" required>
Identifier of a previously fitted model, returned from `fit_and_predict`.

<Accordion title="Example">
```python
model_id = "9f1526b2-388b-4849-b965-6373d35f1a6b"
```
</Accordion>
</ParamField>

<ParamField path="X_test" type="Matrix" required>
Test features as a 2D array for generating predictions.

- **Shape:** `(n_test_samples, n_features)`
- **Critical:** Must have the **same number of features** the model was originally fitted on

<Accordion title="Example">
```python
X_test = [
[1.2, "red", 7],
[3.4, "blue", 1]
]
```
</Accordion>
</ParamField>

<ParamField path="task_type" type="Literal" required>
Must match the task type the model was fitted for.

- `"classification"` - For classification tasks
- `"regression"` - For regression tasks
</ParamField>

#### Optional Parameters

<ParamField path="output_type" type="String" default="preds">
Format of the prediction output.

- `"preds"` - Predicted labels (classification) or values (regression)
- `"probas"` - Probability distributions (**classification models only**)

<Warning>
`output_type="probas"` only works with classification models.
</Warning>
</ParamField>

#### Returns

<ResponseField name="model_id" type="String">
Echo of the model ID used for prediction.
</ResponseField>

<ResponseField name="predictions" type="Array">
Prediction results based on the specified `output_type`.
</ResponseField>