Flag At-Risk Deals: An Agent That Reads Open Pipeline Across CRM and Warehouse

Flag At-Risk Deals: An Agent That Reads Open Pipeline Across CRM and Warehouse

Your best reps already know which deals are slipping. The hard part is that the signal lives in two systems at once: the CRM that tracks the deal, and the warehouse that knows whether the customer is actually healthy. This tutorial builds one small, governed AI tool that reads both and flags the deals worth a call today.

In about fifteen minutes with Nexla MCP Studio, you will stand up a single MCP server, Pipeline Risk Sentinel, that any agent (Claude, ChatGPT, Gemini, or your own) can call to read open pipeline and surface at-risk deals. It is read-only by design: it surfaces risk, it never edits your CRM. We use Salesforce as the CRM here; HubSpot connects the same way.

Audience: RevOps, Sales EngineeringTime: ~15 minSources: Salesforce + SnowflakeResult: 5 read-only tools

The one idea that makes this work: purpose shapes the tools

Most MCP setups hand an agent a whole database and hope it picks the right table. MCP Studio works the other way around. You describe the job in plain language, and it builds only the few scoped tools that job needs. “Read open pipeline and flag at-risk deals” becomes five read-only tools, not direct access to hundreds of warehouse tables. Fewer tools means the agent chooses the right one more often, and there is far less it can get wrong.

Expose the warehouse

hundreds of tables, every tool to every agent

Expose the job

list_open_pipelineget_deal_riskflag_at_risk_dealsdeal_activity_timelinepipeline_risk_summary

five read-only tools, scoped to the task

Same systems underneath, a fraction of the surface area for the agent to misuse

What you will build

One governed server, two sources, five tools. The CRM supplies the deal; the warehouse supplies the truth about the account behind it.

SourcesSalesforce open opportunities
Snowflake account health
MCP Studioprobes the data, scopes the tools, enforces governance
Pipeline Risk Sentinel5 read-only tools, one endpoint
Your agentClaude, ChatGPT, Gemini, or custom

Salesforce for the deal, Snowflake for the health signal, one server in between

What each source provides

Salesforce Open opportunities: stage, amount, owner, close date, last activity date, stage-entry timestamps, and engagement.

Snowflake Account health: product usage signals, invoice and payment status, support ticket volume, and historical win/loss outcomes.

Before you start

You need a Nexla account with MCP Studio (Express) enabled, a credential for your CRM and your warehouse, and your Nexla API key for the final config step. Your key lives under the profile menu at the bottom-left: Get Nexla API key. MCP Studio can also walk you through OAuth if a credential does not exist yet.

Orientation: MCP Studio is split into a conversation pane on the left, where forms appear inline as you go, and a working area on the right with four tabs, Context, Tools, Explorer, and Build, plus a persistent Build MCP Server button.

1Describe the server

The opening prompt does most of the work. Name the server, name both sources, and state the outcome you want in plain language. The clearer the purpose and the systems, the better MCP Studio scopes the tools to match. Copy this prompt and adjust the wording to your data:

Build prompt · paste into MCP StudioBuild an MCP server called “Pipeline Risk Sentinel”.

Purpose: let AI agents read our open sales pipeline and flag deals
likely to slip or be lost, so reps and managers can intervene.
Read-only risk surfacing only. Never edit the CRM.

Sources:
  – Salesforce (CRM): open opportunities with stage, amount, owner,
    close date, last activity date, stage-entry timestamps, engagement.
  – Snowflake (warehouse): usage/health signals, invoice and payment
    status, support ticket volume, historical win/loss outcomes.

Keep every tool read-only. Block writes at the connector layer.

Notice what the prompt pins down: the scope (read-only, surfacing not editing), the two systems so the probe knows where to look, and the outcome you want, so Studio can shape the right tools. That single message drives every step that follows.

2Select and validate credentials

MCP Studio loads the connector instructions and detects credentials you already have. An inline form, Select Credentials for Pipeline Risk Sentinel, appears in the conversation:

Choose your CRM, Salesforce or HubSpot. Pick Salesforce, then select your Salesforce credential. Select your Snowflake credential. Click Submit Context. Studio validates each one and confirms Credential validated for both. If you pick HubSpot instead, you get a Connect OAuth step in place of the Salesforce picker.

Why this matters

Credentials stay in Nexla, never in the agent. Auth, tokens, and secrets live on the platform side, so the agent calls tools, not raw systems.

3Discover the data

Studio opens a Credential Explorer for each source and runs an agentic probe against them. When it finishes you will see Probe complete: 5 candidate tools ready. You do not map columns by hand: the probe scans the connected systems and proposes tools matched to the purpose you described.

The Explorer tab lets you browse what it found. For Snowflake it opens a Database Explorer over your warehouse with a searchable table list and a schema view you can inspect or download, so you can confirm the probe is reading the right objects before you build.

