piko-crm-mcp
OfficialThis server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Three parts that close one loop:
CRM — a small SQLite reference CRM: workspaces, roles, contacts with channel accounts, organizations, deals in stages, tasks, notes (private or marked for auto-watch).
MCP — a standard Model Context Protocol server (stdio, no dependencies). Every agent connection has its own grant. Writes are dry-run, explained in plain words and approved by a person — or, if you opt in, run on their own with undo, limits and red lines.
Auto-watch — a channel- and model-agnostic loop that reads new messages, looks the person up in CRM, drafts a reply strictly from the owner's written rules, and records the person back into CRM.
It is extracted from Piko, where the same mechanism connects the Piko apps' auto-watch to a shared CRM, and it is the reference implementation of the paper Delegation Without Approval (DOI 10.5281/zenodo.24729210). Piko's apps, accounts and hosted service are not part of it.
Safety model
The point of this project is what an agent cannot do.
Guarantee | Where | |
Access | Each agent/device connection has its own grant ( |
|
Confirmed writes | A write tool never writes. It is planned, executed for real inside a SAVEPOINT and rolled back (so it fails now, not after approval), described field by field, stored for 10 minutes for that session only, re-checked and applied at most once after a person accepts. There is no |
|
Full delegation (opt-in) | Ordinary single-record writes run without a prompt, each with a before/after snapshot; |
|
Approval channel | Approval goes to the person through MCP elicitation. Clients without elicitation do not see write tools at all (unless you opt in to terminal approval). |
|
Auto-watch lookup | Off until the workspace enables it and the connection has |
|
Auto-watch capture | Off until the workspace enables it and the connection has |
|
Prompt order | Fixed: safety floor → the owner's rules → fenced data (knowledge, CRM facts, the one incoming message). Data cannot close its block or open a rules block. Each reply sees only the newest message, no history. |
|
Secrets | Incoming messages with card numbers, ID numbers or codes go to a person unanswered. Drafts that contain them, or mention passwords/codes/card details at all, are not sent. Quotes and summaries holding them are never stored. |
|
Rate limits | 60 tool calls/minute per connection; auto-watch 30 replies/hour per rule (configurable up to 120) and a minimum gap per conversation. Over the limit, messages wait. |
|
Hand-off | Per message; the next message in that conversation is answered normally. A person can stop a conversation for good. |
|
Send window | Optionally hold each reply ( |
|
Dry run | The auto-watch loop only drafts until you pass |
|
See SECURITY.md for the threat model and how to report a problem.
Related MCP server: Ficiel MCP
Quick start
pip install git+https://github.com/<owner>/piko-crm-mcp
piko-crm demo --db ~/piko-crm-demo.dbdemo creates a sample workspace with auto-watch enabled and two connections: demo (an agent with confirmed writes)
and watcher (auto-watch with lookup and capture). It prints the commands to run.
Connect an agent over MCP — add the printed serve command to your MCP client's server list
(see examples/mcp_client_config.json), then ask: "Which deals are open? Add a task
to call Fang Wang back on Friday." The task is only written after you accept the approval the client shows you.
Try auto-watch — run the printed watch command. It reads examples/inbox.jsonl, answers
from examples/rule.json with a knowledge-only demo responder, and prints drafts (dry run).
Add --send to send and record into CRM, and --hold-seconds 180 to keep a window to take replies back.
Review what auto-watch recorded:
piko-crm captures --db … --workspace … --user me # created / merged / pending
piko-crm resolve --db … --workspace … --user me <id> merge --contact <contactID>
piko-crm undo --db … --workspace … --user me <id>Full delegation
Confirmation is the default. When you trust an agent with routine work, switch that one connection to full delegation — the four mechanisms of the paper's appendix A come with it:
piko-crm connect --db … --workspace … --user me --session assistant --access write --mode delegated \
[--max-writes-hour 15] [--burst-max 4] [--burst-window 120] [--freeze 900] \
[--deal-delta-pct 20] [--deal-delta-abs 1000]
piko-crm digest --db … --workspace … --user me --since 24h # once a day: what ran, what waits for you
piko-crm undo-op --db … --workspace … --user me <opID> # restores field by field; your later edits stay
piko-crm confirm --db … --workspace … --user me --session assistant <operationID> # approve a held red-line writeOver MCP the delegated connection simply sees its write tools work; a red-line write comes back as pending (or, if the
client supports elicitation, is put in front of you right away). piko-crm disconnect stops delegation at once and
cancels everything waiting.
Bring your own channel and model
The loop is two small interfaces:
from piko_crm_mcp.autowatch import Adapter, AutoWatch, CrmLink, Incoming, Responder, Rule
class MyInbox(Adapter):
def poll(self): ... # → [Incoming(conversation, channel, messages, handle, name)]
def send(self, conversation, text): ... # → True only when the reply is verified as sent
class MyModel(Responder):
def respond(self, prompt): ... # prompt["system"], prompt["text"] → {"reply", "handoff", "crm"}Or keep it out of process: --responder "your-command" runs any program with the prompt as JSON on stdin and reads
the draft JSON from stdout, so this package depends on no model provider.
MCP tools
Tool | Kind | Shown when |
| read | the role may view that module |
| write | write grant and role allow it; confirmed by a person, or delegated with undo |
| read |
|
| narrow direct write |
|
Results are compact (≤ 50 rows with paging, long text cut, ids mapped to names the caller may see). Approval texts come in English, Simplified and Traditional Chinese.
Using the library directly
from piko_crm_mcp import Crm, Gateway, Store
crm = Crm(Store("crm.db")); gw = Gateway(crm); me = {"id": "alice"}
op = gw.prepare(me, "laptop", space, "crm.move_deal", {"id": deal_id, "stage": "Proposal"}, lang="zh-Hans")
print(op["review"]) # 把商机「Gift boxes」从「New」移到「Proposal」
gw.confirm(me, "laptop", space, op["operationID"]) # only after a person says yesFull delegation from Python: Delegation(gw).execute(...), .undo_op(...), .digest(...).
To guard your own data store, keep gateway.py / watch.py / delegation.py and implement the Crm methods they call so that writes
accept a caller-owned transaction.
Development
python -m venv .venv && .venv/bin/pip install -e '.[test]'
.venv/bin/pytest -qPython 3.10+, no runtime dependencies. The MCP server negotiates protocol versions 2025-11-25, 2025-06-18 and
2025-03-26 and has been exercised with the official MCP Python client, including elicitation.
Not included (present in the production system this comes from): encryption of record bodies at rest, keyed hashing of phone numbers and handles, custom permission groups, invitations, imports, dashboards, and the channel readers that drive real messaging sites. Record bodies in the reference store are plain JSON: protect the database file accordingly.
Research
This repository implements Delegation Without Approval (Piko Research 2026-03,
DOI 10.5281/zenodo.24729210): the paper's experiments ran against v0.2.0,
and its appendix A is implemented from v0.3.0. The paper builds on
PESA. To cite either the software or the paper, use GitHub's
Cite this repository button (CITATION.cff).
Roadmap
Encrypted record bodies and keyed hashing of handles and numbers, as in production.
Channel adapters maintained as separate packages, so the core stays dependency-free.
A small web view for the daily digest and pending decisions.
Packaging on PyPI.
Ideas and pull requests are welcome — see CONTRIBUTING.md.
License and trademarks
Code: Apache License 2.0. The names "Piko" and "Prysai" and the Piko logo are not licensed under it; you may say your project is based on piko-crm-mcp, but please do not present a fork as Piko.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
AI CRM: accounts, deals, meetings and agents, with approvals before anything is sent.
CRM + visual automation builder AI agents can drive via MCP: contacts, tags, maps, email/SMS flows.
Email infrastructure for AI agents — send, receive, search, and reply to email over MCP.
Personal CRM operated by AI agents. Read relationship context before acting, write back after.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI agents to read and write CRM data—companies, contacts, opportunities, tasks, and interactions—through MCP, with OAuth and provenance tracking for every value.MIT
- AlicenseNot gradedqualityBmaintenanceEnables MCP clients such as Claude, ChatGPT, and Cursor to read and search Instagram, WhatsApp, and LinkedIn conversations, find contacts, and spot prospects left without a reply. It can also prepare or send follow-ups, but only within permissions a human grants, and nothing goes out without human approval.CC BY-4.0
- AlicenseNot gradedqualityAmaintenanceConnects any MCP-capable AI assistant—ChatGPT, Claude, Gemini, Cursor and others—to an AI-native CRM via OAuth, so users can manage contacts, deals, pipelines, reports and add-ons by chat, with every action scoped to the connecting user's role. The server itself never calls an AI model or holds API keys, leaving all intelligence to the assistant you bring.AGPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables MCP-compatible AI clients to search and view CRM customers, deals, contracts, tasks, calendars, and outbound jobs, and to propose opt-in write actions that require human approval in the CRM.Apache 2.0