Skip to main content
Glama

Database MCP Server

index.ts2.2 kB
import * as pg from "pg"; import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { UserInfoOctokit, type ToolProps as UserInfoToolProps } from "./userInfoOctokit.js"; import { Query, type ToolProps as QueryToolProps } from "./query.js"; import { SteampipeTableShow, type ToolProps as SteampipeTableShowToolProps, } from "./steampipe_table_show.js"; import { SteampipeTableList } from "./steampipe_table_list.js"; import { SteampipePluginList } from "./steampipe_plugin_list.js"; import { SteampipePluginShow } from "./steampipe_plugin_show.js"; // Core database tools import { ListTables } from "./list_tables.js"; import { ListExtensions } from "./list_extensions.js"; import { ListMigrations } from "./list_migrations.js"; import { ApplyMigration } from "./apply_migration.js"; import { ExecuteSQL } from "./execute_sql.js"; export interface DatabaseToolsConfig { pool: pg.Pool; } export interface AuthToolsConfig { accessToken: string; } // Register GitHub user info tool (for any authenticated user) export function AuthTools(server: McpServer, config: AuthToolsConfig) { UserInfoOctokit(server, { accessToken: config.accessToken }); } // Register database tools (for authorized users only) export function DatabaseTools(server: McpServer, config: DatabaseToolsConfig) { // Core database tools ListTables(server, { pool: config.pool }); ListExtensions(server, { pool: config.pool }); ListMigrations(server, { pool: config.pool }); ApplyMigration(server, { pool: config.pool }); ExecuteSQL(server, { pool: config.pool }); // Basic SQL query tool (read-only) Query(server, { pool: config.pool }); // Steampipe table tools SteampipeTableList(server, { pool: config.pool }); SteampipeTableShow(server, { pool: config.pool }); // Steampipe plugin tools SteampipePluginList(server, { pool: config.pool }); SteampipePluginShow(server, { pool: config.pool }); } // Export individual registration functions for granular control export { UserInfoOctokit, Query, SteampipeTableList, SteampipeTableShow, SteampipePluginList, SteampipePluginShow, // Core database tools ListTables, ListExtensions, ListMigrations, ApplyMigration, ExecuteSQL, };

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/EmilyThaHuman/database-mcp'

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