{
  "markdown": "<p align=\"center\">\n  <img src=\"https://seedbase.dev/seedbase-logo-256.png\" alt=\"Seedbase\" width=\"120\" />\n</p>\n\n# @seedbase/client\n\n[![smithery badge](https://smithery.ai/badge/marcelgl/seedbase)](https://smithery.ai/servers/marcelgl/seedbase)\n\nGenerate realistic, relationship-preserving, privacy-safe test data for your databases — and pull it straight into your local or CI database.\n\nSeedbase lives on [seedbase.dev](https://seedbase.dev): you model (or import) a schema there, generate datasets, and use this package to pull them into Postgres, MySQL, SQLite and more. Schema-aware, foreign-key-correct, reproducible by seed.\n\nThis is the Node.js client, a counterpart to the [Python SDK](https://pypi.org/project/seedbase/).\n\n## Install\n\n```bash\nnpm install @seedbase/client\n```\n\nZero runtime dependencies — pure ESM, built on the native `fetch` of Node 18+.\n\n## Quickstart\n\n```js\nimport { SeedbaseClient } from \"@seedbase/client\";\n\n// Token from the argument, $SEEDBASE_TOKEN, or ~/.seedbase/config.json\nconst client = new SeedbaseClient({ token: \"dr_sk_...\" });\n\n// Trigger a generation and wait for it to finish\nconst gen = await client.generate(projectId, { seed: 42, wait: true });\n\n// Download the result (Uint8Array)\nconst bytes = await client.download(gen.id, { format: \"sql\" });\nimport { writeFile } from \"node:fs/promises\";\nawait writeFile(\"dump.sql\", bytes);\n```\n\n## MCP server (Claude Code, Claude Desktop & friends)\n\nThis package ships `seedbase-mcp` — a zero-dependency [Model Context Protocol](https://modelcontextprotocol.io)\nserver that lets AI assistants generate test data for you. Describe what you\nneed (\"fill my Shop project with MySQL test data\") and the assistant drives\nSeedBase end-to-end through five tools:\n\n| Tool | What it does |\n| --- | --- |\n| `list_projects` | List your SeedBase projects (id, name, database type) |\n| `create_project` | Create a new, empty project |\n| `import_schema` | Import a schema from SQL DDL (raw `pg_dump --schema-only` works), CSV/JSON or ORM model code |\n| `get_ddl` | Get a project's schema as `CREATE TABLE` statements, per dialect |\n| `generate_test_data` | Generate a fresh FK-consistent dataset and return it as SQL (large results are written to a local file, never truncated) |\n\n**Hosted (zero install)** — point any Streamable-HTTP MCP client at\n`https://seedbase.dev/mcp` with an `Authorization: Bearer dr_sk_...` header:\n\n```bash\nclaude mcp add-json seedbase '{\"type\":\"http\",\"url\":\"https://seedbase.dev/mcp\",\"headers\":{\"Authorization\":\"Bearer dr_sk_...\"}}'\n```\n\n**Local via Claude Code (stdio):**\n\n```bash\nclaude mcp add-json seedbase '{\"type\":\"stdio\",\"command\":\"npx\",\"args\":[\"-y\",\"-p\",\"@seedbase/client\",\"seedbase-mcp\"],\"env\":{\"SEEDBASE_API_KEY\":\"dr_sk_...\"}}'\n```\n\n**Claude Desktop** (`claude_desktop_config.json`):\n\n```json\n{\n  \"mcpServers\": {\n    \"seedbase\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"-p\", \"@seedbase/client\", \"seedbase-mcp\"],\n      \"env\": { \"SEEDBASE_API_KEY\": \"dr_sk_...\" }\n    }\n  }\n}\n```\n\nCreate a **free** account at [seedbase.dev/register](https://seedbase.dev/register) (no\ncredit card), then create an API key under Settings → API keys. The free tier is\nenough to generate full, foreign-key-consistent datasets. The server is stdio-only,\ntalks exclusively to `https://seedbase.dev`, and stores nothing locally.\n\n## Authentication\n\nThe token is resolved in this order:\n\n1. The `token` option passed to the constructor.\n2. The `SEEDBASE_TOKEN` environment variable.\n3. The `token` field in `~/.seedbase/config.json` (written by `seedbase login`).\n\nAPI keys with the `dr_sk_` prefix are sent as `Authorization: Bearer ...`, other\ntokens as `Authorization: Token ...`. Get a key at\n[seedbase.dev/settings?tab=api-keys](https://seedbase.dev/settings?tab=api-keys).\n\n## API\n\n```js\nnew SeedbaseClient({\n  token,            // optional, see resolution order above\n  apiUrl,           // default \"https://seedbase.dev/api/v1\" (https enforced, http only for localhost)\n  configPath,       // override ~/.seedbase/config.json\n  requestTimeout,   // per-request timeout in ms, default 30000\n  fetch,            // inject a custom fetch (e.g. for tests)\n});\n```\n\n| Method | Description |\n| --- | --- |\n| `listProjects()` | All datasets/projects (paginated, followed automatically). |\n| `getProject(projectId)` | A single project. |\n| `listGenerations(projectId)` | Generations for a project (paginated). |\n| `getGeneration(generationId)` | A single generation. |\n| `generate(projectId, opts)` | Trigger a generation. `opts`: `{ seed, rows, format, rebaseTo, wait, timeout, pollInterval }`. With `wait: true` it polls until the generation reaches `completed`/`failed`/`cancelled`. |\n| `download(generationId, { format })` | Download the generated artifact as a `Uint8Array`. `format` defaults to `\"sql\"`. |\n| `seededRows(projectId, { seed, rows })` | Generate and return the rows as `{ tableName: [row, ...] }`, in foreign-key-safe order. |\n| `exportConfig(projectId)` | The project's engine config as an object. |\n| `importConfig(projectId, config)` | Replace the project's engine config. |\n\nAll methods are async and return Promises. Failures throw a `SeedbaseError`\n(with `.statusCode` for HTTP errors), carrying a readable message that includes\nthe server's `detail` or field errors.\n\n```js\nimport { SeedbaseError } from \"@seedbase/client\";\n\ntry {\n  await client.getProject(\"missing\");\n} catch (err) {\n  if (err instanceof SeedbaseError) {\n    console.error(err.statusCode, err.message);\n  }\n}\n```\n\n## Prisma seed\n\nFill a Prisma-managed database with realistic, foreign-key-consistent data, in\none call. Your schema must already exist (your `prisma migrate` owns it);\nSeedBase only fills it. Free tier.\n\n```js\n// prisma/seed.ts\nimport { PrismaClient } from \"@prisma/client\";\nimport { SeedbaseClient } from \"@seedbase/client\";\nimport { seedPrisma } from \"@seedbase/client/prisma\";\n\nconst prisma = new PrismaClient();\nconst client = new SeedbaseClient({ token: process.env.SEEDBASE_TOKEN });\n\nawait seedPrisma(prisma, client, { project: process.env.SEEDBASE_PROJECT, seed: 42 });\n```\n\nThen run `prisma db seed`. A runnable demo (offline, no account) is in\n[`examples/prisma-seed-demo.mjs`](examples/prisma-seed-demo.mjs).\n\n## Links\n\n- Website: https://seedbase.dev\n- Docs: https://seedbase.dev/docs\n- API keys: https://seedbase.dev/settings?tab=api-keys\n\nMIT licensed.\n",
  "bytes": 6366,
  "sha": "2846a7420c9e6f6a8a06b2a24957710e29daafc19c7476af9756a93b6d129fd8",
  "repo_slug": "marcelglaeser/seedbase-node",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_marcelglaeser_seedbase_13266f20/readme"
}