Local MCP CRM

Local MCP CRM

A local-first CRM that exposes customer and project management tools via the Model Context Protocol (MCP), including an analytics server. It integrates seamlessly with Claude Code or a custom LlamaIndex ReAct agent.

Category
访问服务器

README

🧩 Local MCP CRM

A local-first CRM built on the Model Context Protocol (MCP) — customer & project management exposed as MCP tools, driven by either a custom LlamaIndex ReAct agent or directly from Claude Code.

<p> <img alt="python" src="https://img.shields.io/badge/Python-3.13-3776AB?logo=python&logoColor=white"> <img alt="mcp" src="https://img.shields.io/badge/Protocol-MCP-6f42c1"> <img alt="sqlite" src="https://img.shields.io/badge/Database-SQLite-003B57?logo=sqlite&logoColor=white"> <img alt="llamaindex" src="https://img.shields.io/badge/Agent-LlamaIndex-black"> <img alt="status" src="https://img.shields.io/badge/status-active-success"> </p>

📸 Screenshots

Both servers connected inside Claude Code (VS Code extension):

MCP servers overview

CRM server tools:

CRM server tools

Analytics server tools:

Analytics server tools

📖 Table of Contents

🎯 Why this project

This is a small, deliberately layered CRM that doubles as a hands-on demonstration of the Model Context Protocol — the emerging standard for connecting LLMs to tools and data. It ships two independent MCP servers (crm and crm-analytics), each exposing a clean set of tools over stdio, and two different clients talking to them:

  1. A custom agent (client/) — a LlamaIndex ReActAgent wired to a free OpenRouter model, with its own MCP client, tool-schema translation, and a simple multi-turn "collect missing fields" workflow.
  2. Claude Code itself — via .mcp.json, the same servers plug straight into Claude Code (or any other MCP-compatible client) with zero extra glue code.

The point isn't the CRM domain (customers/projects are intentionally simple) — it's the architecture underneath: a clean repository → service → MCP tool → server pipeline that keeps business logic, data access, and protocol plumbing separate and independently testable.

🏗️ Architecture

flowchart LR
    subgraph Clients
        A["Custom ReAct Agent\n(client/chat.py)"]
        B["Claude Code /\nany MCP client"]
    end

    subgraph Servers["MCP Servers (stdio)"]
        C["CRM Server\nservers/crm_server"]
        D["Analytics Server\nservers/analytics_server"]
    end

    subgraph Domain["Domain Layer"]
        E["Services\n(validation & business rules)"]
        F["Repositories\n(data access)"]
    end

    G[("SQLite\ncrm.db")]

    A -- MCP --> C
    A -- MCP --> D
    B -- MCP --> C
    B -- MCP --> D
    C --> E
    D --> E
    E --> F
    F --> G

Each layer has one job:

  • Repositories — raw SQL against SQLite, nothing else.
  • Services — validation and business rules (e.g. "can't create a project for a customer that doesn't exist").
  • MCP tools — translate service calls into the {success, data/error, message} shape every tool returns.
  • Servers — register those tools on a FastMCP instance and speak stdio.

✨ Features

  • ✅ Customer CRUD — create, look up by name or ID
  • ✅ Project lifecycle — create, update status (Active / Delayed / Completed), list by customer
  • ✅ Analytics — aggregate stats, delayed-project tracking, per-customer reports
  • ✅ Two independent MCP servers, each with a focused tool surface
  • ✅ Works as a drop-in MCP integration for Claude Code — no adapter code needed
  • ✅ Standalone chat agent with tool-calling via LlamaIndex ReActAgent
  • ✅ Layered architecture (repository / service / tool / server) — each piece testable in isolation

🛠️ Tech Stack

Layer Technology
Protocol Model Context Protocol (mcp Python SDK, FastMCP)
Agent / LLM orchestration LlamaIndex ReActAgent
LLM OpenRouter (free-tier model) / LM Studio (local, optional)
Database SQLite
Language Python 3.13

🔧 MCP Tools Reference

crm server

Tool Description
create_customer Create a customer (name, email, company)
get_customer_by_name Look up a customer by name
get_customer_by_id Look up a customer by ID
create_project Create a project under a customer
update_project_status Update a project's status
get_projects_by_customer List all projects for a customer

crm-analytics server

Tool Description
get_customer_statistics Aggregate counts — total customers, total projects, delayed projects
get_delayed_projects List every project currently marked Delayed
generate_project_report Full project report for a single customer

🚀 Getting Started

Prerequisites

  • Python 3.13+
  • An OpenRouter API key (free tier works) — only needed for the standalone chat agent, not for using the servers from Claude Code

1. Clone & set up a virtual environment

git clone <your-repo-url>
cd local-mcp-crm

python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate

pip install -r requirements.txt

2. Configure environment variables

cp .env.example .env
# then fill in OPENROUTER_API_KEY (and LM Studio settings, if you use them)

3. Initialize the database

python -m database.schema

4. Run it

Option A — standalone chat agent:

python -m client.chat

Option B — plug into Claude Code:

cp .mcp.json.example .mcp.json
# replace <ABSOLUTE_PATH_TO_PROJECT> with this project's absolute path
# (on macOS/Linux, point "command" at .venv/bin/python instead of .venv/Scripts/python.exe)

Reload Claude Code / run /mcp — you should see crm and crm-analytics connected, as in the screenshots above.

📂 Project Structure

local-mcp-crm/
├── servers/
│   ├── crm_server/          # MCP server: customers & projects
│   └── analytics_server/    # MCP server: aggregate analytics
├── services/                # Business rules & validation
├── repositories/            # SQLite data access
├── database/                # Schema + connection helper
├── client/                  # Standalone LlamaIndex ReAct agent
├── models/                  # (reserved for typed domain models)
├── tests/                   # Manual verification scripts
├── .env.example
├── .mcp.json.example
└── requirements.txt

🗺️ Roadmap

  • [ ] Convert the manual scripts in tests/ into a real pytest suite
  • [ ] Pydantic-based input validation at the MCP tool boundary
  • [ ] Package crm_server and analytics_server into a single MCP server with resource-based tool grouping
  • [ ] CI (lint + tests) on push

<p align="center">Built as a hands-on exploration of the Model Context Protocol.</p>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选