Database-MCP
🏢 Company Database AI Manager
📖 概要
Company Database AI Manager は、企業データベース向けの自然言語インターフェースです。データの挿入、更新、取得のために複雑な SQL クエリを書く代わりに、ユーザーは平易な英語でコマンドを入力するだけで済みます(例:「IT 部門を追加して、5 人の従業員を割り当ててください」)。
このシスステムは、Model Context Protocol (MCP) を使用して、Groq を搭載した LangGraph エージェントをローカルの Python データベースサーバーに安全に接続します。AI はユーザーのプロンプトを自律的に解釈し、正しいデータベースツールを選択して SQL 操作を実行し、その結果をシンプルな Streamlit ウェブインターフェースで返します。
Related MCP server: PySqlitMCP
⚙️ アーキテクチャと仕組み
このプロジェクトは、真のサーバー/クライアントアーキテクチャを使用して、データベースロジックと AI ロジックを分離しています:
サーバー(
server.pyとmodels.py):SQLite データベースツール(setup_database、add_record、search_database)をホストする独立した FastMCP サーバーを実行します。クライアント(
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 UI を実行する(推奨)
対話型チャットインターフェースを起動するには、次を実行します:
streamlit run app.pyオプション 2:ターミナルクライアントを実行する
エージェントをコマンドラインのみで実行するには:
🛠️ 試してみるサンプルプロンプト
アプリの起動後、チャットに次のプロンプトを入力してみてください:
「データベースのテーブルをセットアップしてください。」(最初にこれを実行してください!)
「IT 部門を追加してください。」
「IT 部門に、給与 75000 の John Doe という名前の新しい従業員を追加してください。」
「給与が 50000 を超える従業員をすべて表示してください。」
🔒 セキュリティに関する注意事項
.env ファイルや API キーをバージョン管理にコミットしないでください。
.gitignore ファイルは、.env と company.db が GitHub にアップロードされないように事前設定されています。
This server cannot be deployed
Maintenance
Related MCP Connectors
Ask questions in plain language, get answers from your business database. No SQL required.
Ask business questions in plain English. Get instant answers from your database, no SQL needed.
Ask your databases questions in plain English, run read-only SQL and set up data alerts.
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
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.-
- AlicenseNot 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.MIT
- 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.12 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with SQLite databases through natural language, supporting SQL queries, CSV imports, and schema exploration.2 npm-