Database-MCP
🏢 Company Database AI Manager
📖 概述
Company Database AI Manager 是一个面向企业数据库的自然语言接口。用户无需编写复杂的 SQL 查询来插入、更新或检索数据,只需用简单的英语输入命令即可(例如:“添加一个 IT 部门并为其分配 5 名员工”)。
该系统使用 Model Context Protocol (MCP) 将基于 Groq 的 LangGraph 代理安全地连接到本地 Python 数据库服务器。AI 会自动推理用户的提示词,选择合适的数据库工具,执行 SQL 操作,并在简洁的 Streamlit Web 界面中返回结果。
Related MCP server: PySqlitMCP
⚙️ 架构与工作原理
本项目采用真正的 Server/Client 架构,将数据库逻辑与 AI 逻辑分离:
服务端(
server.py和models.py):运行一个独立的 FastMCP 服务器,托管 SQLite 数据库工具(setup_database、add_record、search_database)。客户端(
client.py和app.py):运行一个由 Groq 的llama-3.3-70b-versatile或openai/gpt-oss-120b提供支持的 LangGraph 代理。协议(MCP):客户端通过标准输入/输出(stdio)安全地连接到服务器。它会向服务器请求可用的工具,将这些工具传递给 LangGraph 代理,并在不直接导入 Python 函数的情况下触发这些函数。
📂 文件夹结构
📦 llm-db-mcp
┣ 📜 .env # Stores secure API keys (Do NOT commit to GitHub)
┣ 📜 .gitignore # Prevents sensitive files from being pushed to Git
┣ 📜 app.py # The Streamlit web UI for interacting with the AI
┣ 📜 client.py # The terminal-based LangGraph agent script
┣ 📜 company.db # The automatically generated SQLite database file
┣ 📜 models.py # SQLAlchemy schemas (Departments, Roles, Employees, Projects)
┣ 📜 requirements.txt # Project dependencies and version numbers
┗ 📜 server.py # The FastMCP server hosting the database tools🚀 设置与安装
1. 前提条件
Python 3.10 或更高版本。
一个免费的 Groq API 密钥。
2. 环境设置
创建并激活虚拟环境(建议使用 Conda):
conda create -n db_mcp python=3.11
conda activate db_mcp3. 安装依赖
安装 requirements.txt 文件中的所有必需软件包:
pip install -r requirements.txt4. 配置 API 密钥
在根目录下创建一个 .env 文件,并添加你的 Groq API 密钥:
GROQ_API_KEY=gsk_your_api_key_here🖥️ 使用方法
选项 1:运行 Web 界面(推荐)
要启动交互式聊天界面,请运行:
streamlit run app.py选项 2:运行终端客户端
要仅通过命令行运行代理:
🛠️ 可以尝试的示例提示词
应用运行后,请尝试在聊天框中输入以下提示词:
“设置数据库表。”(请先运行此提示词!)
“添加一个 IT 部门。”
“添加一位名叫 John Doe 的新员工,薪资为 75000,所属部门为 IT 部门。”
“显示所有薪资超过 50000 的员工。”
🔒 安全说明
切勿将你的 .env 文件或 API 密钥提交到版本控制中。
.gitignore 文件已预先配置,可阻止 .env 和 company.db 被上传到 GitHub。
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 Servers
- FlicenseNot gradedqualityDmaintenanceEnables natural language database operations and semantic document search through SQLite and vector database integration. Converts plain English instructions into SQL queries and provides RAG capabilities for uploaded documents.
- -licenseNot gradedqualityNot gradedmaintenanceEnables comprehensive SQLite database management through natural language, including database creation, table operations, data CRUD operations, backup/restore functionality, and CSV import/export capabilities.
- AlicenseNot gradedqualityDmaintenanceEnables LLM agents to perform complete database operations on SQLite databases, including creating tables, executing queries, and managing data through CRUD operations with schema inspection capabilities.36MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with SQLite databases through natural language, supporting SQL queries, CSV imports, and schema exploration.9
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
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/deepan2003/Database-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server