QueryForge
streamlit-dashboard-mcpserver
QueryForge — 与你的数据库对话,看着它变成仪表盘。
一个统一的模型上下文协议(MCP)服务器,让 Claude 能够查询任何 SQLite 数据库、从知识库中检索企业特定的业务逻辑,并构建实时的 Streamlit 仪表盘——全部通过一次对话完成。
项目结构
streamlit-dashboard-mcpserver/
├── .venv/ # Python virtual environment (managed by uv)
├── data/
│ ├── seed.py # Generates the sample CRM database
│ └── database.db # SQLite database (generated by seed.py)
├── knowledge_base/
│ ├── docs/ # Source documents (formulas, business rules, definitions)
│ ├── ingest.py # Chunks + embeds docs into the vector store
│ └── index/ # Persisted vector store (generated by ingest.py)
├── .python-version # Pinned Python version for uv
├── dashboard.py # Auto-generated by Claude at runtime
├── server.py # The MCP server
├── uv.lock # Dependency lock file
└── README.mdRelated MCP server: TheMCP-server
功能
工具 | 描述 |
| 列出数据库中的所有表 |
| 显示表的列、类型和约束 |
| 返回任意表的前 N 行 |
| 运行只读的 SELECT 查询 |
| 从企业文档中检索相关片段(自定义计算公式、业务规则、指标定义),帮助 Claude 编写正确的查询和仪表盘逻辑 |
| 编写 Streamlit 应用,自动安装依赖并启动 |
| 停止正在运行的 Streamlit 进程 |
| 检查仪表盘是否正在运行以及运行在哪个端口 |
| 读取当前 dashboard.py 的源代码 |
强制只读。 INSERT、UPDATE、DELETE、DROP 以及所有其他写操作都在服务器级别被阻止。知识库仅用于检索——Claude 无法通过此服务器向其中写入内容。
query_knowledge_base 是让仪表盘 正确 而非仅仅看似合理的关键。Claude 不会猜测你的组织如何定义“净收入”或“活跃客户”等概念,而是在编写 SQL 或仪表盘代码之前,从分块的企业文档中检索实际记录在案的公式。

