Skip to content

From Drizzle

Expose Drizzle tables as read-only MCP tools.

Quick start

ts
import { createStdioServer } from '@bridgent/core'
import { fromDrizzle } from '@bridgent/source-drizzle'
import { db } from './db'
import * as schema from './schema'

await createStdioServer({
  name: 'drizzle-readonly',
  version: '0.0.1',
  tools: await fromDrizzle({
    db,
    tables: {
      users: schema.users,
      posts: schema.posts,
    },
    maxLimit: 100,
  }),
})

Safety posture

@bridgent/source-drizzle@0.2.0 added one read-only findMany tool per table:

ts
db.select().from(table).limit(n).offset(n)

The adapter does not accept raw SQL and does not generate write tools.

Options

OptionPurpose
dbInstantiated Drizzle database object with select()
tablesMap of public table names to Drizzle table objects
namespacePrefix generated tool names
tableFilterRegExp or function filter for table names
defaultLimitLimit used when the caller omits limit
maxLimitHard cap for caller-provided limit

Generated tool names use <namespace?><table>_find_many.

Released under the MIT License.