Skip to content

Namith-kp/Rosetta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🪨 Rosetta

Ask your data in plain English. A modern NLP-to-SQL interface & Live Database Manager.

React FastAPI MySQL MCP


📖 Overview

Rosetta is an intelligent database interaction platform. It bridges the gap between raw MySQL data and non-technical users by allowing them to query, visualize, and manipulate data using conversational natural language.

Built with a centralized MySQL multi-PC architecture, a FastAPI backend, and a highly polished React/Vite frontend, Rosetta eliminates the need for complex database management tools like MySQL Workbench.

✨ Features

  • 🗣️ Natural Language to SQL: Powered by LLMs (Groq, Gemini, Anthropic). Chat with your database in plain English. The agent handles context, short-name resolution, and constructs highly accurate MySQL queries.
  • 🛡️ Read-Only Guardrails: The chat interface safely isolates intent. Modifications via natural language prompt for clarification before execution, and pure reading is heavily validated against destructive SQL injections.
  • 🎛️ Live Database Manager (CRUD): A sleek, dark-themed real-time data grid. Perform Create, Read, Update, and Delete operations seamlessly right from the browser.
  • 🌐 Multi-PC Networking: Designed to be hosted centrally. The backend and frontend bind to 0.0.0.0, allowing any device on the local network to securely access and edit the data.
  • 🤖 MCP Server Integration: Fully compliant with the open standard Model Context Protocol (MCP). Expose your database as a suite of tools (list_tables, describe_table, run_sql, execute_write) directly to Claude Desktop or autonomous agents via stdio.
  • 📂 Resilient CSV Ingestion: Drag-and-drop CSV uploads dynamically construct MySQL tables on the fly. Uses robust standard-library parsing to bypass strict enterprise OS Application Control/DLL restrictions.

🏗️ Architecture

graph TD
    User([User Device / Browser]) <-->|HTTP/REST :5173 & :8000| Frontend
    
    subgraph PC2 - Application Host
        Frontend[React / Vite Frontend] <-->|Proxy| Backend[FastAPI Backend]
        MCP[FastMCP Server] --- Backend
    end
    
    subgraph PC1 - Data Server
        Backend <-->|mysql-connector-python| MySQL[(MySQL Database)]
    end
    
    Agent([Claude Desktop]) <-->|stdio JSON-RPC| MCP
Loading

🚀 Getting Started

1. Prerequisites

  • Python 3.10+
  • Node.js 18+
  • MySQL 8.0+

2. Database Setup (MySQL)

Ensure your MySQL server is running. Create a database for Rosetta:

CREATE DATABASE rosetta_db;

3. Backend Setup

Navigate to the backend directory, set up your virtual environment, and install dependencies:

cd backend
python -m venv .venv
source .venv/bin/activate  # On Windows use: .venv\Scripts\activate
pip install -r requirements.txt

Create a .env file in the backend folder:

# MySQL Configuration
DB_HOST=192.168.x.x      # IP of the MySQL server (PC1)
DB_USER=your_mysql_user
DB_PASSWORD=your_mysql_password
DB_NAME=rosetta_db

# LLM Providers (Add at least one)
GROQ_API_KEY=gsk_...
GEMINI_API_KEY=AIza...
ANTHROPIC_API_KEY=sk-ant-...

# Preferred Provider Selection
LLM_PROVIDER=gemini      # options: groq, gemini, anthropic

Run the backend server:

uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload

4. Frontend Setup

Navigate to the frontend directory:

cd frontend
npm install

Run the frontend development server:

npm run dev

(The frontend will run on 0.0.0.0:5173 making it accessible across the network).


🔌 MCP Server (For AI Agents)

Rosetta includes a built-in Model Context Protocol (MCP) server, turning the database into an intelligent tool suite for AI clients like Claude Desktop.

To run the MCP server manually (via stdio):

cd backend
python mcp_server.py

Adding to Claude Desktop

Edit your claude_desktop_config.json:

{
  "mcpServers": {
    "rosetta-db": {
      "command": "path/to/python",
      "args": ["path/to/rosetta/backend/mcp_server.py"],
      "env": {
        "DB_HOST": "...",
        "DB_USER": "...",
        "DB_PASSWORD": "...",
        "DB_NAME": "rosetta_db"
      }
    }
  }
}

🔒 Security & Best Practices

  • Network Exposure: The current configuration host: true allows network traffic. Ensure you are operating within a trusted Local Area Network (LAN).
  • Environment Variables: Never commit the .env file to version control. The included .gitignore handles this automatically.
  • Database Backups: While the Live DB Manager makes edits easy, it directly executes against the live MySQL instance. Regular database backups are highly recommended.

About

An intelligent NLP-to-SQL platform that lets you query, visualize, and manage MySQL databases using conversational AI. Includes built-in MCP server support.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors