crmMcp
by Gauthi3r
README.md
# SimplCRM
**The CRM that makes your agents proactive.**
SimplCRM builds one record per customer from your own Firebase and Stripe, hands that
data to your agent over MCP, and wakes the agent every morning with who needs you.
It runs inside your Firebase project. [simplcrm.app](https://simplcrm.app)
**[Open the live demo](https://demo.simplcrm.app)** (sample data, nothing to sign up
for), or run it locally with `npm run setup && npm run demo`.

<table>
<tr>
<td width="33%"><img src="docs/images/customers.webp" alt="Customers, with one customer's record, follow-ups and notes open"></td>
<td width="33%"><img src="docs/images/growth.webp" alt="Growth: sign-ups, subscriptions and paying customers over twelve weeks"></td>
<td width="33%"><img src="docs/images/connect.webp" alt="Connect: approving an agent's access to the CRM"></td>
</tr>
<tr>
<td align="center">Customers</td>
<td align="center">Growth</td>
<td align="center">Approving an agent</td>
</tr>
</table>
Every name and address in the screenshots and the demo is invented.
- **MCP-first.** An MCP server is the main interface. Your agent reads customers,
the attention list and revenue, and writes notes and follow-ups.
- **Fills itself in.** One record per Firebase Auth user, enriched from Firestore
(profile and activity) and Stripe (trial, paying, payment failing, lapsed). Nothing
to import, nothing to sync.
- **Morning wake-up.** Once a day, if you turn it on, SimplCRM calls your agent's
webhook with who needs attention: payment failed, gone quiet, trial ending,
follow-up due.
- **Runs in your own Firebase project.** No server and no account to sign up for. It
deploys as its own Functions codebase and Hosting site, next to what you already have.
- **A web app for glancing.** Home, Growth and Customers, plus the screen where you
approve an agent.
## MCP tools
| Tool | Access | What it does |
| ------------------------ | ------ | --------------------------------------------------------- |
| `crm_status` | read | How fresh the data is, and what is and is not tracked |
| `crm_today` | read | The attention list: who needs you today, and why |
| `crm_count_customers` | read | Counts by commercial state, product health and source |
| `crm_list_customers` | read | Customers, filtered and sorted |
| `crm_get_customer` | read | One customer's record, notes and open follow-ups |
| `crm_add_note` | write | Add a note to a customer. Notes cannot be edited or deleted |
| `crm_add_follow_up` | write | Schedule a follow-up with a date and a reason |
| `crm_complete_follow_up` | write | Mark a follow-up done |
Details and example calls: [docs/mcp.md](docs/mcp.md).
## Architecture
```mermaid
flowchart LR
subgraph project["Your Firebase project"]
auth["Firebase Auth<br/>(your users)"]
fs[("Firestore<br/>your data + crm* collections")]
subgraph fns["Functions, codebase simplcrm"]
api["crmPortalApi<br/>(callable)"]
mcp["crmMcp<br/>(MCP + OAuth)"]
refresh["crmDailyRefresh<br/>(scheduled)"]
wake["crmWakeUp<br/>(scheduled)"]
end
web["Hosting site (target crm)<br/>web app"]
end
stripe["Stripe<br/>(read-only key)"]
agent["Your agent<br/>(MCP client)"]
you["You"]
auth --> refresh
fs --> refresh
stripe -- read --> refresh
refresh --> fs
you --> web
web --> api
api <--> fs
agent -- "MCP, after you Approve" --> web
web -- "/mcp, /oauth/**" --> mcp
mcp <--> fs
wake -- "morning webhook<br/>(ids and reasons)" --> agent
```
More in [docs/architecture.md](docs/architecture.md).
## Quickstart
### Try the demo locally
The web app has a demo mode with invented data. It needs no Firebase project.
```bash
npm run setup # npm ci in each package
npm run demo # the web app on 127.0.0.1, signed in, sample data
```
The same build is hosted at [demo.simplcrm.app](https://demo.simplcrm.app); see
[docs/demo.md](docs/demo.md).
### Deploy it to your Firebase project
You need Node.js 22.23.4 or later (`.nvmrc`), the [Firebase CLI](https://firebase.google.com/docs/cli)
(to deploy and set secrets), the `gcloud` CLI (for the Application Default Credentials
the two admin scripts use), a Firebase
project on the Blaze plan with Google sign-in enabled, and optionally a Stripe account.
The full walkthrough, with what a good result looks like at each step, is in
[docs/setup.md](docs/setup.md); the short version:
1. **Configure.** Edit [`functions/src/config.ts`](functions/src/config.ts): your
address in `operatorEmails`, `mcp.origin`, `region`, `timeZone`, `currency`, and
`users`, `activity`, `stripe` and `wakeUp` to match your project. The functions refuse
to load while the example values are there. Every field is described in
[docs/configuration.md](docs/configuration.md).
2. **Point at your project.** Copy `.firebaserc.example` to `.firebaserc`, set your
project id, and give SimplCRM a Hosting site of its own:
```bash
firebase hosting:sites:create <your-crm-site>
firebase target:apply hosting crm <your-crm-site>
```
If `region` is not `us-central1`, change it in the three rewrites in `firebase.json`.
3. **Protect the CRM collections.** Merge the deny block from
[`firestore.rules.example`](firestore.rules.example) into your own rules, and add two
composite indexes per activity source, plus the four TTL policies in
[`firestore.indexes.json`](firestore.indexes.json) (required). SimplCRM never deploys
rules or indexes.
4. **Set the secrets your configuration uses.**
```bash
firebase functions:secrets:set STRIPE_API_KEY # Stripe on: restricted, read-only key
firebase functions:secrets:set STRIPE_WEBHOOK_SECRET # stripe.webhook on: the webhook signing secret
firebase functions:secrets:set WAKE_WEBHOOK_URL # wake-up on: your agent's trigger URL
firebase functions:secrets:set WAKE_WEBHOOK_KEY # wake-up on, sendKey true: Bearer token
```
5. **Install and configure the web app.** Copy `web/.env.example` to
`web/.env.production.local` and fill in your Firebase web config, then:
```bash
cd functions && npm install && cd ..
cd web && npm install && cd ..
```
6. **Deploy.** This builds both packages and touches only SimplCRM's functions and
Hosting site:
```bash
firebase deploy --only functions:simplcrm,hosting:crm
```
7. **Make yourself an operator.** Sign in to the web app once with Google, then grant
your account the `crmAdmin` claim (the scripts use Application Default Credentials)
and sign in again. The web app signs in with your project's own Firebase Auth, so
your account is a user there too; operators are left out of the customer records:
```bash
cd functions && npm run build
node scripts/set-admin-claim.mjs --project=<your-project-id> --email=<you@yourdomain>
```
8. **Build the records** for users who existed before the deploy (from `functions/`):
```bash
node scripts/rebuild-projections.mjs --project=<your-project-id>
```
9. **Connect your agent.** Add `<mcp.origin>/mcp` as a remote MCP server in your agent,
sign in when it asks, and press **Approve**. Claude, Claude Code and Cursor work as
they are; see [docs/mcp.md](docs/mcp.md) for others.
10. **Wake it up.** Optionally, turn on the morning call: [docs/wake-up.md](docs/wake-up.md).
## Repository layout
```
functions/ Firebase Functions codebase "simplcrm" (TypeScript, Node 22)
src/config.ts the one file you edit
src/index.ts deployment shell: exports only
src/crm/ domain logic, dependency-injected, tests beside the code
scripts/ set-admin-claim.mjs, rebuild-projections.mjs
web/ the web app (React 19, Vite, Tailwind 4)
site/ the marketing site at simplcrm.app (Astro)
docs/ setup, configuration, MCP, architecture, wake-up, demo
examples/ a wake-up receiver in one dependency-free file
package.json root scripts only: check, demo, setup (not a workspace)
firebase.json functions codebase + Hosting target "crm"
firestore.rules.example deny block to merge into your rules
firestore.indexes.json TTL policies for the OAuth records, to merge into yours (required)
AGENTS.md a map of the repository for coding agents
```
## Security model
- **Operator gate.** Every portal request goes through one callable, `crmPortalApi`. It
requires a verified email on the `operatorEmails` list in `config.ts` and the
`crmAdmin` custom claim. The allowlist lives in code on purpose: changing who can
read every customer record takes a commit and a deploy.
- **Server-only collections.** The rules block you merge denies all client access to
every `crm*` collection. Only the Admin SDK inside SimplCRM's functions reads or
writes them.
- **Agents get the web app's powers and no more.** MCP tools call the same dispatcher
as the web app, under the same operator gate, after OAuth sign-in, and reach a fixed
list of eight operations.
- **Consent cannot be granted by a tool.** An agent connects only after you press
Approve in the web app. No MCP tool can approve, extend, list or revoke a connection;
Settings lists your connected agents and revokes one.
- **Notes are append-only.** Notes cannot be edited or deleted; follow-ups can only be
added and completed.
- **Read-only outside.** SimplCRM reads Stripe with a restricted read-only key and
never writes to it. The wake-up webhook carries ids and reasons only, never names,
emails or note text.
Your agent's provider sees what your agent reads. Report vulnerabilities privately; see
[SECURITY.md](SECURITY.md).
## What v0.1 does not do
- **A flat model: no teams or workspaces.** Operators are a flat list of addresses in code. There
are no workspaces, roles or per-person views; every operator sees every customer.
- **Firebase and Stripe only.** Users come from Firebase Auth, activity from Firestore,
billing from Stripe subscriptions. Checkout sessions and abandoned checkouts are not
tracked.
- **Up to 2000 customers.** The web app and the tools read the whole customer base at
once and refuse, with a message that says so, rather than show a partial list, beyond
2000 accounts or 2000 pending follow-ups. See
[Limits](docs/architecture.md#limits).
- **Google sign-in only** for operators.
- **Operators share your product's Firebase Auth.** There is no separate sign-in for
the CRM; operators are left out of the customer records by address.
- **One trigger.** The agent is woken by the morning call only, not by events.
## Roadmap
- Workspaces and teams: several operators, roles and shared follow-ups.
- More sources: other billing providers and product databases beside Firebase and Stripe.
- More agent triggers: events such as a failed payment or a new trial, not only the morning call.
Ideas and votes are welcome in [issues](https://github.com/Gauthi3r/simplCRM/issues).
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, the checks CI runs and the
conventions. Please follow the [Code of Conduct](CODE_OF_CONDUCT.md).
## License
SimplCRM is released under the [MIT License](LICENSE). Some UI components, styles,
fonts, icons and logos come from other projects or belong to other companies; see
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues