DEV Community

Cover image for RevOps AI - Build Your AI Sales Team on Notion with Gemini + MCP
Pooya Golchian
Pooya Golchian

Posted on

RevOps AI - Build Your AI Sales Team on Notion with Gemini + MCP

Notion MCP Challenge Submission 🧠

What I Built

I built RevOps AI — a revenue operations platform that lets marketing directors and company managers build, deploy, and manage an AI-powered sales team, with Notion as the single source of truth.

This isn't just a CRM. It's a RevOps command center where Google Gemini 2.5 Flash acts as an autonomous sales team member that can:

  • Analyze your pipeline and tell you where revenue is leaking
  • Score leads using AI reasoning and write the scores back to Notion
  • Generate pre-call briefings before your team picks up the phone
  • Draft personalized sales emails based on deal context
  • Create contacts, log activities, and update deal stages — all through natural language

The AI doesn't follow hardcoded scripts. Using mcpToTool() from Google's GenAI SDK, Gemini receives all 22 Notion MCP tools and decides at runtime which to call. It reasons, chains multi-step operations, and executes — like a real sales ops analyst would.

Why RevOps on Notion?

Every sales team I've worked with faces the same problem: their CRM is a data silo. Salesforce costs $150/user/month. HubSpot locks you into their ecosystem. Meanwhile, the team already lives in Notion for docs, meeting notes, and project management.

What if Notion was the CRM? And what if an AI agent could operate it autonomously?

That's RevOps AI. Your pipeline data stays in Notion where your whole team can see it. The AI layer adds intelligence on top — scoring, briefing, drafting, analyzing — without moving data into yet another proprietary database.

Key Features

AI Sales Team Manager — Chat with your revenue data in natural language. Ask "What's my pipeline health?" and the AI queries Notion, calculates win rates, and surfaces insights. Say "Create a follow-up for the Acme deal" and it creates the activity linked to the right deal. It's like having a senior sales ops analyst available 24/7.

Revenue Dashboard — Pipeline metrics at a glance: total value, win rate, deal breakdown by stage, top deals, and recent activity. All data flows from Notion through MCP in real-time.

Visual Deal Pipeline (Kanban) — Drag-and-drop deals between 6 stages (Lead → Qualified → Proposal → Negotiation → Closed Won → Closed Lost). Every move syncs to Notion instantly via MCP.

AI Lead Scoring — One-click AI analysis evaluates each contact (role seniority, company size, engagement history) and assigns a 0-100 score with written reasoning. Scores persist back to the Notion Contacts database so your team sees them everywhere Notion surfaces.

Pre-Call Briefing Generator — Before any sales call, the AI generates a structured brief: talking points, objections to expect, relationship history, and recommended next steps. All sourced autonomously from deal and activity data in Notion.

Email Ghostwriter — AI drafts personalized sales emails based on the deal's context, stage, and contact history. No generic templates — each email is contextually unique.

Contact Management — Full contact CRUD with search, filtering by lead source, sortable columns, and inline AI scoring. Add new contacts directly from the UI.

Demo

Screenshots

Revenue Dashboard — KPIs, pipeline by stage, top deals, recent activity:
Dashboard

Deal Pipeline (Kanban) — Drag & drop deals between stages:
Pipeline

Deal Detail + AI Email Draft — Edit deals, generate briefings, draft emails:
Deal Detail
AI Email Draft

Leads & AI Scoring — Contact table with AI-powered lead scores:
Leads

Companies — Organization profiles linked to contacts and deals:
Companies

AI Sales Team Manager — Natural language chat with your CRM data:
AI Assistant

Responsive Design — Works on desktop, tablet, and mobile:
Desktop Tablet Mobile

Show Us the Code

GitHub Repository: https://github.com/pooyagolchian/ai-sales-crm

Application Flow

Application Architecture

The Core Innovation — mcpToTool()

Instead of manually wiring each Notion API endpoint into the AI, one function call changes everything:

// src/lib/gemini.ts — The entire AI-to-Notion bridge
import { GoogleGenAI, mcpToTool } from "@google/genai";
import { getMcpClient } from "./mcp-client";

export async function generateWithTools(
  prompt: string,
  systemPrompt?: string
): Promise<string> {
  const ai = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
  const mcpClient = await getMcpClient();

  const response = await ai.models.generateContent({
    model: "gemini-2.5-flash",
    contents: prompt,
    config: {
      tools: [mcpToTool(mcpClient)],         // ← All 22 Notion tools, auto-mapped
      systemInstruction: getCrmSystemPrompt(), // ← DB IDs + property names injected
    },
  });

  return response.text ?? "";
}
Enter fullscreen mode Exit fullscreen mode

mcpToTool(mcpClient) auto-maps all 22 Notion MCP tools into Gemini function declarations. The system prompt injects the actual database IDs and property names so Gemini doesn't waste tool calls discovering them.

