Skip to main content
Glama
@orphnet/d1-eloquent-mcp

@orphnet/d1-eloquent-mcp

by Orphnet

@orphnet/d1-eloquent-mcp

Claude(および任意のModel Context Protocol互換クライアント)に、d1-eloquent プロジェクトへのライブでコンテキストを考慮したアクセスを提供するMCPサーバー - モデル、マイグレーション、スキーマ、シーダー、ファクトリー、CLI。

bunx @orphnet/d1-eloquent-mcp

Claudeに提供されるもの

24のツール、6のリソース、2のプロンプト。

イントロスペクション(読み取り専用)

  • list_models · read_model · list_migrations · read_migration · migration_status

  • inspect_schema - sqlite_master をクエリして、D1に実際に何があるかを確認します

  • query_d1 - ローカルD1に対する読み取り専用SQL(SELECT/WITH/EXPLAIN/PRAGMAのみ)

  • list_seeders · list_factories · read_file · refresh_project

  • validate_model · validate_all - 宣言されたモデル形状を実際のスキーマと比較し、ドリフトを報告します

生成(d1-eloquent CLIに委任)

  • make_model · make_migration · make_seeder · make_factory

  • make_resource - モデル + マイグレーション + シーダー + ファクトリーを一度に生成

  • make_pivot

実行(d1-eloquent CLIに委任、デフォルトではローカルD1)

  • run_migrate · run_rollback · run_fresh · run_seed

  • run_generate - スキーマ差分:モデルとライブスキーマのギャップを埋めるマイグレーションを作成します

リソース - Claudeはこれらをバックグラウンドコンテキストとして取得できます

  • d1-eloquent://project/summary - プロジェクトの検出された状態

  • d1-eloquent://docs/api/base-model

  • d1-eloquent://docs/api/query-builder

  • d1-eloquent://docs/api/relationships

  • d1-eloquent://docs/api/transactions

  • d1-eloquent://docs/guide/quick-start

プロンプト - 事前構築されたマルチステップワークフロー

  • create-model - 1つのチャットでスキャフォールド + マイグレーション + 検証

  • audit-schema - すべてのモデルを実際のD1スキーマと比較し、ドリフトを報告します

Related MCP server: MCP Database Bridge

インストール

Claude Code

claude mcp add d1-eloquent -- bunx @orphnet/d1-eloquent-mcp

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json (macOS) または %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "d1-eloquent": {
      "command": "bunx",
      "args": ["@orphnet/d1-eloquent-mcp"]
    }
  }
}

プロジェクトごと(Claude Code)

.claude/mcp.json:

{
  "mcpServers": {
    "d1-eloquent": {
      "command": "bunx",
      "args": ["@orphnet/d1-eloquent-mcp"]
    }
  }
}

現在のディレクトリ以外のプロジェクトを指定するには:

{
  "mcpServers": {
    "d1-eloquent": {
      "command": "bunx",
      "args": ["@orphnet/d1-eloquent-mcp", "--project", "/path/to/your/d1-eloquent-project"]
    }
  }
}

要件

  • Node.js ≥ 22

  • wrangler がインストールされ、D1アクセス用に認証されていること(bun add -D wrangler)

  • 既存の @orphnet/d1-eloquent プロジェクト - サーバーはファイルツリーをスキャンしてモデル/マイグレーション/シーダーを検出します

安全性

  • query_d1 は SELECT / WITH / EXPLAIN / PRAGMA 以外を拒否し、複数ステートメントのペイロードも拒否します。

  • read_file は .. を含むパスや / で始まるパスを拒否します。

  • 生成ツールは既存のd1-eloquent CLIにシェルアウトします - 独自のライターは付属していません。

  • 実行ツール(run_migrate / run_rollback / run_fresh / run_seed)はデフォルトでローカルD1に対してのみ動作します。リモートの場合は、CLIで直接実行してください。

ライセンス

MIT

Available Tools

24 tools
inspect_schemaA

Query the local D1 sqlite_master to list every table + the column definitions actually applied. Read-only.

Inputs: db, table.

list_factoriesA

List discovered factory files. Read-only.

Inputs: no named parameters.

list_migrationsB

List all discovered migration files with timestamps. Read-only.

Inputs: no named parameters.

list_modelsA

