Skip to main content
Glama

mcp-turso-cloud

context.ts1.16 kB
/** * Context management for the Turso MCP server */ import { DatabaseContext } from '../common/types.js'; import { get_config } from '../config.js'; // Global context object const context: DatabaseContext = { currentDatabase: undefined, }; /** * Set the current database context */ export function set_current_database( database_name: string | undefined, ): void { context.currentDatabase = database_name; } /** * Get the current database context * If no database is set, use the default from config */ export function get_current_database(): string | undefined { return ( context.currentDatabase || get_config().TURSO_DEFAULT_DATABASE ); } /** * Resolve a database name from the context * If a database name is provided, use it * Otherwise, use the current database from context * Throws an error if no database is available */ export function resolve_database_name( provided_name?: string, ): string { const database_name = provided_name || get_current_database(); if (!database_name) { throw new Error( 'No database specified. Please provide a database name or set a default database.', ); } return database_name; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/spences10/mcp-turso-cloud'

If you have feedback or need assistance with the MCP directory API, please join our Discord server