4Review and scope the tools

Open the Tools tab. The five proposed tools are each mapped to a source and backed by an editable query macro you can adjust at runtime. Everything is read-only. Select or deselect tools, and edit the default query for any of them, here.

list_open_pipeline

List open opportunities by owner, stage, amount, and close date.

SalesforceRead-only
get_deal_risk

Pull the risk indicators for a single opportunity id, usage, billing, support, and win/loss history.

SnowflakeRead-only
flag_at_risk_deals

Return deals above a risk threshold, ranked by likelihood to slip or lose.

SnowflakeRead-only
deal_activity_timeline

Show the engagement and activity timeline for a deal or account.

SnowflakeRead-only
pipeline_risk_summary

Aggregate risk across the pipeline, grouped by stage and owner.

SnowflakeRead-only

One Salesforce tool for the deal, four Snowflake tools for the risk picture

5Inspect a tool, where scope and safety get enforced

Open Inspect on any tool, for example list_open_pipeline, and you will see four parts. This is the governance layer, and it is worth understanding before you build.

list_open_pipelineInspect
Description (passed to the model)The natural-language explanation the agent reads to decide when to call this tool: “List open Salesforce opportunities, filterable by owner, stage, amount, and close date.”
Guard-rails

Read-onlyBlock any write or DDL/DML at the connector layer
Requires approvalPause the run until a human approves the call
Source referencesf_api.execute_query
Filterable columns

OwnerIdStageNameAmountCloseDateLastActivityDate

Read-only is enforced at the connector, not just suggested to the model

Two things make this safe for production. Read-only is enforced at the connector, so even a confused agent cannot write to your CRM. And you decide which columns an agent is allowed to filter on, so the tool stays inside the lane you intend. Flip Requires approval on for anything you want a human to confirm before it runs.

6Build and register the server

Click Build MCP Server. The Build tab runs three steps in order, then registers and enables the server and connects it live to your session.

Setting up data
Setting up tools
Setting up MCP server
Pipeline Risk Sentinel is now connected

Data, then tools, then server, then live

7Connect it to your agent

Open Integration config in the Build tab. There are two ways to connect, and which you use depends on the client.

Quick ConnectOAuth URL

Ready-made OAuth URLs, Google and Azure, that you paste into a client which supports remote MCP over OAuth.

Use for: ChatGPT, Gemini, and other hosted clients where remote MCP over OAuth is supported.

MCP Configmcp.json

Copy-paste mcpServers blocks for three auth methods: Service Key, Google OAuth, and Azure OAuth, each using the mcp-remote pattern with a Bearer header.

Use for: desktop clients like Claude that read a local mcp.json.

For a desktop client, the Service Key block is the fastest path. Paste it into your client config and replace the two bracketed values with your server id and your Nexla API key:

mcp.json · Service Key{
  “mcpServers”: {
    “pipeline-risk-sentinel”: {
      “command”: “npx”,
      “args”: [
        “-y”, “mcp-remote”,
        “https://api-genai.nexla.io/mcp/service_key/pipeline-risk-sentinel-<your-server-id>”,
        “–header”, “Authorization: Bearer ${NEXLA_API_KEY}”
      ],
      “env”: { “NEXLA_API_KEY”: “<your-nexla-api-key>” }
    }
  }
}

Get your key from the profile menu at the bottom-left, Get Nexla API key. The Google and Azure OAuth blocks follow the same shape if your client authenticates that way instead.

8Test it

Connect the server and ask your agent the questions a RevOps lead actually asks. If the answers look right, the tools are wired correctly.

Show me the top 10 open opportunities by amount.
Pull the risk indicators for opportunity <deal id>.
What is the activity timeline for account <name>?
Summarize pipeline risk by stage and owner.

The same questions your team asks in a pipeline review, now answerable by an agent

That is the whole loop. You described a job, MCP Studio scoped it into five governed tools across two systems, and now any MCP client can read your pipeline and flag the deals worth a call, without write access to anything. When the next quarter-end scramble starts, the agent is already watching.

Recap

One prompt defined the scope. Salesforce supplied the deal, Snowflake supplied the health signal, and every tool shipped read-only with the columns you chose. Purpose shaped the tools, and the tools stayed inside the purpose.

Build your own scoped MCP server

MCP Studio turns a plain-language description of a workflow into a governed, task-shaped MCP server grounded by your real systems, no integration code required.

Get early access to MCP StudioExplore MCP Studio


You May Also Like

A Guide to AI Readiness
Intercompany Integration Overview

Join Our Newsletter

Share

Related Blogs

Top 10 data integration tools in 2026 ranked for the AI era
AI Agents for Data Engineering: what they automate across the pipeline lifecycle

The Data Layer Your AI Is Missing

Connect, contextualize, and govern enterprise
data across 1000+ systems in real time.