前提条件
Python 3.11+(通过
.python-version固定)uv — 本项目已使用(参见
uv.lock)Claude Desktop
一个用于知识库的源文档文件夹(PDF、Markdown 或纯文本——例如你的内部公式表、指标术语表或标准操作流程)
安装
1. 安装 Claude Desktop
下载并安装适用于你操作系统的 Claude Desktop: Windows / macOS:https://claude.ai/download 安装后使用你的 Anthropic 账户登录。
2. 克隆仓库
HTTPS:
git clone https://github.com/your-username/streamlit-dashboard-mcpserver.git
cd streamlit-dashboard-mcpserverSSH:
git clone git@github.com:your-username/streamlit-dashboard-mcpserver.git
cd streamlit-dashboard-mcpserverGitHub CLI:
gh repo clone your-username/streamlit-dashboard-mcpserver
cd streamlit-dashboard-mcpserver3. 使用 uv 设置环境
本项目使用 uv 进行环境管理。.python-version 和 uv.lock 文件已提交,因此只需一条命令即可完成设置。
如果你还没有安装 uv:
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"从锁文件创建虚拟环境并安装所有依赖:
uv sync激活环境:
# Windows PowerShell
.venv\Scripts\Activate.ps1
# Windows CMD
.venv\Scripts\activate.bat激活后,你会在提示符中看到项目名称:
(streamlit-dashboard-mcpserver) PS C:\Users\benij\ds_project\streamlit-dashboard-mcpserver>验证关键包是否已安装:
pip list | findstr "mcp streamlit"如果缺少任何内容:
uv pip install mcp streamlit pandas plotly4. 生成数据库
data/ 中的 seed.py 脚本会生成一个真实的 CRM 数据库,包含 10,000+ 条记录,覆盖完整的雪花模式。
cd data
python seed.py
cd ..这将创建 data/database.db,即 MCP 服务器读取的数据库。
5. 构建知识库索引
将你的企业文档(公式表、指标定义、业务规则——PDF、Markdown 或 .txt)放入 knowledge_base/docs/,然后运行:
python knowledge_base/ingest.py该脚本会对文档进行分块和嵌入,并将生成的向量存储写入 knowledge_base/index/。这就是 query_knowledge_base 在运行时读取的内容——每当源文档发生变化时,请重新运行此脚本。
6. 配置 Claude Desktop
Claude Desktop 从 JSON 配置文件中读取 MCP 服务器定义。
打开配置文件:
notepad $env:APPDATA\Claude\claude_desktop_config.json如果文件尚不存在,记事本会询问是否创建——点击“是”。
粘贴以下配置,如果不同,请将 benij 替换为你的 Windows 用户名:
{
"mcpServers": {
"sqlite-dashboard": {
"command": "C:\\Users\\benij\\ds_project\\streamlit-dashboard-mcpserver\\.venv\\Scripts\\python.exe",
"args": [
"C:\\Users\\benij\\ds_project\\streamlit-dashboard-mcpserver\\server.py"
],
"env": {
"DB_PATH": "C:\\Users\\benij\\ds_project\\streamlit-dashboard-mcpserver\\data\\database.db",
"DASHBOARD_PORT": "8501",
"KB_INDEX_PATH": "C:\\Users\\benij\\ds_project\\streamlit-dashboard-mcpserver\\knowledge_base\\index"
}
}
}
}要确认你的确切 Python 路径,请在激活 venv 后运行:
where.exe python预期输出:
C:\Users\benij\ds_project\streamlit-dashboard-mcpserver\.venv\Scripts\python.exe使用该确切字符串作为配置中的 command 值。
始终使用绝对路径。 Claude Desktop 会从不可预测的工作目录启动 MCP 服务器子进程——相对路径将无法正确解析。
7. 重启 Claude Desktop
保存配置后,完全退出 Claude Desktop——右键单击系统托盘图标 → 退出。然后重新打开。
重新启动后,点击聊天输入框左下角的 🔨 锤子图标。你应该会看到列出的所有 9 个工具,确认服务器已连接。
使用方法
连接后,自然地与 Claude 对话:
"What tables are in my database?"
"How do we define 'net revenue' internally?"
"Show me the top 10 customers by total revenue, using our
company's official revenue formula"
"Build a dashboard with monthly sales trends, a bar chart
by product category, and a salesperson leaderboard"Claude 将探索模式,在需要时从知识库中提取相关业务逻辑,运行查询,编写 Streamlit 代码,安装任何缺失的依赖,并返回一个可在浏览器中打开的 URL——默认为 http://localhost:8501。
环境变量
在你的 claude_desktop_config.json 的 env 块中设置这些变量:
变量 | 默认值 | 描述 |
|
| 你的 SQLite 数据库的绝对路径 |
|
| Streamlit 将监听的端口 |
|
| 由 |
故障排除
🔨 锤子图标未显示在 Claude Desktop 中 配置 JSON 可能无效——尾随逗号和括号不匹配是常见错误。将其粘贴到 jsonlint.com 进行验证。任何配置更改后,务必完全退出并重新打开 Claude Desktop。
“找不到数据库”错误
确认 DB_PATH 是绝对路径,并且 database.db 存在于 data/ 文件夹中。如果尚未生成,请运行 seed.py。
query_knowledge_base 返回无结果 / 索引为空
确认 knowledge_base/docs/ 中确实有文档,然后重新运行 python knowledge_base/ingest.py。确认配置中的 KB_INDEX_PATH 指向 knowledge_base/index/。
Streamlit 页面无法加载
询问 Claude“仪表盘是否正在运行?”以调用 get_dashboard_status。如果未运行,请让 Claude 再次执行 create_dashboard。同时检查端口 8501 是否已被其他进程占用。
uv sync 失败
确保你安装的 Python 版本与 .python-version 匹配。运行 python --version 检查,如有需要,请从 python.org 安装正确的版本。
激活 .venv 时出现 PowerShell ExecutionPolicy 错误
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser然后重新激活。
关于
一个 MCP 服务器,将自然语言转化为 SQL 查询和实时的、感知业务逻辑的 Streamlit 仪表盘,由 Claude 和包含企业特定规则与公式的检索增强知识库驱动。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Query your warehouse or a CSV with Claude/ChatGPT over MCP, governed by table-level ACL + audit.
MCP server giving Claude AI access to 22+ NYC public-record databases for real estate due diligence
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceOne config, one CLI that turns your databases (Postgres, MySQL, SQLite, MongoDB) into MCP servers for Claude, GPT, Cursor, and any MCP-compatible agent.1MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with SQLite databases, filesystem, AWS IAM, and Gmail through a master MCP server with a Streamlit UI optimized for Claude.1-
- AlicenseAqualityBmaintenanceMCP server for Claude that connects to MySQL, MariaDB, and SQLite databases. Query your databases using natural language.3MIT
- AlicenseAqualityDmaintenanceA database-agnostic MCP server that enables natural language queries to your database through Claude or Copilot, automatically writing and executing SQL.816MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mikebenisberchmans/Queryforge'
If you have feedback or need assistance with the MCP directory API, please join our Discord server