
Security News
Ruby's Bundler 4.0.18 Extends Cooldown to bundle lock and bundle cache
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.
@vistal/mcp-sdk
Advanced tools
Library to turn your app's database into an MCP server for coding agents (Claude Code) — adapter-agnostic, row-level security, zero SQL
Expose a vistal instance as an MCP server, so coding agents like Claude Code can connect to your database — with the same row-level security, field masking, and zero-SQL safety vistal gives in-process.
It's a thin, adapter-agnostic wrapper: works with any configured Vistal
instance, whether backed by @vistal/prisma or @vistal/clickhouse. Tool
definitions and execution both run through vistal's policy engine, so every call
the agent makes is governed by your policies.
Just want to point an agent at a database with no code? Use
@vistal/mcp— give it aDATABASE_URLand it introspects the live schema and serves it read-only. This package (@vistal/mcp-sdk) is for when you want to define the adapter and policies yourself.
npm install @vistal/mcp-sdk @vistal/core
# plus your adapter, e.g. @vistal/prisma + @prisma/client
# plus `express` only if you use the HTTP transport
Write a small entry script that builds your vistal instance (adapter + policies),
then start the server. The agent gets the consolidated tool set by default —
a small fixed verb set (list_resources, describe_resource, query, get,
create, update, delete, aggregate) it uses to discover your schema at
runtime.
// mcp.ts
import { PrismaClient } from "@prisma/client"
import { createVistal } from "@vistal/prisma"
import { startStdioServer } from "@vistal/mcp-sdk"
const prisma = new PrismaClient()
const vistal = createVistal(prisma, { defaultPolicy: "deny-all" })
vistal.policy("order", (ctx) => ({
read: { tenant_id: ctx.tenant.id },
write: { tenant_id: ctx.tenant.id },
delete: false,
}))
await startStdioServer(vistal, {
// Resolved per request — source identity however you like (env, file, …).
context: () => ({
user: { id: process.env.VISTAL_USER_ID ?? "agent", role: process.env.VISTAL_ROLE ?? "support" },
tenant: { id: process.env.VISTAL_TENANT ?? "tenant-alpha" },
}),
})
Add it to your .mcp.json (run the TS entry with tsx):
{
"mcpServers": {
"vistal": {
"command": "npx",
"args": ["tsx", "mcp.ts"],
"env": {
"DATABASE_URL": "postgres://…",
"VISTAL_ROLE": "support",
"VISTAL_TENANT": "tenant-alpha"
}
}
}
}
context accepts a fixed value or a () => ctx | Promise<ctx> resolver
called on every request, so policy is always evaluated against fresh context.
This is the hook for sourcing identity from env vars (as above) — or, over HTTP,
from a verified request.
startStdioServer)What Claude Code and most local MCP clients launch. No networking.
startHttpServer)For remote / shared deployments. Requires the optional peer dependency express.
A fresh server is created per request (stateless), so the context resolver runs
on every call. Deploy behind your own authentication — the context resolver
is the natural place to map a verified caller to a vistal policy context.
import { startHttpServer } from "@vistal/mcp-sdk"
await startHttpServer(vistal, {
context: () => ({ user: { id: "agent", role: "support" }, tenant: { id: "tenant-alpha" } }),
port: 3000, // POST /mcp
})
createMcpServer(vistal, options) returns a transport-agnostic MCP Server
you can connect to any transport yourself.
| Export | Description |
|---|---|
createMcpServer(vistal, options) | Build a transport-agnostic MCP Server. |
startStdioServer(vistal, options) | Build + connect over stdio. |
startHttpServer(vistal, options) | Build + serve over Streamable HTTP (needs express). |
VistalMcpOptions | context, mode ("consolidated" | "per-resource"), toolOptions, serverInfo. |
See examples/ecommerce/mcp.ts for a full,
policy-rich example.
MIT
FAQs
Library to turn your app's database into an MCP server for coding agents (Claude Code) — adapter-agnostic, row-level security, zero SQL
We found that @vistal/mcp-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.

Company News
Socket is now in the AWS Security Hub Extended plan. Adopt it through AWS, apply committed spend, and block malicious open source packages.