Skip to main content
Glama
Dealroot

Dealroot

README.md
# Dealroot — lead source tracking and an MCP server for WordPress

Dealroot is a WordPress plugin that saves every form enquiry with where it came from — the ad, campaign and keyword, the search engine, an AI assistant, a social network or another website, and every visit before the enquiry — and follows it to the sale.

It also runs its own **MCP server** (Model Context Protocol), so Claude, Cursor, VS Code and other AI assistants can answer questions about your leads from your own data:

> *Which campaigns brought customers in the last 30 days?*
> *What did the people who came from Google Ads this week ask for?*
> *Which landing page brings the most enquiries per visit?*

- Website: [dealroot.net](https://dealroot.net)
- Plugin on WordPress.org: [wordpress.org/plugins/dealroot](https://wordpress.org/plugins/dealroot/)
- Documentation: [dealroot.net/docs/ai-assistants](https://dealroot.net/docs/ai-assistants/)

## MCP tools

| Tool | What it does | Plan |
|---|---|---|
| `dealroot-get-report` | Visits, leads, won deals, revenue, profit, ad spend and contact clicks by channel, source, campaign, landing page or form, for a period | Free |
| `dealroot-list-leads` | Recent leads with contact details, status, deal value and source, filtered by status, period or a search term | Free |
| `dealroot-get-lead` | One lead with all its fields, its first and latest visit, the pages viewed before the enquiry and earlier enquiries from the same person | Free |
| `dealroot-update-lead-status` | Change the status and the deal value; a won deal is reported to the ad platforms | Pro |
| `dealroot-add-lead-note` | Add a dated note | Pro |
| `dealroot-assign-lead` | Choose the owner | Pro |
| `dealroot-schedule-follow-up` | Plan the date to get back to a lead | Pro |
| `dealroot-list-follow-ups` | Leads with a follow-up due | Pro |

The server speaks JSON-RPC over HTTP (the streamable HTTP transport, protocol versions 2024-11-05 to 2025-11-25). The same tools are registered as abilities of the WordPress Abilities API.

## Connect an assistant

Requirements: WordPress 6.9 or later, HTTPS, pretty permalinks, Dealroot 1.2.0 or later.

Copy the MCP address from **Leads → Settings → AI assistant**. It looks like `https://example.com/wp-json/dealroot/v1/mcp`. Assistants sign in with **OAuth**: you sign in to WordPress and click **Allow**, the assistant gets a token for the MCP address only.

### claude.ai and Claude Desktop

*Customize → Connectors* ([claude.ai/customize/connectors](https://claude.ai/customize/connectors)) → *+* → *Add custom connector*, paste the address, keep the detected sign-in settings, click *Add*, then *Connect* and allow Claude.

### ChatGPT

With developer mode on (*Settings → Apps & Connectors → Advanced*), create a connector with the address and OAuth.

### Claude Code

```sh
claude mcp add --transport http dealroot https://example.com/wp-json/dealroot/v1/mcp
```

Then `/mcp` → *dealroot* → sign in.

### Cursor

`~/.cursor/mcp.json`, then *Connect* in the MCP settings:

```json
{
  "mcpServers": {
    "dealroot": { "url": "https://example.com/wp-json/dealroot/v1/mcp" }
  }
}
```

### VS Code

`.vscode/mcp.json`:

```json
{
  "servers": {
    "dealroot": { "type": "http", "url": "https://example.com/wp-json/dealroot/v1/mcp" }
  }
}
```

### Over stdio, through WP-CLI

For clients that start a command, and for sites you reach by SSH: [`docker/stdio.php`](docker/stdio.php) reads one JSON-RPC message per line and answers through the same endpoint, as the WordPress user you name. No application password is needed.

```sh
scp docker/stdio.php example.com:dealroot-stdio.php
claude mcp add dealroot -- ssh example.com wp --path=/var/www/html eval-file dealroot-stdio.php --user=admin
```

### Try it in Docker

The [`Dockerfile`](Dockerfile) builds a throwaway WordPress on SQLite with the plugin from this repository and starts the server over stdio. It has no leads, so it is for trying the tools, not for your data.

```sh
docker build -t dealroot-mcp https://github.com/vicsorde-sketch/dealroot.git
claude mcp add dealroot -- docker run -i --rm dealroot-mcp
```

### Application password

For scripts and clients without OAuth: create an application password under **Users → Profile → Application passwords** and send `Authorization: Basic <base64 of user:application-password>`.

## How the sign-in works

Dealroot is its own OAuth 2.1 authorization server, as the MCP authorization spec asks:

- Protected resource metadata (RFC 9728) at `/wp-json/dealroot/v1/oauth-protected-resource` and `/.well-known/oauth-protected-resource`; a 401 from the MCP address points to it in `WWW-Authenticate`.
- Authorization server metadata (RFC 8414 and OpenID discovery paths).
- Client ID metadata documents and dynamic client registration (RFC 7591).
- Authorization code with PKCE (S256 only), `iss` in the response, resource indicators (RFC 8707).
- Access tokens for one hour, refresh tokens that change with every use, revocation (RFC 7009). Only hashes of tokens are stored.

## Security

The assistant works with the permissions of the WordPress user who allowed it: only users who may see leads can connect and read them, only users who may manage leads can change them. Connected assistants are listed in the AI assistant settings with a *Disconnect* button. Dealroot sends nothing anywhere by itself; it only answers when the assistant asks.

## What else Dealroot does

- Lead source on every enquiry from 25 form plugins and page builders (Contact Form 7, WPForms, Gravity Forms, Elementor, Fluent Forms, Ninja Forms, Formidable, WooCommerce and more), no hidden fields, works on cached pages
- Reports by channel and campaign, first and latest visit
- AI assistant that reads every enquiry, filters spam and drafts replies
- Dealroot Pro: offline conversions to Google Ads, Microsoft Advertising, Meta, TikTok and LinkedIn, ad spend and return on ad spend, CRM sync, won deals from paid invoices in Stripe, Lexware Office and sevDesk

## Source code

The whole plugin, MCP server included, is in [`plugin/`](plugin), the same code as on [WordPress.org](https://wordpress.org/plugins/dealroot/) (GPL-2.0-or-later):

- [`plugin/includes/class-mcp.php`](plugin/includes/class-mcp.php): the MCP server — JSON-RPC over streamable HTTP, `initialize`, `tools/list`, `tools/call`
- [`plugin/includes/class-abilities.php`](plugin/includes/class-abilities.php): the tools, registered as abilities of the WordPress Abilities API
- [`plugin/includes/class-oauth.php`](plugin/includes/class-oauth.php): the OAuth sign-in for assistants
- [`docker/stdio.php`](docker/stdio.php): the stdio transport through WP-CLI

Questions and ideas: open an issue here or write to hello@dealroot.net.

License: GPL-2.0-or-later.

TDQS

A3.7/5.0

Scored across 3 tools

Disambiguation5/5

The three tools target clearly separate shapes of data: an aggregated analytics report, a filtered collection of leads, and a single lead's full detail. An agent can easily decide between 'aggregate metrics' (get-report), 'find/list leads' (list-leads), and 'drill into one lead' (get-lead) with no overlap.

Naming Consistency5/5

All tools follow the same `dealroot-verb-noun` pattern (get-report, list-leads, get-lead), using a consistent kebab-case namespace prefix and standard verbs. There are no mixed conventions or vague verbs.

Tool Count3/5

Three tools is thin for a domain that spans leads, visits, deals, revenue, ad spend, campaigns and contacts. The surface is coherent but borderline minimal — a single reporting tool plus two lead-read tools leaves little room for adjacent operations.

Completeness3/5

Read-side coverage is reasonable (aggregate reporting, lead listing, lead detail), but there are notable gaps: no way to create or update a lead/status, no deal or campaign operations, and ad spend is only referenced as 'when imported' with no import tool. Agents can answer analysis questions but cannot act on the data.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues