### Install Exasol MCP Server using uv Source: https://github.com/exasol/mcp-server/blob/main/README.rst Install the 'exasol-mcp-server' using the 'uv tool install' command. This makes the server available for use. ```shell uv tool install exasol-mcp-server@latest ``` -------------------------------- ### Install uv on macOS Source: https://github.com/exasol/mcp-server/blob/main/README.rst Install the 'uv' package manager on macOS using Homebrew. Ensure 'uv' is installed before proceeding with server installation. ```shell brew install uv ``` -------------------------------- ### Configure Claude Desktop with Exasol MCP Server (Installed) Source: https://github.com/exasol/mcp-server/blob/main/README.rst Configure Claude Desktop to use an installed Exasol MCP server. This configuration assumes the server has been previously installed. ```json { "mcpServers": { "exasol_db": { "command": "exasol-mcp-server", "env": "same as above" } } } ``` -------------------------------- ### Start Exasol MCP HTTP Server Source: https://context7.com/exasol/mcp-server/llms.txt Start the Exasol MCP Server as a direct HTTP server for remote deployments. Set environment variables for database connection details. Authentication is required by default. ```bash # Start HTTP server on default host 0.0.0.0, port 8000 export EXA_DSN="exadb.example.com:8563" export EXA_USER="myuser" export EXA_PASSWORD="mypassword" exasol-mcp-server-http --host 0.0.0.0 --port 8000 ``` ```bash # With JWT authentication (requires FASTMCP_SERVER_AUTH set) export FASTMCP_SERVER_AUTH="exa.fastmcp.server.auth.providers.jwt.JWTVerifier" export EXA_AUTH_JWKS_URI="https://myidp.example.com/.well-known/jwks.json" export EXA_AUTH_ISSUER="https://myidp.example.com" export EXA_AUTH_AUDIENCE="exasol-mcp" exasol-mcp-server-http --host 0.0.0.0 --port 8000 ``` ```bash # Development mode without auth (warning: insecure) exasol-mcp-server-http --host 127.0.0.1 --port 8000 --no-auth ``` -------------------------------- ### Install MCP Server with pip Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/deployment.rst Use pip to install the Exasol MCP Server Python package for direct deployment. ```shell pip install exasol-mcp-server ``` -------------------------------- ### Check uv Installation Source: https://github.com/exasol/mcp-server/blob/main/README.rst Verify if the 'uv' package manager is installed. This is a prerequisite for installing and managing the Exasol MCP server. ```shell uv --version ``` -------------------------------- ### Start MCP Server HTTP Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/deployment.rst Start the MCP server HTTP interface from the command line, specifying the port. ```shell exasol-mcp-server-http --port ``` -------------------------------- ### Run Exasol MCP Server as Direct HTTP Server Source: https://github.com/exasol/mcp-server/blob/main/README.rst Start the Exasol MCP server as a direct HTTP server. Specify the host and port for the server to listen on. ```shell exasol-mcp-server-http --host --port ``` -------------------------------- ### MCP Server Settings JSON Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/deployment.rst Example JSON file for configuring MCP Server settings, enabling read query functionality. ```json { "enable_read_query": true } ``` -------------------------------- ### Configure Claude Desktop with Exasol MCP Server (Ephemeral) Source: https://github.com/exasol/mcp-server/blob/main/README.rst Add the Exasol MCP server to the Claude Desktop configuration for ephemeral execution. This method runs the server without a permanent installation. ```json { "mcpServers": { "exasol_db": { "command": "uvx", "args": ["exasol-mcp-server@latest"], "env": { "EXA_DSN": "my-dsn", "EXA_USER": "my-user-name", "EXA_PASSWORD": "my-password" } } } } ``` -------------------------------- ### Check Nginx Version Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/deployment.rst Verify if Nginx is installed by checking its version from the command line. ```shell nginx -v ``` -------------------------------- ### Local MCP Server Configuration Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/server_setup.rst Example of a Claude Desktop configuration file referencing the Exasol MCP Server. The 'env' section defines environment variables for the MCP Server. ```json { "mcpServers": { "exasol_db": { "command": "uvx", "args": ["exasol-mcp-server@latest"], "env": { "EXA_DSN": "my-dsn, e.g. demodb.exasol.com:8563", "EXA_USER": "my-user-name", "EXA_PASSWORD": "my-password", "EXA_MCP_SETTINGS": "{\"schemas\": {\"like_pattern\": \"MY_SCHEMA\"}" } } } } ``` -------------------------------- ### List and Find Exasol Custom Functions Source: https://context7.com/exasol/mcp-server/llms.txt Use `list_functions` to get all custom functions in a schema or `find_functions` to search by keywords. Both return function metadata. ```python funcs = server.list_functions(schema_name="ANALYTICS") for f in funcs: print(f"{f.schema}.{f.name}: {f.comment}") # ANALYTICS.CALC_DISCOUNT: Calculates tiered discount # ANALYTICS.NORMALIZE_PRICE: Price normalization helper found = server.find_functions(keywords=["discount", "promo"], schema_name=None) for f in found: print(f.name) # CALC_DISCOUNT ``` -------------------------------- ### MCP Server Tool Settings via JSON File Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/server_setup.rst Example of setting the EXA_MCP_SETTINGS environment variable to a path of a JSON file containing tool settings. This is an alternative to setting the JSON string directly. ```json { "env": { "other": "variables", "EXA_MCP_SETTINGS": "path_to_settings.json" } } ``` -------------------------------- ### Explore Exasol Built-in Functions Source: https://context7.com/exasol/mcp-server/llms.txt Lists built-in function categories, functions within a category, and detailed descriptions of specific functions, including their types, syntax, and examples. Requires importing specific tools from `exasol.ai.mcp.server.tools.dialect_tools`. ```python from exasol.ai.mcp.server.tools.dialect_tools import ( builtin_function_categories, list_builtin_functions, describe_builtin_function, ) # List all categories categories = builtin_function_categories() print(categories) # ['aggregate', 'analytic', 'arithmetic', 'conversion', 'date', 'numeric', 'string', ...] # List functions in a category string_funcs = list_builtin_functions(category="string") print(string_funcs[:5]) # ['ASCII', 'BIT_LENGTH', 'CHARACTER_LENGTH', 'CHR', 'COLOGNE_PHONETIC'] # Describe a specific function details = describe_builtin_function(name="REGEXP_REPLACE") for d in details: print(f"Name: {d.name}") print(f"Types: {d.types}") print(f"Description: {d.description}") print(f"Syntax: {d.syntax}") print(f"Example: {d.example}") # Name: REGEXP_REPLACE # Types: ['string'] ``` -------------------------------- ### List Exasol SQL Keywords Source: https://context7.com/exasol/mcp-server/llms.txt Retrieves Exasol SQL reserved or non-reserved keywords starting with a specified letter. Useful for SQL syntax validation or autocompletion. ```python reserved_s = server.list_keywords(reserved=True, letter="S") print(reserved_s) # ['SELECT', 'SET', 'SOME', 'START', 'STATEMENT', 'SYSTEM', ...] non_reserved_t = server.list_keywords(reserved=False, letter="T") print(non_reserved_t) # ['TABLE', 'TEXT', 'TIME', 'TIMEZONE', ...] ``` -------------------------------- ### Describe Exasol UDF Signature Source: https://context7.com/exasol/mcp-server/llms.txt Use `describe_script` to get the full signature of a UDF, including inputs, return types (for RETURNS UDFs), or emitted columns (for EMITS UDFs). ```python from exasol.ai.mcp.server.tools.schema.db_output_schema import DBReturnFunction, DBEmitFunction script = server.describe_script(schema_name="ML_SCHEMA", func_name="PREDICT_CHURN") if isinstance(script, DBReturnFunction): print(f"RETURNS {script.returns}") for p in script.input: print(f" IN {p.name} {p.type}") else: # DBEmitFunction print("EMITS:") for col in script.emits: print(f" {col.name} {col.type}") print(f"Dynamic output: {script.dynamic_output}") # EMITS: # CUSTOMER_ID DECIMAL(18,0) # CHURN_PROBABILITY DOUBLE # Dynamic output: False ``` -------------------------------- ### Create Exasol MCP Server Instance Source: https://github.com/exasol/mcp-server/blob/main/README.rst Instantiate the Exasol MCP server using its Python API. This is typically done within a wrapper script for custom deployments. ```python from exasol.ai.mcp.server import mcp_server exasol_mcp = mcp_server() ``` -------------------------------- ### Exasol Keywords Source: https://context7.com/exasol/mcp-server/llms.txt Retrieves Exasol SQL reserved or non-reserved keywords starting with a specified letter. ```APIDOC ## list_keywords ### Description Returns Exasol SQL reserved or non-reserved keywords starting with a given letter. ### Method server.list_keywords ### Parameters #### Query Parameters - **reserved** (bool) - Required - True to list reserved keywords, False for non-reserved. - **letter** (str) - Required - The starting letter for the keywords. ### Response #### Success Response (list[str]) - Returns a list of keywords matching the criteria. ``` -------------------------------- ### List and Describe Exasol System Tables Source: https://context7.com/exasol/mcp-server/llms.txt Lists system tables in the 'SYS' schema and describes a specific system table, providing its schema, name, comment, and column details. Useful for introspection of Exasol metadata. ```python sys_tables = server.list_system_tables() print(sys_tables[:5]) # ['EXA_ALL_COLUMNS', 'EXA_ALL_CONSTRAINTS', 'EXA_ALL_SCHEMAS', 'EXA_ALL_TABLES', 'EXA_ALL_VIEWS'] table_info = server.describe_system_table("EXA_ALL_TABLES") print(f"{table_info.schema}.{table_info.name}: {table_info.comment}") for col in table_info.columns: print(f" {col.name} {col.type}") # SYS.EXA_ALL_TABLES: All tables visible to the current user # TABLE_SCHEMA VARCHAR(128) # TABLE_NAME VARCHAR(128) # TABLE_COMMENT VARCHAR(2000) # TABLE_ROW_COUNT DECIMAL(18,0) ``` -------------------------------- ### Enable BucketFS Read and Write Operations Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/tool_setup.rst Configure to allow reading from and writing to BucketFS. Writing operations require user confirmation for overwriting existing files. ```json { "enable_read_bucketfs": true, "enable_write_bucketfs": true } ``` -------------------------------- ### Programmatically Construct Exasol MCP Server Source: https://context7.com/exasol/mcp-server/llms.txt Build and run the Exasol MCP Server programmatically using the `mcp_server()` factory function. This function reads environment variables for configuration and supports different transport methods. ```python import os from exasol.ai.mcp.server import mcp_server os.environ["EXA_DSN"] = "exadb.example.com:8563" os.environ["EXA_USER"] = "myuser" os.environ["EXA_PASSWORD"] = "mypassword" # Optional: enable query execution and BucketFS tools os.environ["EXA_MCP_SETTINGS"] = '{"enable_read_query": true, "enable_write_query": false}' server = mcp_server() server.run() # stdio transport (default) # Or: server.run(transport="http", host="0.0.0.0", port=8080) ``` -------------------------------- ### Write, Download, and Delete BucketFS Files/Directories Source: https://context7.com/exasol/mcp-server/llms.txt Demonstrates writing text to a file, downloading a file from a URL, deleting a single file, and recursively deleting a directory in BucketFS. Modifying operations require elicitation or `disable_elicitation: true`. ```python import asyncio from unittest.mock import MagicMock from fastmcp import Context async def demo_write(): ctx = MagicMock(spec=Context) # Write text file (requires elicitation or disable_elicitation=True) await server.bucketfs_tools.write_text_to_file( path="scripts/hello.py", content="print('hello from BucketFS')", ctx=ctx, ) # Download a file from a URL to BucketFS await server.bucketfs_tools.download_file( path="models/latest_model.pkl", url="https://artifacts.example.com/releases/model_v3.pkl", ctx=ctx, ) # Delete a single file await server.bucketfs_tools.delete_file(path="scripts/old_script.py", ctx=ctx) # Delete an entire directory recursively await server.bucketfs_tools.delete_directory(path="old_models", ctx=ctx) asyncio.run(demo_write()) ``` -------------------------------- ### Configure AuthKit Provider with Environment Variables Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/open_id_setup.rst Set these environment variables to configure the MCP authentication with AuthKit. Ensure FASTMCP_SERVER_AUTH points to the correct provider class module. ```shell export FASTMCP_SERVER_AUTH=fastmcp.server.auth.providers.workos.AuthKitProvider export FASTMCP_SERVER_AUTH_AUTHKITPROVIDER_AUTHKIT_DOMAIN=https://your-project.authkit.app export FASTMCP_SERVER_AUTH_AUTHKITPROVIDER_BASE_URL=https://your-server.com ``` -------------------------------- ### Configure Auth0 Provider via Environment Variables Source: https://context7.com/exasol/mcp-server/llms.txt Set environment variables to configure the Auth0 provider for authentication. Specify the Auth0 domain and audience for your application. ```bash export FASTMCP_SERVER_AUTH="fastmcp.server.auth.providers.auth0.Auth0Provider" export FASTMCP_SERVER_AUTH_AUTH0_DOMAIN="myapp.us.auth0.com" export FASTMCP_SERVER_AUTH_AUTH0_AUDIENCE="https://exasol-mcp-server/" ``` -------------------------------- ### Configure Claude Desktop Integration Source: https://context7.com/exasol/mcp-server/llms.txt Add this configuration to your `claude_desktop_config.json` to integrate the Exasol MCP Server. It specifies the command to run and environment variables for database connection. ```json { "mcpServers": { "exasol_db": { "command": "uvx", "args": ["exasol-mcp-server@latest"], "env": { "EXA_DSN": "exadb.example.com:8563", "EXA_USER": "myuser", "EXA_PASSWORD": "mypassword" } } } } ``` -------------------------------- ### Configure BucketFS Access Source: https://context7.com/exasol/mcp-server/llms.txt Set environment variables to configure access to Exasol's BucketFS, including URL, bucket name, credentials, and MCP settings. ```bash # Configure BucketFS access (on-prem) export EXA_BUCKETFS_URL="http://exadb.example.com:2580" export EXA_BUCKETFS_BUCKET="default" export EXA_BUCKETFS_USER="w" export EXA_BUCKETFS_PASSWORD="bucketpassword" export EXA_MCP_SETTINGS='{"enable_read_bucketfs": true}' ``` -------------------------------- ### List and Describe Exasol Statistics Tables Source: https://context7.com/exasol/mcp-server/llms.txt Lists statistics tables in the 'EXA_STATISTICS' schema and describes a specific statistics table, showing its columns and their types. Useful for performance monitoring and analysis. ```python stats_tables = server.list_statistics_tables() print(stats_tables[:3]) # ['EXA_MONITOR_DAILY', 'EXA_SYSTEM_EVENTS', 'EXA_SQL_HOURLY'] stats_info = server.describe_statistics_table("EXA_MONITOR_DAILY") for col in stats_info.columns: print(f" {col.name}: {col.type}") # MEASURE_DAY: DATE # CPU: DECIMAL(5,2) # MEMORY: DECIMAL(5,2) ``` -------------------------------- ### List BucketFS Directories and Files Source: https://context7.com/exasol/mcp-server/llms.txt Use `server.bucketfs_tools.list_directories` to list subdirectories and `server.bucketfs_tools.list_files` to list files within a specified BucketFS path. ```python # List subdirectories at BucketFS root dirs = server.bucketfs_tools.list_directories("") print(dirs) # ['models/', 'scripts/', 'data/'] # List files in models/ files = server.bucketfs_tools.list_files("models") print(files) # ['models/churn_model.pkl', 'models/nlp_tokenizer.bin'] ``` -------------------------------- ### Enable Connection Logging Options Source: https://context7.com/exasol/mcp-server/llms.txt Configure options for connection logging, such as logging JWT claims per connection or controlling the logging of HTTP headers. ```bash export EXA_LOG_CLAIMS="yes" export EXA_LOG_HTTP_HEADERS="no" ``` -------------------------------- ### List and Find Exasol Custom Functions Source: https://context7.com/exasol/mcp-server/llms.txt Lists all custom scalar/aggregate functions registered in a schema or keyword-searches them. Requires `server` object to be initialized. ```APIDOC ## List Exasol Custom Functions ### Description Lists all custom scalar and aggregate functions registered in a specified schema. ### Method `server.list_functions(schema_name: str)` ### Parameters #### Path Parameters - **schema_name** (string) - Required - The name of the schema to list functions from. ### Request Example ```python funcs = server.list_functions(schema_name="ANALYTICS") for f in funcs: print(f"{f.schema}.{f.name}: {f.comment}") ``` ### Response Example ``` ANALYTICS.CALC_DISCOUNT: Calculates tiered discount ANALYTICS.NORMALIZE_PRICE: Price normalization helper ``` ## Find Exasol Custom Functions ### Description Keyword-searches custom scalar and aggregate functions across all schemas or a specified schema. ### Method `server.find_functions(keywords: list[str], schema_name: str | None = None)` ### Parameters #### Query Parameters - **keywords** (list[string]) - Required - A list of keywords to search for in function names or comments. - **schema_name** (string) - Optional - The name of the schema to search within. If None, searches all schemas. ### Request Example ```python found = server.find_functions(keywords=["discount", "promo"], schema_name=None) for f in found: print(f.name) # CALC_DISCOUNT ``` ``` -------------------------------- ### Configure Token Introspection via Environment Variables Source: https://context7.com/exasol/mcp-server/llms.txt Configure token introspection for authentication by setting environment variables for the introspection URL, client ID, and client secret. ```bash export FASTMCP_SERVER_AUTH="exa.fastmcp.server.auth.providers.introspection.IntrospectionTokenVerifier" export EXA_AUTH_INTROSPECTION_URL="https://myidp.example.com/oauth/introspect" export EXA_AUTH_CLIENT_ID="mcp-server" export EXA_AUTH_CLIENT_SECRET="secret" ``` -------------------------------- ### Enable SQL Read and Write Queries Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/tool_setup.rst Configure to allow reading and writing data using SQL queries. Both options are disabled by default and should be used with caution, especially write queries. ```json { "enable_read_query": true, "enable_write_query": true } ``` -------------------------------- ### List BucketFS Directories and Files Source: https://context7.com/exasol/mcp-server/llms.txt Lists directories or files within BucketFS at a specified path. Requires BucketFS access configuration and `enable_read_bucketfs: true`. ```APIDOC ## List BucketFS Directories ### Description Lists subdirectories within a specified path in BucketFS. ### Method `server.bucketfs_tools.list_directories(path: str)` ### Parameters #### Path Parameters - **path** (string) - Required - The path within BucketFS to list directories from. Use an empty string for the root. ### Request Example ```python # Configure BucketFS access (on-prem) export EXA_BUCKETFS_URL="http://exadb.example.com:2580" export EXA_BUCKETFS_BUCKET="default" export EXA_BUCKETFS_USER="w" export EXA_BUCKETFS_PASSWORD="bucketpassword" export EXA_MCP_SETTINGS='{"enable_read_bucketfs": true}' # List subdirectories at BucketFS root dirs = server.bucketfs_tools.list_directories("") print(dirs) # ['models/', 'scripts/', 'data/'] ``` ## List BucketFS Files ### Description Lists files within a specified path in BucketFS. ### Method `server.bucketfs_tools.list_files(path: str)` ### Parameters #### Path Parameters - **path** (string) - Required - The path within BucketFS to list files from. ### Request Example ```python # List files in models/ files = server.bucketfs_tools.list_files("models") print(files) # ['models/churn_model.pkl', 'models/nlp_tokenizer.bin'] ``` ### Notes - Requires BucketFS environment variables (`EXA_BUCKETFS_URL`, `EXA_BUCKETFS_BUCKET`, `EXA_BUCKETFS_USER`, `EXA_BUCKETFS_PASSWORD`) to be set. - Requires `enable_read_bucketfs: true` in MCP settings. ``` -------------------------------- ### List Exasol Tables and Views Source: https://context7.com/exasol/mcp-server/llms.txt Retrieves a list of tables within a specified schema. By default, views are not included; enable their listing by setting `views.enable = true` in the MCP settings. ```python tables = server.list_tables(schema_name="SALES") # Returns: [QualifiedDBObject(schema="SALES", name="ORDERS", comment="..."), ...] for t in tables: print(f"{t.schema}.{t.name}") # SALES.ORDERS # SALES.CUSTOMERS # SALES.PRODUCTS ``` -------------------------------- ### Find Exasol Schemas by Keyword Source: https://context7.com/exasol/mcp-server/llms.txt Performs a keyword search across schema names and comments using BM25 ranking. For best results, include common inflections of your search terms. ```python schemas = server.find_schemas(keywords=["sale", "sales", "revenue"]) # Returns ranked list of DBObject instances whose names/comments match the keywords for s in schemas: print(s.name) # "SALES" ``` -------------------------------- ### Configure Exasol MCP Server Settings via JSON Source: https://context7.com/exasol/mcp-server/llms.txt Configure the Exasol MCP Server settings using a JSON string in the `EXA_MCP_SETTINGS` environment variable. This allows fine-grained control over enabled features, schema/table filtering, and other behaviors. ```python import json, os from exasol.ai.mcp.server.setup.server_settings import McpServerSettings # Provide settings as inline JSON in environment variable settings_json = json.dumps({ "enable_read_query": True, "enable_write_query": True, # Requires elicitation-capable MCP client "enable_read_bucketfs": True, "enable_write_bucketfs": False, "disable_elicitation": False, # Set True to skip user confirmation prompts "language": "english", # Improves keyword search relevance "case_sensitive": False, "schemas": { "enable": True, "like_pattern": "SALES%", # Only show schemas starting with SALES "name_field": "schema_name" }, "tables": { "enable": True, "regexp_pattern": "^(FACT|DIM)_.*" # Only FACT_ and DIM_ tables }, "views": { "enable": False # Hide views from LLM } }) os.environ["EXA_MCP_SETTINGS"] = settings_json # Or provide as a file path: ``` -------------------------------- ### Run MCP Server in Docker Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/deployment.rst Launch the MCP Server within a Docker container, mapping ports, setting environment variables, and mounting a settings file. ```shell docker run \ -p 7766:4896 \ -e EXA_DSN=my_dsn \ -e EXA_USER=my_user-name \ -e EXA_PASSWORD=my-password \ -e FASTMCP_SERVER_AUTH=exa.fastmcp.server.auth.oauth_proxy.OAuthProxy \ -e EXA_AUTH_UPSTREAM_AUTHORIZATION_ENDPOINT=my_identity_provider/oauth2/authorize \ -e EXA_AUTH_UPSTREAM_TOKEN_ENDPOINT=my_identity_provider/oauth2/token \ -e EXA_AUTH_UPSTREAM_CLIENT_ID=my_client_id \ -e EXA_AUTH_UPSTREAM_CLIENT_SECRET=my_client_secret \ -e EXA_AUTH_JWKS_URI=my_identity_provider/jwks \ -e EXA_AUTH_BASE_URL=my_mcp_server \ -e EXA_MCP_SETTINGS=/app/settings.json \ -v local_path_to_settings.json:/app/settings.json \ exadockerci4/exasol-mcp-server:latest \ --port 4896 ``` -------------------------------- ### Configure Multi-user On-Prem DB User Extraction Source: https://context7.com/exasol/mcp-server/llms.txt For multi-user on-premises deployments, configure the Exasol DSN and specify the JWT claim that holds the database username. No password is required as authentication is handled by the user's token. ```bash export EXA_DSN="exadb.example.com:8563" export EXA_USERNAME_CLAIM="db_username" ``` -------------------------------- ### List and Find Exasol UDF Scripts Source: https://context7.com/exasol/mcp-server/llms.txt Use `list_scripts` to retrieve all UDF scripts in a schema or `find_scripts` to search by keywords. This applies to Python, R, Java, and Lua UDFs. ```python scripts = server.list_scripts(schema_name="ML_SCHEMA") for s in scripts: print(f"{s.schema}.{s.name}") # ML_SCHEMA.PREDICT_CHURN # ML_SCHEMA.TOKENIZE_TEXT found = server.find_scripts(keywords=["predict", "model"], schema_name=None) ``` -------------------------------- ### List and Find Exasol User-Defined Functions (UDFs) Source: https://context7.com/exasol/mcp-server/llms.txt Lists or keyword-searches UDF scripts (Python, R, Java, Lua) within a specified schema. ```APIDOC ## List Exasol User-Defined Functions (UDFs) ### Description Lists all User-Defined Function (UDF) scripts of type UDF registered in a specified schema. ### Method `server.list_scripts(schema_name: str)` ### Parameters #### Path Parameters - **schema_name** (string) - Required - The name of the schema to list UDFs from. ### Request Example ```python scripts = server.list_scripts(schema_name="ML_SCHEMA") for s in scripts: print(f"{s.schema}.{s.name}") ``` ### Response Example ``` ML_SCHEMA.PREDICT_CHURN ML_SCHEMA.TOKENIZE_TEXT ``` ## Find Exasol User-Defined Functions (UDFs) ### Description Keyword-searches UDF scripts (Python, R, Java, Lua) across all schemas or a specified schema. ### Method `server.find_scripts(keywords: list[str], schema_name: str | None = None)` ### Parameters #### Query Parameters - **keywords** (list[string]) - Required - A list of keywords to search for in UDF script names or comments. - **schema_name** (string) - Optional - The name of the schema to search within. If None, searches all schemas. ### Request Example ```python found = server.find_scripts(keywords=["predict", "model"], schema_name=None) ``` ``` -------------------------------- ### Configure JWT Verification via Environment Variables Source: https://context7.com/exasol/mcp-server/llms.txt Set environment variables to configure JWT verification for authentication. Ensure JWKS URI, issuer, audience, and required scopes are correctly defined. ```bash export FASTMCP_SERVER_AUTH="exa.fastmcp.server.auth.providers.jwt.JWTVerifier" export EXA_AUTH_JWKS_URI="https://myidp.example.com/.well-known/jwks.json" export EXA_AUTH_ISSUER="https://myidp.example.com" export EXA_AUTH_AUDIENCE="exasol-mcp-server" export EXA_AUTH_REQUIRED_SCOPES="db:read" ``` -------------------------------- ### Execute Exasol Write Query Source: https://context7.com/exasol/mcp-server/llms.txt Executes a DML or DDL query. Requires `enable_write_query: true`. Optionally allows user review and modification before execution. ```APIDOC ## Execute Exasol Write Query ### Description Executes a Data Manipulation Language (DML) or Data Definition Language (DDL) query against the Exasol database. This operation requires `enable_write_query: true` in the MCP server settings. By default, elicitation is enabled, allowing the user to review and optionally modify the query before it is executed. The function returns the modified query string if changes were made, otherwise `None`. ### Method `await server.execute_write_query(query: str, ctx: Context)` ### Parameters #### Path Parameters - **query** (string) - Required - The DML or DDL query to execute. - **ctx** (Context) - Required - The context object provided by the framework. ### Request Example ```python import asyncio from unittest.mock import AsyncMock, MagicMock from fastmcp import Context # In a real MCP session the Context is provided by the framework. # disable_elicitation=True skips confirmation (useful for testing): os.environ["EXA_MCP_SETTINGS"] = '{"enable_write_query": true, "disable_elicitation": true}' async def run_write(): ctx = MagicMock(spec=Context) result = await server.execute_write_query( query='INSERT INTO "SALES"."STAGING" VALUES (1, \'test\')', ctx=ctx ) print(result) # None (query ran unchanged) asyncio.run(run_write()) ``` ### Response Example ``` None ``` ### Notes - Requires `enable_write_query: true` in MCP settings. - If `disable_elicitation` is set to `true` in settings, the query is executed directly without user confirmation. ``` -------------------------------- ### Execute Exasol Write Query with Elicitation Source: https://context7.com/exasol/mcp-server/llms.txt Use `execute_write_query` for DML/DDL statements. Requires `enable_write_query: true`. By default, it elicits user confirmation and modification before execution. ```python import asyncio from unittest.mock import AsyncMock, MagicMock from fastmcp import Context # In a real MCP session the Context is provided by the framework. # disable_elicitation=True skips confirmation (useful for testing): os.environ["EXA_MCP_SETTINGS"] = '{"enable_write_query": true, "disable_elicitation": true}' async def run_write(): ctx = MagicMock(spec=Context) result = await server.execute_write_query( query='INSERT INTO "SALES"."STAGING" VALUES (1, \'test\')', ctx=ctx ) print(result) # None (query ran unchanged) asyncio.run(run_write()) ``` -------------------------------- ### Describe Exasol Table or View Structure Source: https://context7.com/exasol/mcp-server/llms.txt Fetches detailed structural metadata for a table or view, including columns (name, type, comment) and constraints (primary/foreign keys). ```python table = server.describe_table(schema_name="SALES", table_name="ORDERS") # Returns: DBTable print(f"Table: {table.schema}.{table.name}") print(f"Comment: {table.comment}") print("Columns:") for col in table.columns: print(f" {col.name} ({col.type}): {col.comment or ''}") print("Constraints:") for c in (table.constraints or []): print(f" [{c.constraint_type}] {c.name}: columns={c.columns}") if c.referenced_table: print(f" -> {c.referenced_schema}.{c.referenced_table}({c.referenced_columns})") # Example output: # Table: SALES.ORDERS # Comment: Customer order records # Columns: # ORDER_ID (DECIMAL(18,0)): # CUSTOMER_ID (DECIMAL(18,0)): FK to CUSTOMERS # ORDER_DATE (DATE): # AMOUNT (DECIMAL(12,2)): Order total in USD # Constraints: # [PRIMARY KEY] PK_ORDERS: columns=ORDER_ID # [FOREIGN KEY] FK_CUST: columns=CUSTOMER_ID # -> SALES.CUSTOMERS(CUSTOMER_ID) ``` -------------------------------- ### Configure MCP Settings via Environment Variable Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/tool_setup.rst Specify customized MCP settings directly within the MCP Client configuration file using the EXA_MCP_SETTINGS environment variable. Ensure double quotes within the JSON string are escaped. ```json { "env": { "EXA_DSN": "my-dsn", "EXA_USER": "my-user-name", "EXA_PASSWORD": "my-password", "EXA_MCP_SETTINGS": "{\"schemas\": {\"like_pattern\": \"MY_SCHEMA\"}" } } ``` -------------------------------- ### Find Exasol Tables and Views by Keyword Source: https://context7.com/exasol/mcp-server/llms.txt Keyword-searches tables and views, optionally filtering results to a specific schema. Pass `None` or an empty string for `schema_name` to search all schemas. ```python results = server.find_tables( keywords=["order", "orders", "purchase"], schema_name="SALES" # Optional; pass None or "" to search all schemas ) for t in results: print(f"{t.schema}.{t.name}: {t.comment}") # SALES.ORDERS: Customer order records ``` -------------------------------- ### Exasol System Tables Source: https://context7.com/exasol/mcp-server/llms.txt Tools for listing and describing system tables within the `SYS` schema of Exasol. ```APIDOC ## list_system_tables ### Description Lists all system tables available in the `SYS` schema. ### Method server.list_system_tables ### Response #### Success Response (list[str]) - Returns a list of system table names. ``` ```APIDOC ## describe_system_table ### Description Describes a specific system table in the `SYS` schema, including its columns and comment. ### Method server.describe_system_table ### Parameters #### Path Parameters - **table_name** (str) - Required - The name of the system table to describe. ### Response #### Success Response (object) - Returns an object with table details: - **schema** (str) - The schema name (always 'SYS'). - **name** (str) - The name of the table. - **comment** (str) - The comment associated with the table. - **columns** (list[object]) - A list of column objects, each with: - **name** (str) - The column name. - **type** (str) - The column data type. ``` -------------------------------- ### Execute Exasol Query Source: https://context7.com/exasol/mcp-server/llms.txt Executes a SELECT query and returns the results as a list of dictionaries. Requires `enable_read_query: true` in settings. ```APIDOC ## Execute Exasol Query ### Description Executes a `SELECT` query against the Exasol database and returns the results as a list of dictionaries. This operation requires `enable_read_query: true` to be set in the MCP server settings. The query is validated to ensure it is a `SELECT` statement. ### Method `server.execute_query(query: str)` ### Parameters #### Path Parameters - **query** (string) - Required - The `SELECT` query to execute. ### Request Example ```python # Settings must have enable_read_query=True rows = server.execute_query( query='SELECT "ORDER_ID", "AMOUNT" FROM "SALES"."ORDERS" WHERE "AMOUNT" > 1000 LIMIT 5' ) for row in rows: print(row) ``` ### Response Example ``` {'ORDER_ID': 10042, 'AMOUNT': Decimal('1250.00')} {'ORDER_ID': 10087, 'AMOUNT': Decimal('3400.50')} ``` ### Error Handling - Raises `ValueError` if the query is invalid or not a `SELECT` statement. ``` -------------------------------- ### Build pyexasol Connection Factory Source: https://context7.com/exasol/mcp-server/llms.txt Creates a connection factory for pyexasol, supporting multiple authentication modes detected from environment variables. Use this factory within a `with` statement to manage database connections. ```python import os from exasol.ai.mcp.server.connection.connection_factory import get_connection_factory # --- Mode A: On-Prem static credentials --- env_onprem = { "EXA_DSN": "exadb.example.com:8563", "EXA_USER": "myuser", "EXA_PASSWORD": "mypassword", # Optional SSL "EXA_SSL_CERT_VALIDATION": "yes", "EXA_SSL_TRUSTED_CA": "/etc/ssl/certs/ca-bundle.crt", # Optional connection pool size (default: 5) "EXA_POOL_SIZE": "10", } factory = get_connection_factory(env_onprem) with factory() as conn: result = conn.execute("SELECT CURRENT_USER").fetchval() print(result) # "MYUSER" ``` ```python # --- Mode B: On-Prem OpenID (token from MCP context) --- env_oidc = { "EXA_DSN": "exadb.example.com:8563", "EXA_USERNAME_CLAIM": "db_user", # JWT claim holding the DB username } ``` ```python # --- Mode D: SaaS with pre-configured PAT --- env_saas = { "EXA_SAAS_HOST": "https://cloud.exasol.com", "EXA_SAAS_ACCOUNT_ID": "acc-123", "EXA_SAAS_PAT": "my-personal-access-token", "EXA_SAAS_DATABASE_NAME": "my_analytics_db", } factory_saas = get_connection_factory(env_saas) with factory_saas() as conn: rows = conn.execute("SELECT COUNT(*) FROM SYS.EXA_ALL_TABLES").fetchval() print(rows) # 42 ``` -------------------------------- ### Configure Rotating File and Console Logging Source: https://context7.com/exasol/mcp-server/llms.txt Set environment variables to configure logging behavior, including the log file path, level, size limits, backup count, format, and whether to log to the console. ```bash export EXA_MCP_LOG_FILE="/var/log/exasol-mcp/server.log" export EXA_MCP_LOG_LEVEL="INFO" export EXA_MCP_LOG_MAX_SIZE="5242880" export EXA_MCP_LOG_BACKUP_COUNT="10" export EXA_MCP_LOG_FORMATTER="%(asctime)s %(levelname)s %(name)s %(message)s" export EXA_MCP_LOG_TO_CONSOLE="yes" ``` -------------------------------- ### Write, Download, and Delete BucketFS Files/Directories Source: https://context7.com/exasol/mcp-server/llms.txt Tools for managing files and directories within BucketFS, including writing text, downloading from URLs, and deleting items. Modifying operations require elicitation by default. ```APIDOC ## write_text_to_file ### Description Writes text content to a file in BucketFS. ### Method server.bucketfs_tools.write_text_to_file ### Parameters #### Path Parameters - **path** (str) - Required - The destination path for the file in BucketFS. - **content** (str) - Required - The text content to write to the file. - **ctx** (Context) - Required - The context object for the operation. - **disable_elicitation** (bool) - Optional - If true, bypasses user confirmation. ### Response #### Success Response (None) - Operation completes successfully. ``` ```APIDOC ## download_file ### Description Downloads a file from a URL and saves it to BucketFS. ### Method server.bucketfs_tools.download_file ### Parameters #### Path Parameters - **path** (str) - Required - The destination path in BucketFS. - **url** (str) - Required - The URL of the file to download. - **ctx** (Context) - Required - The context object for the operation. - **disable_elicitation** (bool) - Optional - If true, bypasses user confirmation. ### Response #### Success Response (None) - Operation completes successfully. ``` ```APIDOC ## delete_file ### Description Deletes a single file from BucketFS. ### Method server.bucketfs_tools.delete_file ### Parameters #### Path Parameters - **path** (str) - Required - The path to the file to delete. - **ctx** (Context) - Required - The context object for the operation. - **disable_elicitation** (bool) - Optional - If true, bypasses user confirmation. ### Response #### Success Response (None) - Operation completes successfully. ``` ```APIDOC ## delete_directory ### Description Deletes an entire directory recursively from BucketFS. ### Method server.bucketfs_tools.delete_directory ### Parameters #### Path Parameters - **path** (str) - Required - The path to the directory to delete. - **ctx** (Context) - Required - The context object for the operation. - **disable_elicitation** (bool) - Optional - If true, bypasses user confirmation. ### Response #### Success Response (None) - Operation completes successfully. ``` -------------------------------- ### List Exasol SQL Types Source: https://context7.com/exasol/mcp-server/llms.txt Retrieves a list of all Exasol SQL types, including their creation parameters and default precision. Useful for understanding data type capabilities. ```python sql_types = server.list_sql_types() for t in sql_types: print(f"{t.type} | params: {t.create_params} | precision: {t.precision}") # DECIMAL | params: PRECISION,SCALE | precision: 18 # VARCHAR | params: LENGTH | precision: None # TIMESTAMP | params: FRACTIONAL_SECONDS_PRECISION | precision: 3 # BOOLEAN | params: None | precision: None ``` -------------------------------- ### Load MCP Server Settings Source: https://context7.com/exasol/mcp-server/llms.txt Loads MCP server settings from a JSON string. Accesses specific settings like read query enablement and schema name patterns. ```python os.environ["EXA_MCP_SETTINGS"] = "/etc/exasol-mcp/settings.json" settings = McpServerSettings.model_validate_json(settings_json) print(settings.enable_read_query) # True print(settings.schemas.like_pattern) # "SALES%" ``` -------------------------------- ### Include Server Configuration in Nginx Source: https://github.com/exasol/mcp-server/blob/main/doc/user_guide/deployment.rst Add the MCP Server's Nginx configuration file to the main nginx.conf within the http section. ```C http { ... include ; ... ``` -------------------------------- ### Execute Exasol SELECT Query Source: https://context7.com/exasol/mcp-server/llms.txt Use `execute_query` to run SELECT statements and retrieve results as a list of dictionaries. Requires `enable_read_query: true` in settings and validates the query is a SELECT statement. ```python # Settings must have enable_read_query=True rows = server.execute_query( query='SELECT "ORDER_ID", "AMOUNT" FROM "SALES"."ORDERS" WHERE "AMOUNT" > 1000 LIMIT 5' ) for row in rows: print(row) # {'ORDER_ID': 10042, 'AMOUNT': Decimal('1250.00')} # {'ORDER_ID': 10087, 'AMOUNT': Decimal('3400.50')} # Invalid or non-SELECT raises ValueError: try: server.execute_query("DELETE FROM SALES.ORDERS") except ValueError as e: print(e) # "The query is invalid or not a SELECT statement." ``` -------------------------------- ### List Exasol SQL Types Source: https://context7.com/exasol/mcp-server/llms.txt Retrieves a list of all available Exasol SQL data types, including their creation parameters and default precision. ```APIDOC ## list_sql_types ### Description Returns all Exasol SQL types with their creation parameters and default precision. ### Method server.list_sql_types ### Response #### Success Response (list[object]) - Returns a list of objects, where each object represents an SQL type and has the following properties: - **type** (str) - The name of the SQL type. - **create_params** (str) - The parameters required for creating the type (e.g., PRECISION, SCALE). - **precision** (int or None) - The default precision for the type. ```