feat: add embedded MCP server and Makefile
Add an MCP (Model Context Protocol) server that starts on 127.0.0.1:9427 at app launch, sharing connection pools with the Tauri IPC layer. This lets Claude (or any MCP client) query PostgreSQL through Tusk's existing connections. MCP tools: list_connections, execute_query, list_schemas, list_tables, describe_table. Also add a Makefile with targets for dev, build (cross-platform), install/uninstall, lint, and formatting. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,12 +5,13 @@ use crate::state::AppState;
|
||||
use crate::utils::escape_ident;
|
||||
use serde_json::Value;
|
||||
use sqlx::{Column, Row, TypeInfo};
|
||||
use std::sync::Arc;
|
||||
use std::time::Instant;
|
||||
use tauri::State;
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_table_data(
|
||||
state: State<'_, AppState>,
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
schema: String,
|
||||
table: String,
|
||||
@@ -95,7 +96,7 @@ pub async fn get_table_data(
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn update_row(
|
||||
state: State<'_, AppState>,
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
schema: String,
|
||||
table: String,
|
||||
@@ -142,7 +143,7 @@ pub async fn update_row(
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn insert_row(
|
||||
state: State<'_, AppState>,
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
schema: String,
|
||||
table: String,
|
||||
@@ -182,7 +183,7 @@ pub async fn insert_row(
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_rows(
|
||||
state: State<'_, AppState>,
|
||||
state: State<'_, Arc<AppState>>,
|
||||
connection_id: String,
|
||||
schema: String,
|
||||
table: String,
|
||||
|
||||
Reference in New Issue
Block a user