The result: Gemini autonomously decides which Notion operations to perform. Ask "What's my pipeline value?" → it calls API-query-data-source on Deals. Say "Log a meeting for Acme" → it calls API-post-page to create an Activity and API-patch-page to update the deal. No hardcoded logic.

MCP Client — Singleton with Auto-Reconnect

// src/lib/mcp-client.ts — Singleton pattern
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";

async function createClient(): Promise<Client> {
  const mcpClient = new Client({ name: "revops-ai", version: "1.0.0" });

  const transport = new StreamableHTTPClientTransport(
    new URL(process.env.MCP_SERVER_URL || "http://localhost:3001/mcp"),
    { requestInit: { headers: { Authorization: `Bearer ${authToken}` } } }
  );

  await mcpClient.connect(transport);
  return mcpClient;
}
Enter fullscreen mode Exit fullscreen mode

Tech Stack

Layer Technology
Framework Next.js 15 (App Router), TypeScript (strict)
UI Tailwind CSS v4, shadcn/ui, Lucide icons
AI Google Gemini 2.5 Flash via @google/genai SDK
Data Notion (4 databases) via MCP protocol
MCP @notionhq/notion-mcp-server v2 (HTTP) + @modelcontextprotocol/sdk
DnD @dnd-kit/core + @dnd-kit/sortable
Linting Biome

How I Used Notion MCP

Notion is not a supporting tool here — it is the entire database layer. There is no Postgres, no SQLite, no local storage. Every record (contacts, deals, activities, companies) lives in a Notion database, and every read/write goes through MCP.

Four Notion Databases

Database Purpose Key Properties
Contacts Lead & customer profiles Name, Email, Company, Role, Lead Score, Lead Score Notes, Source
Deals Revenue pipeline items Name, Contact (relation), Stage (6 values), Value, Close Date, Priority, Next Action
Activities Sales touchpoints Type (call/email/meeting/note), Date, Deal (relation), Summary, Raw Notes
Companies Organization profiles Name, Industry, Size, Website

MCP Operations Used

Every data operation goes through MCP:

  • API-query-data-source — Querying databases with filters and sorts ("all deals where Stage = Proposal, sorted by Value desc")
  • API-post-page — Creating new contacts, deals, activities
  • API-patch-page — Updating deal stages (Kanban DnD), persisting AI lead scores, updating Next Action fields
  • API-search — Free-text search across the entire Notion workspace
  • API-retrieve-a-page — Fetching full details for deal briefings and AI assistant context

What Makes This Approach Fundamentally Different

Most MCP integrations hardcode which tools to call. RevOps AI lets the AI choose:

  1. mcpToTool(mcpClient) — One function call auto-maps all 22 Notion MCP tools into Gemini function declarations. No manual schema writing. No maintaining tool definitions.

  2. Autonomous multi-step reasoning — Gemini chains multiple MCP calls in a single response. Ask "Brief me on the TechCorp deal" and it autonomously: (1) searches for the deal → (2) queries related activities → (3) retrieves the contact profile → (4) synthesizes a briefing.

  3. System prompt injection — The AI system prompt includes actual database IDs and exact property names from notion-schema.ts, so the AI doesn't waste tool calls discovering database structure.

  4. Notion as single source of truth — The team's data stays in Notion where they already collaborate. RevOps AI is an intelligent layer on top, not another data silo.

The Practical Benefit of Notion MCP

Why Notion MCP specifically? Because it solves a real problem that traditional CRM architectures can't:

Your data stays where your team already works. A marketing director can open Notion and see every deal, contact, and activity in familiar views — tables, kanban, calendars, galleries. They can edit inline, add comments, share with stakeholders. No CRM login required.

The AI gets full context through a standard protocol. MCP gives the AI structured access to query, create, update, and search — with proper schemas and typed inputs. This isn't screen scraping or brittle API hacks. It's a designed protocol.

Zero vendor lock-in. Switch from Gemini to Claude or GPT? The MCP layer stays the same. Switch from Notion to another MCP-compatible tool? The AI integration pattern stays the same. MCP decouples the AI from the data source.

Cost: essentially free. Notion's free plan supports databases. Gemini 2.5 Flash has a generous free tier via Google AI Studio. The MCP server is open source. For a startup's first RevOps stack, total cost can be $0.


Built with Notion MCP, Google Gemini 2.5 Flash, Next.js 15, and the belief that revenue operations shouldn't require a $150/seat CRM when your team's already in Notion.

Top comments (3)

Collapse
 
mahsa profile image
Mahsa

I'm so impressed! That's a game-changer. Thanks Pooya! 👏

Collapse
 
pooyagolchian profile image
Pooya Golchian

Thank you

Some comments may only be visible to logged-in visitors. Sign in to view all comments.