# MCP Server

This guide explains how to integrate an **authenticated MCP server** (e.g. your product MCP, sitting behind OAuth or login) with Reo.Dev using the **MCP Intent Gateway**. The integration is lightweight, non-intrusive, and requires no changes to developer workflows beyond embedding our SDK in your codebase.

{% hint style="info" %}
**Looking for the open / docs MCP integration?** If your MCP is public and not behind authentication, see the existing [**How to integrate Docs MCP Gateway with Reo.Dev**](https://docs.reo.dev/integrations/how-to-integrate-mcp-gateway-with-reo.dev) guide.
{% endhint %}

***

### **Overview**

<figure><img src="/files/fcF70fA4n26YLbupreY1" alt=""><figcaption></figcaption></figure>

***

### **Quickstart**

#### 1) Installation

{% tabs %}
{% tab title="python" %}

```python
pip install reo-census-mcp
```

* <https://pypi.org/project/reo-census-mcp/>&#x20;
  {% endtab %}

{% tab title="node" %}

```javascript
npm install reo-census-mcp
```

* <https://www.npmjs.com/package/reo-census-mcp>
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}
**Need another language?** Python & npm is supported. Go, and other languages support are next. [**Request an SDK for your stack →**](https://forms.gle/1J8oRcnj5f4UQr7H7). We prioritise by customer demand.
{% endhint %}

***

#### **2) Setup your Reo API key**

Generate a **Product Usage API key** in the Reo.Dev dashboard: [**\[Link\]**](https://web.reo.dev/dashboard/settings/apiKeys)

<figure><img src="/files/Jj7CrlcJMlRjaCVhfLRb" alt=""><figcaption><p>Settings → Configurations → API Keys</p></figcaption></figure>

**Expose it as an environment variable in your codebase. Example:**

```jsx
export REO_API_KEY="your-api-key"
```

***

#### **3) Send data to Reo.Dev**

{% tabs %}
{% tab title="python" %}

```python
from reo_census_mcp import ReoProductUsageLogger

logger = ReoProductUsageLogger(
	activity_type="MCP_TOOL_CALL",
	user_id="\\<USER_EMAIL\\>",
	user_id_type="EMAIL",
	product_id="reoWebApp",
	meta=\\{"prompts": "\\<captured_prompt_text\\>"\\},
)

ok = logger.log_usage()  # non-blocking by default (blocking=False)
```

{% endtab %}

{% tab title="Node" %}

```javascript
import { ReoProductUsageLogger } from "reo-census-mcp";

const logger = new ReoProductUsageLogger({
  activityType: "MCP_TOOL_CALL",
  userId: "<USER_EMAIL>",
  userIdType: "EMAIL",
  productId: "reoWebApp",
  meta: { prompts: "<captured_prompt_text>" },
});

const ok = logger.logUsage(); // non-blocking by default; boolean
```

{% endtab %}
{% endtabs %}

You can send **two activity types**:

* **`MCP_IDENTITY_CAPTURE`** — fire once, at login or first authenticated request, to register the user against your `product_id`.
* **`MCP_TOOL_CALL`** — fire on every MCP tool invocation, with the tool name, arguments, and any custom fields you want to track.

#### **3.1) Example Payloads**

**Identity Capture Sample Payload**

{% tabs %}
{% tab title="python" %}

```python
from reo_census_mcp import ReoProductUsageLogger

logger = ReoProductUsageLogger(
    activity_type="MCP_IDENTITY_CAPTURE",
    user_id="rachel@reo.dev",
    user_id_type="EMAIL",
    product_id="reoWebApp"
)
logger.log_usage()  # non-blocking by defaul
```

{% endtab %}

{% tab title="node" %}

```javascript
import { ReoProductUsageLogger } from "reo-census-mcp";

const logger = new ReoProductUsageLogger({
  activityType: "MCP_IDENTITY_CAPTURE",
  userId: "rachel@reo.dev",
  userIdType: "EMAIL",
  productId: "reoWebApp",
});

logger.logUsage(); // non-blocking by default
```

{% endtab %}
{% endtabs %}

**Tool call sample**

{% tabs %}
{% tab title="python" %}

```python
from reo_census_mcp import ReoProductUsageLogger

logger = ReoProductUsageLogger(
    activity_type="MCP_TOOL_CALL",
    user_id="rachel@reo.dev",
    user_id_type="EMAIL",
    product_id="reoWebApp",
    meta={
        # Required: the MCP tool that was invoked + its arguments
        "tool": "execute_open_data_query",
        "tool_arguments": {
            "query": "WITH recent_new AS (SELECT company_name, company_domain ...)",
            "prompt": "find companies moving to ruby on rails in last 1 month",
        },
        # Optional custom fields — anything you add here surfaces in Reo.Dev
        "mode": "authenticated",
        "duration_ms": 5072.52,
        "reo_mcp_client": True,
    }
)
logger.log_usage()
```

{% endtab %}

{% tab title="node" %}

```javascript
import { ReoProductUsageLogger } from "reo-census-mcp";

const logger = new ReoProductUsageLogger({
  activityType: "MCP_TOOL_CALL",
  userId: "rachel@reo.dev",
  userIdType: "EMAIL",
  productId: "reoWebApp",
  meta: {
    // Required: the MCP tool that was invoked + its arguments
    tool: "execute_open_data_query",
    tool_arguments: {
      query: "WITH recent_new AS (SELECT company_name, company_domain ...)",
      prompt: "find companies moving to ruby on rails in last 1 month",
    },
    // Optional custom fields — anything you add here surfaces in Reo.Dev
    mode: "authenticated",
    duration_ms: 5072.52,
    reo_mcp_client: true,
  },
});

const ok = await logger.logUsage();
```

{% endtab %}
{% endtabs %}

***

#### **4) Constructor parameters**

| **Parameter**   | **Description**                                                                                                                                                                                                                                                                 | **Type** | **Required** | **Allowed values**                                                                                                          |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | ------------ | --------------------------------------------------------------------------------------------------------------------------- |
| `activity_type` | Reo.Dev supports two activity types. **`MCP_IDENTITY_CAPTURE`** registers the authenticated user — fire it during login or on the first authenticated request. **`MCP_TOOL_CALL`** logs the tool the user invoked through your MCP server, along with the prompt and arguments. | string   | Yes          | `"MCP_IDENTITY_CAPTURE"`, `"MCP_TOOL_CALL"`                                                                                 |
| `user_id`       | The authenticated user's identifier (e.g. email address).                                                                                                                                                                                                                       | string   | Yes          | users email(e.g. `rachel@reo.dev`), linkedin(e.g. `https://linkedin.com/in/rachel-smith`) or github id(e.g. `rachel-smith`) |
| `user_id_type`  | Type of the user identifier. Use "EMAIL" when passing an email address. Valid ID types are - `EMAIL`, `LINKEDIN`, `GITHUB`                                                                                                                                                      | string   | Yes          | `EMAIL`, `LINKEDIN` , `GITHUB` based on user\_id entry                                                                      |
| `product_id`    | The product or application identifier registered in the REO platform.                                                                                                                                                                                                           | string   | Yes          | Unique slug kind of name for application                                                                                    |
| `meta.prompts`  | Custom payload. For `MCP_TOOL_CALL`, include `tool` and `tool_arguments` at minimum. Add any custom fields you want to track.                                                                                                                                                   | dict     | No           | JSON payload containing additional metadata of calls being made to MCP took                                                 |
| `blocking`      | When `False` (default), `log_usage()` queues the event and returns immediately. Set `True` only if you need confirmation in-line.                                                                                                                                               | bool     | No           | `True`, `False`                                                                                                             |

***

#### **5) Supported environment variables**

| **Variable**                                 | **Role**                                                                         | **Required** |
| -------------------------------------------- | -------------------------------------------------------------------------------- | ------------ |
| `REO_API_KEY`                                | Auth key for the gateway. Required unless you pass `api_key` to the constructor. | Yes          |
| `REO_CENSUS_MCP_ENDPOINT`                    | Override the default ingest URL (for staging or self-hosted setups).             | No           |
| `REO_PRODUCT_USAGE_USER_AGENT`               | Payload **`user_agent`** fallback                                                | No           |
| `PACKAGE_TRACKER_VERBOSE`                    | Debug prints to **`stderr`**                                                     | No           |
| `PACKAGE_TRACKER_ANALYTICS` / `DO_NOT_TRACK` | Control when to activate or deactivate the package at env level                  | No           |

***

### **Configure Data in Reo.Dev**

Reo.Dev needs a metric definition for each `activity_type` you send so your events are parsed and indexed correctly.

Navigate to **Settings → Configurations → Product Usage Metrics**: [**\[Link\]**](https://web.reo.dev/dashboard/settings/product-usage-metrics)

Create the two metrics below exactly as shown:

<figure><img src="/files/RPEyaqfsudtekQ5SQHRo" alt=""><figcaption><p>Product Usage Metrics screen with <strong><code>MCP_TOOL_CALL</code></strong> and <strong><code>MCP_IDENTITY_CAPTURE</code></strong> configured in Reo.Dev UI.</p></figcaption></figure>

| **Metric name**        | **Mode** | **Meta parameters**                                      |
| ---------------------- | -------- | -------------------------------------------------------- |
| `MCP_TOOL_CALL`        | Single   | `tool` (Text / String), `tool_arguments` (Text / String) |
| `MCP_IDENTITY_CAPTURE` | Single   | —                                                        |

***

### **How to View This Data in Reo.Dev**

Head to the **Activity Timeline** of an account or developer. Under filters, select **Activity Type → Product Usage →** `MCP_TOOL_CALL.`

<figure><img src="/files/78Yh3p9Nn7YwD15zdeQI" alt=""><figcaption></figcaption></figure>

***

### **Troubleshooting**

* **Requests failing?** Verify your routing forwards traffic to the Reo.Dev gateway URL.
* Ensure HTTPS is enabled on your branded MCP endpoint.
* Confirm no auth middleware is blocking proxy requests at the gateway layer — auth should run inside your MCP server, not at the proxy.
* **SDK issues:** confirm `REO_API_KEY` is set in your runtime environment
* SDK calls are non-blocking by design — failures will not break MCP responses, but they are logged. Check your application logs for `reo.mcp-gateway` entries.

For additional help, contact your assigned account manager or write to us at [**support@reo.dev**](mailto:support@reo.dev)**.**

***

### FAQs

**1. What if our SDK language isn't supported?**

We launched with Python & npm. Support for more languages & frameworks is coming soon. [**Request it via this form**](https://forms.gle/1J8oRcnj5f4UQr7H7). We prioritise new SDKs by customer demand.

**2. Where exactly do we call the SDK in our code?**

1. At the entry point of your MCP request handler, after the user's identity is resolved.
2. Entry of tool call

**3. Does the SDK add latency to MCP responses?**

No. It is a non-blocking call and posts to Reo.Dev asynchronously.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.reo.dev/integrations/input-sources/developer-insights/mcp-server.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
