feat: Add MCP services support and enhance migration scripts
- Introduced new MCP services functionality, including management routes and integration with the agent service. - Updated Docker Compose configuration to include a new SQL migration for MCP services. - Enhanced Makefile with new migration commands for versioning and creating migrations. - Improved chat component to handle selected MCP services in message processing. - Updated migration documentation to reflect new strategies and added MCP services migration files.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
-- Rollback: Remove MCP services table
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Drop trigger
|
||||
DROP TRIGGER IF EXISTS trigger_mcp_services_updated_at ON mcp_services;
|
||||
|
||||
-- Drop function
|
||||
DROP FUNCTION IF EXISTS update_mcp_services_updated_at();
|
||||
|
||||
-- Drop indexes
|
||||
DROP INDEX IF EXISTS idx_mcp_services_tenant_id;
|
||||
DROP INDEX IF EXISTS idx_mcp_services_enabled;
|
||||
DROP INDEX IF EXISTS idx_mcp_services_deleted_at;
|
||||
|
||||
-- Drop table
|
||||
DROP TABLE IF EXISTS mcp_services;
|
||||
|
||||
COMMIT;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
-- 04-add-mcp-services.sql
|
||||
-- Create MCP services table for managing external MCP (Model Context Protocol) services
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Create mcp_services table
|
||||
CREATE TABLE IF NOT EXISTS mcp_services (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
tenant_id INTEGER NOT NULL,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
description TEXT,
|
||||
enabled BOOLEAN DEFAULT true,
|
||||
transport_type VARCHAR(50) NOT NULL, -- Transport type: sse or http-streamable
|
||||
url VARCHAR(512) NOT NULL,
|
||||
headers JSONB, -- HTTP headers as JSON object
|
||||
auth_config JSONB, -- Authentication configuration (API key, token, custom headers)
|
||||
advanced_config JSONB, -- Advanced configuration (timeout, retry settings)
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted_at TIMESTAMP
|
||||
);
|
||||
|
||||
-- Create indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_mcp_services_tenant_id ON mcp_services(tenant_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_mcp_services_enabled ON mcp_services(enabled);
|
||||
CREATE INDEX IF NOT EXISTS idx_mcp_services_deleted_at ON mcp_services(deleted_at);
|
||||
|
||||
-- Add comment to table
|
||||
COMMENT ON TABLE mcp_services IS 'MCP service configurations';
|
||||
|
||||
-- Create trigger for updated_at
|
||||
CREATE OR REPLACE FUNCTION update_mcp_services_updated_at()
|
||||
RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated_at = CURRENT_TIMESTAMP;
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
CREATE TRIGGER trigger_mcp_services_updated_at
|
||||
BEFORE UPDATE ON mcp_services
|
||||
FOR EACH ROW
|
||||
EXECUTE FUNCTION update_mcp_services_updated_at();
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user