Turbular

Turbular

Provides a unified API to connect LLMs to various databases, with schema normalization and query transformation for seamless interaction.

Category
访问服务器

README

Turbular

<div align="center">

FastAPI Python License

</div>

Turbular is an open-source Model Context Protocol (MCP) server that enables seamless database connectivity for Language Models (LLMs). It provides a unified API interface to interact with various database types, making it perfect for AI applications that need to work with multiple data sources.

✨ Features

  • 🔌 Multi-Database Support: Connect to various database types through a single API
  • 🔄 Schema Normalization: Automatically normalize database schemas to correct naming conventions for LLM compatibility
  • 🔒 Secure Connections: Support for SSL and various authentication methods
  • 🚀 High Performance: Optimizes your LLM generated queries
  • 📝 Query Transformation: Let LLM generate queries against normalized layouts and transform them into their unnormalized form
  • 🐳 Docker Support: Easy deployment with Docker and Docker Compose
  • 🔧 Easy to Extend: Adding new database providers can be easily done by extending the BaseDBConnector interface

🗄️ Supported Databases

Database Type Status Icon
PostgreSQL <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/postgresql/postgresql-original.svg" width="20" height="20">
MySQL <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/mysql/mysql-original.svg" width="20" height="20">
SQLite <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/sqlite/sqlite-original.svg" width="20" height="20">
BigQuery <img src="https://www.vectorlogo.zone/logos/google_bigquery/google_bigquery-icon.svg" width="20" height="20">
Oracle <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/oracle/oracle-original.svg" width="20" height="20">
MS SQL <img src="https://raw.githubusercontent.com/devicons/devicon/master/icons/microsoftsqlserver/microsoftsqlserver-plain.svg" width="20" height="20">
Redshift <img src="https://cdn2.iconfinder.com/data/icons/amazon-aws-stencils/100/Database_copy_Amazon_RedShift-512.png" width="20" height="20">

🚀 Quick Start

Using Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/raeudigerRaeffi/turbular.git
    cd turbular
    
  2. Start the development environment:

    docker-compose -f docker-compose.dev.yml up --build
    
  3. Test the connection:

    ./scripts/test_connection.py
    

Manual Installation

  1. Install Python 3.11 or higher

  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Run the server:

    uvicorn app.main:app --reload
    

🔌 API Reference

Database Operations

Get Database Schema

POST /get_schema

Retrieve the schema of a connected database for your LLM agent.

Parameters:

  • db_info: Database connection arguments
  • return_normalize_schema (optional): Return schema in LLM-friendly format

Execute Query

POST /execute_query

Optimizes query and then execute SQL queries on the connected database.

Parameters:

  • db_info: Database connection arguments
  • query: SQL query string
  • normalized_query: Boolean indicating if query is normalized
  • max_rows: Maximum number of rows to return
  • autocommit: Boolean for autocommit mode

File Management

Upload BigQuery Key

POST /upload-bigquery-key

Upload a BigQuery service account key file.

Parameters:

  • project_id: BigQuery project ID
  • key_file: JSON key file

Upload SQLite Database

POST /upload-sqlite-file

Upload a SQLite database file.

Parameters:

  • database_name: Name to identify the database
  • db_file: SQLite database file (.db or .sqlite)

Utility Endpoints

Health Check

GET /health

Verify if the API is running.

List Supported Databases

GET /supported-databases

Get a list of all supported database types.

🔧 Development Setup

  1. Fork and clone the repository

  2. Create a development environment:

    docker-compose -f docker-compose.dev.yml up --build
    
  3. The development server includes:

    • FastAPI server with hot reload
    • PostgreSQL test database
    • Pre-configured test data
  4. Access the API documentation:

    • Swagger UI: http://localhost:8000/docs
    • ReDoc: http://localhost:8000/redoc

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Check out our contribution guidelines
  2. Look for open issues
  3. Submit pull requests with improvements
  4. Help with documentation
  5. Share your feedback

Development Guidelines

  • Follow PEP 8 style guide
  • Write tests for new features
  • Update documentation as needed
  • Use meaningful commit messages

Roadmap

  1. Add more testing, formatting and commit hooks
  2. Add SSH support for database connection
  3. Add APIs as datasources using steampipe
  4. Enable local schema saving for databases to which the server has already connected
  5. Add more datasources (snowflake, mongodb, excel, etc.)
  6. Add authentication protection to routes

🧪 Testing

Run the test suite:

pytest

For development tests with the included PostgreSQL:

./scripts/test_connection.py

📚 Documentation

📝 Connection Examples

PostgreSQL

connection_info = {
    "database_type": "PostgreSQL",
    "username": "user",
    "password": "password",
    "host": "localhost",
    "port": 5432,
    "database_name": "mydb",
    "ssl": False
}

BigQuery

connection_info = {
    "database_type": "BigQuery",
    "path_cred": "/path/to/credentials.json",
    "project_id": "my-project",
    "dataset_id": "my_dataset"
}

SQLite

connection_info = {
    "type": "SQLite",
    "database_name": "my_database"
}

🙏 Acknowledgments

📞 Support

  • Create an issue
  • Email: raffael@turbular.com

<div align="center"> Made with ❤️ by the Turbular Team </div>

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选