Company Records
Exposes a fictional B2B CRM database (companies, contacts, deals) as callable MCP tools, enabling AI agents to answer natural-language questions about company records, contacts, and pipeline data.
README
MCP Server Demo — Company Records
A working Model Context Protocol server in Python that exposes a small company CRM database to AI agents as callable tools, plus a command-line chat agent that answers natural-language questions by calling those tools.
Built on the official MCP Python SDK (mcp) and the official Anthropic SDK.
What is MCP?
The Model Context Protocol is an open standard for connecting AI models to external tools and data. Instead of hard-coding a model's integrations, you run an MCP server that advertises a set of tools (each with a name, description, and JSON input schema). Any MCP client — Claude Desktop, an IDE, or your own agent — can connect, discover those tools, and let the model call them. The server and client talk over a simple transport (here, stdio). The result: one server works with any MCP-compatible client, and the model gets live, structured access to your data instead of guessing from its training set.
What this server does
It serves a fictional B2B CRM dataset (12 companies, 16 contacts, 19 deals, stored in SQLite) through five tools:
| Tool | What it does |
|---|---|
search_companies |
Filter companies by industry, country, and/or minimum headcount |
get_company |
Full profile for one company, with its contacts and deals |
find_contacts |
Free-text search over contact name, title, or email |
deal_summary |
Pipeline totals — counts and dollar value, overall or by stage |
top_companies |
Rank companies by revenue, employees, or total deal value |
The dataset is generated by company_data.py into a local company.db. It's
entirely invented and safe to share; swapping in a real database means pointing
the tools at different SQL.
How it works
stdio (MCP) tool calls
chat.py ─────────────────► server.py ─────────────────► company.db
(client) ◄───────────────── (server) ◄───────────────── (SQLite)
tool results rows
chat.py also calls the Claude API to decide *which* tools to call.
server.pydefines each tool with the@mcp.tool()decorator. FastMCP turns the function signature and docstring into the tool's input schema and description automatically, and handles the MCP wire protocol.chat.pylaunches the server as a subprocess over stdio, discovers its tools, and runs an agentic loop: it sends your question to Claude along with the tool list, Claude responds with tool calls,chat.pyexecutes them against the server, feeds the results back, and repeats until Claude has a final answer.
Setup
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
The database is built automatically on first use. To build (or rebuild) it explicitly:
python company_data.py
# Built .../company.db with {'companies': 12, 'contacts': 16, 'deals': 19}
Running the server
The server speaks MCP over stdio, so you normally run it through a client rather than directly. Two easy ways to poke at it:
MCP Inspector (a browser UI for trying tools by hand — no API key needed):
mcp dev server.py
Claude Desktop — add this to your claude_desktop_config.json:
{
"mcpServers": {
"company-records": {
"command": "python",
"args": ["/absolute/path/to/mcp-server-demo/server.py"]
}
}
}
Restart Claude Desktop and the five tools appear; ask it about the data.
The chat agent (bonus)
chat.py is a self-contained client + agent so you can run the whole thing from
one terminal. It needs an Anthropic API key:
export ANTHROPIC_API_KEY=sk-ant-... # or copy .env.example to .env
python chat.py # interactive
python chat.py "Who are the CEOs in the database and what are their companies?" # one-shot
Example session
$ python chat.py "What's our total closed-won pipeline, and which company has the most deal value?"
Connected to MCP server with 5 tools: search_companies, get_company, find_contacts, deal_summary, top_companies
· calling deal_summary()
· calling top_companies(by='deals', limit=1)
Closed-won deals total $13,075,000 across 7 deals. The company with the most
total deal value is Cobalt Mining Group at $7,700,000.
Those figures come straight from the seeded data — deal_summary reports
closed_won at $13,075,000, and top_companies(by="deals") ranks Cobalt
Mining Group first. The · calling … lines show the actual tool calls Claude
chose to make.
Other questions that work well:
- "Which software companies are in the database and how big are they?"
- "Show me the full record for Pinecrest Health."
- "Find every procurement contact."
- "Rank the top 5 companies by revenue."
Project layout
mcp-server-demo/
├── server.py # MCP server — five tools over the SQLite DB
├── chat.py # CLI agent: Claude + MCP tool-calling loop
├── company_data.py # fictional dataset + SQLite builder
├── requirements.txt
└── .env.example
Tech
Python · Model Context Protocol (mcp SDK, FastMCP) · Anthropic API · SQLite
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。