index.ts•2.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,
};