List all discovered BaseModel subclasses in the project, with table names and feature flags (soft deletes, revisions, relationships, casts). Read-only.

Inputs: no named parameters.

list_seedersA

List discovered seeder files. Read-only.

Inputs: no named parameters.

make_factoryB

Scaffold a new factory. Delegates to d1-eloquent make:factory.

Inputs: name (required).

make_migrationB

Scaffold a new migration. Delegates to d1-eloquent make:migration.

Inputs: name (required).

make_modelB

Scaffold a new model file. Delegates to d1-eloquent make:model.

Inputs: name (required), softDeletes.

make_pivotB

Scaffold a pivot table migration. Delegates to d1-eloquent make:pivot.

Inputs: table (required).

make_resourceB

Scaffold model + migration + seeder + factory in one go. Delegates to d1-eloquent make:resource.

Inputs: name (required), softDeletes.

make_seederC

Scaffold a new seeder. Delegates to d1-eloquent make:seeder.

Inputs: name (required).

migration_statusA

Run d1-eloquent status against the local D1 - shows which migrations have run vs pending. Read-only. The CLI resolves the D1 binding from wrangler config automatically.

Inputs: no named parameters.

query_d1A

Run a read-only SQL query (SELECT / WITH / EXPLAIN / PRAGMA only) against the local D1. Multi-statement payloads and writes are rejected.

Inputs: sql (required), db.

read_fileA

Read any project file by path (relative to project root). Read-only.

Inputs: path (required).

read_migrationB

Return the source of a migration file. Read-only.

Inputs: name (required).

read_modelA

Return the full source code of a model file plus parsed metadata (relations, casts, static config). Read-only.

Inputs: name (required).

refresh_projectB

Re-run project discovery, update cached state.

Inputs: no named parameters.

run_freshA

Drop all tables and re-run every migration. Delegates to d1-eloquent fresh --force.

Inputs: no named parameters.

run_generateA

Diff models against the project's migrations (schema diff) and report what a reconciling migration would change. Dry-run by default: prints per-model added/dropped/type-changed columns and writes NOTHING. Pass write=true to emit migration file(s) into the project's migrations directory (review them, then run_migrate). Delegates to d1-eloquent generate.

Inputs: name, model, write.

run_migrateB

Apply pending migrations. Delegates to d1-eloquent migrate against local D1.

Inputs: no named parameters.

run_rollbackA

Roll back the last migration batch. Delegates to d1-eloquent rollback.

Inputs: no named parameters.

run_seedC

Run seeders. Delegates to d1-eloquent seed.

Inputs: seeder.

validate_allA

Run validate_model across every discovered model. Returns per-model issues and a summary count of ok / warn / fail.

Inputs: no named parameters.

validate_modelA

Compare a single model's declared shape (table, casts, softDeletes, timestamps, revisions) against the actual local D1 schema and return any drift as a list of issues.

Inputs: name (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 24 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action (list vs read vs make vs run vs validate). Even closely related tools like validate_model and validate_all are clearly differentiated by scope (single vs all). There is no ambiguity in purpose.

    Naming Consistency4/5

    The overwhelming majority use verb_noun snake_case (list_*, make_*, run_*, read_*). The only deviation is migration_status, which uses noun_noun instead of a verb prefix, but this is a minor inconsistency that does not hinder readability.

    Tool Count3/5

    At 24 tools, the set falls in the 16-25 range that feels heavy. While each tool serves a distinct purpose in the D1/Eloquent workflow, the high number may be overwhelming and includes some conveniences (like make_resource) that could be assembled from others.

    Completeness5/5

    The tool set covers the full lifecycle: listing/reading artifacts, scaffolding (model, migration, seeder, factory, pivot), running migrations/seeds/rollbacks, schema inspection, validation, and even raw SQL queries. No significant gaps are apparent for the stated scope.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Enables AI-assisted analysis and optimization of Cloudflare D1 databases through comprehensive schema introspection, relationship mapping, validation, and optimization recommendations. Demonstrates semantic intent patterns with hexagonal architecture for maintainable database development workflows.
      4
      3
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      A Node.js MCP server that gives Claude Code direct access to file operations, database queries, PHP execution, SFTP deployment, and over 60 specialized tools for development and debugging.
      1
      MIT