pipedrive-pj
Read-only MCP server that exposes the Poli Júnior Pipedrive CRM to Claude as composable tools.
README
MCP Pipedrive — Poli Júnior
Read-only MCP server that exposes the Poli Júnior Pipedrive CRM to Claude (Desktop or Code) as composable tools. Built for the four commercial cargos of the PJ: Diretor Executivo, Gerente Comercial de Núcleo, Líder de Outbound, e Coordenador de Negócios.
The MCP focuses strictly on Pipedrive data — listing, filtering, aggregating, fetching individual entities. Meeting transcription, Drive integration, and any write-side workflow are explicitly out of scope (they belong to other, purpose-built MCPs).
Architecture
mcp-pipedrive-pj/
├── server.py # FastMCP entrypoint + monkey-patches mcp.tool with observability
├── pipedrive.py # Async HTTP client: pd() returns body['data']; pd_raw() returns full envelope
├── field_registry.py # FieldsRegistry: dynamic schema discovery + disk cache (TTL 6h)
├── fields.py # LEGACY hardcoded hashes/options used only by get_deal_context
├── observability.py # instrument() decorator → .observability/usage.jsonl per tool call
│
├── tools/
│ ├── list_deals_with_filters.py # A1 — filtros compostos + include_fields
│ ├── base_gets.py # A4 — 7 read tools (person, org, notes, activities, list_*)
│ ├── analytics.py # B1/B2/B3 — conversion / lost reasons / owner activity
│ ├── get_deal_context.py # Legacy CRM briefing (uses fields.py, no transcription)
│ └── find_deals.py # Legacy text search (redundant with A1; candidate for removal)
│
├── plans/ # Per-tool specs (signature, internal flow, error handling)
├── tests/
│ ├── unit/ # respx mocks + mock_registry fixture
│ └── integration/ # Real Pipedrive instance, gated on PIPEDRIVE_API_TOKEN
└── pytest.ini
FieldsRegistry — why it exists
Pipedrive custom fields are addressed by opaque hash keys (6ea1ea74...) and
their enum options are numeric IDs. The PJ instance also renames fields,
adds options (new núcleo, new sector), and deletes/recreates fields over time.
FieldsRegistry discovers the schema at runtime, caches it in
.cache/pipedrive_schema.json (TTL 6h, falls back to stale cache when the
API is unreachable), and exposes resolution by human-readable name:
registry.field_key("deal", "Setor da Empresa") # → hash
registry.option_id("deal", "Etiqueta", "NDados") # → 32
registry.user_id_by_name("Henrique Romano") # → 100
registry.serialize_deal(deal, include_fields=[...]) # → human-readable dict
All v1 tools resolve names through the registry. None of them imports from
fields.py. The legacy get_deal_context tool still uses fields.py —
migration to the registry is a follow-up task (a.k.a. "C5").
Observability
observability.instrument(fn) wraps every registered tool. Each invocation
writes one JSON line to .observability/usage.jsonl:
{"timestamp":"2026-06-10T17:23:09.104Z","tool":"list_deals_with_filters","latency_ms":1347,"status":"ok"}
On error:
{"timestamp":"...","tool":"get_person","latency_ms":87,"status":"error","error_type":"ValueError","error_message":"Person not found: 999999"}
Failures during the log write are swallowed silently so they never block the tool's return.
Tools
| Tool | Persona-alvo | What it does |
|---|---|---|
list_deals_with_filters |
DE / Gerente / LO / CN | Lista deals com filtros compostos: núcleo, portfólio, canal, setor, CN owner, stage, pipeline, status, período. include_fields controla shape do output. |
get_person |
todas | Busca pessoa (contato) por ID com include_fields opcional. |
get_organization |
todas | Busca organização por ID com include_fields opcional. |
get_notes |
todas | Notas atreladas a um deal / pessoa / org (exatamente um). |
get_activities |
todas | Atividades (calls, meetings, tasks) atreladas a um deal / pessoa / org. Filtro opcional done. |
list_pipelines |
todas | Funis configurados no Pipedrive (id + name). |
list_stages |
todas | Etapas, opcionalmente filtradas por pipeline. |
list_users |
todas | Usuários do workspace (resolução de nomes de CN/owner). |
get_conversion_rates |
DE / Gerente | Close-rate e win-rate sobre o conjunto filtrado, com group_by opcional (núcleo, canal, owner, portfólio). |
get_lost_reasons_analysis |
DE / Gerente | Agregação de "Motivo da perda" sobre deals lost. Filtro de data aplica em lost_time. |
get_owner_activity |
DE / LO | Snapshot por owner: deals por status, hot/cold, tasks atrasadas, valor open. |
get_deal_context |
CN / todas | Briefing markdown do deal (CRM apenas — sem transcrição). Legado, ainda usa fields.py. |
find_deals |
(legacy) | Busca por termo no título. Redundante com list_deals_with_filters. |
Setup
Requirements
- Python 3.13+
- Pipedrive REST API token (https://app.pipedrive.com/settings/personal/api)
Install
git clone https://github.com/hguareromanoo/mcp-pipedrive-pj.git
cd mcp-pipedrive-pj
python3.13 -m venv venv
source venv/bin/activate
pip install -r requirements.txt # runtime
pip install -r requirements-dev.txt # + pytest, respx, etc.
Configure
Copy .env.example to .env and fill in:
cp .env.example .env
# edit .env to add your PIPEDRIVE_API_TOKEN
Run as Claude Desktop MCP
Add this entry to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"pipedrive-pj": {
"command": "/abs/path/to/mcp-pipedrive-pj/venv/bin/python",
"args": ["/abs/path/to/mcp-pipedrive-pj/server.py"],
"env": {
"PIPEDRIVE_API_TOKEN": "your_token_here",
"PYTHONPATH": "/abs/path/to/mcp-pipedrive-pj"
}
}
}
}
Restart Claude Desktop. The 13 tools above appear under pipedrive-pj.
Smoke test (from terminal)
source venv/bin/activate
python -c "import server; print('server.py imports OK')"
Tests
source venv/bin/activate
# Unit (mocked via respx, no network)
pytest tests/unit/ -v
# Integration (hits the real Pipedrive instance via PIPEDRIVE_API_TOKEN)
pytest tests/integration/ -v
# Everything (≈ 2.5 min, dominated by integration tests against the real API)
pytest tests/
Tests gated on @pytest.mark.integration skip automatically when
PIPEDRIVE_API_TOKEN is absent. Current baseline: 116 passing.
Scope decisions baked in
- Read-only in v1. Bulk write operations on Pipedrive are explicitly out
of scope. The 4 legacy write-side CN tools (
log_meeting,advance_deal,register_prospect,resolve_deal) were removed — they are easier to do directly in the Pipedrive UI. - Meeting transcription is NOT here. Drive + AssemblyAI integration was
removed: typical PJ recording folders carry 7-8
.mkvfiles of 500MB-1.4GB each, totaling 30+ minutes of work per call. That does not fit a synchronous MCP request-response model. A separate "meeting intelligence" MCP is the right home for it. include_fieldseverywhere. Read tools accept a subset of fields to return, keeping LLM context windows tight.- API quirks documented in
PRD.md. The two that bit us:/v1/dealsfilters byuser_id, notowner_id(the latter is silently ignored by the API).start_date/end_dateon/v1/dealsfilter byupdate_time, notadd_time— A1 applies the date window in memory to honor the documented contract.
Status
- v1 feature-complete: A1, A4 (×7), B1, B2, B3, D2 (observability), FieldsRegistry, 116 passing tests.
- Legacy survivors:
get_deal_context(kept),find_deals(kept, candidate for next cleanup). - Pendente: piloto com early adopters (1 CN, 1 LO, 1 Gerente) + skills layered per cargo + handoff plan for after the original CIC steps down.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。