Skip to main content
Glama
HumanSamadian

Data Nexus MCP

Data Nexus MCP

モジュール式でセキュアなプラットフォーム。REST API、MCP(Model Context Protocol)、Vue.js Web UI を介して SQL および NoSQL データベースに接続します。

アーキテクチャ

┌─────────────┐     ┌──────────────┐     ┌─────────────────┐
│   Web UI    │────▶│  REST API    │────▶│ core-db-command │
│  (Vue.js)   │     │  (FastAPI)   │     │  (Python lib)   │
└─────────────┘     └──────┬───────┘     └────────┬────────┘
                           │                       │
                    ┌──────▼───────┐               │
                    │  MCP Server  │───────────────┘
                    └──────┬───────┘
                           │
                    ┌──────▼───────┐
                    │  MCP Client  │──▶ AI Agents / LLMs
                    └──────────────┘

モジュール

モジュール

パッケージ

説明

core-db-command

core_db_command/

すべてのデータベースドライバ向けのプラグインベースの Python ライブラリ

rest-api-command

rest_api_command/

OAuth2/LDAP/基本認証を備えた FastAPI REST レイヤー

mcp-server

mcp_server/

MCP ツール: query_database, get_schema, list_tables, describe_table, execute_sql

mcp-client

mcp_client/

エージェント統合のための MCP クライアントブリッジ

web-ui

web-ui/

Vue 3 + Pinia + Monaco Editor クエリスタジオ

config

config/

${ENV} 置換を使用した YAML 接続定義

Related MCP server: Database MCP Server

サポートされているデータベースタイプ

ドライバレジストリは 13 カテゴリ、50 以上のデータベースタイプ をサポートしています:

  • リレーショナル: PostgreSQL, MySQL, MSSQL, Oracle, CockroachDB, TiDB, YugabyteDB, TimescaleDB, pgvector

  • ドキュメント: MongoDB, DocumentDB, Firestore, Couchbase (スタブ)

  • キー・バリュー: Redis, DynamoDB, Memcached/etcd/RocksDB (スタブ)

  • ワイドカラム: Cassandra, ScyllaDB, Bigtable/HBase (スタブ)

  • グラフ: Neo4j, Neptune/JanusGraph/ArangoDB (スタブ)

  • 時系列: InfluxDB, ClickHouse, Prometheus/QuestDB (スタブ)

  • ベクトル: Qdrant, Weaviate, Milvus, Pinecone

  • 検索: Elasticsearch, OpenSearch, Splunk/Solr (スタブ)

  • ウェアハウス: BigQuery, Snowflake, Redshift/Databricks (スタブ)

  • マルチモデル: Cosmos DB, OrientDB (スタブ)

  • 組み込み: SQLite, DuckDB, Realm/LMDB (スタブ)

  • 台帳: QLDB/BigchainDB (スタブ)

  • NewSQL: Spanner (スタブ)

完全実装されたドライバには、PostgreSQL、MySQL、MSSQL、Oracle、MongoDB、Redis、SQLite、DuckDB、Elasticsearch、ClickHouse、Neo4j、InfluxDB、Cassandra、DynamoDB、BigQuery、Snowflake、Qdrant、Weaviate、Milvus、Pinecone、Cosmos DB、Firestore が含まれます。スタブドライバは登録されており、拡張可能です。

クイックスタート

前提条件

  • Python 3.11+

  • Node.js 20+(Web UI 開発用)

  • Docker & Docker Compose(オプション)

1. Python 依存関係のインストール

cp .env.example .env
pip install -e ".[dev]"

2. 接続の設定

config/connections.yaml を編集し、環境変数でシークレットを設定します:

connections:
  - name: postgres_prod
    type: postgresql
    host: localhost
    port: 5432
    database: mydb
    user: readonly_user
    password: ${PG_PASSWORD}

3. REST API の起動

db-rest-api
# or: uvicorn rest_api_command.app:app --reload

API ドキュメント: http://localhost:8000/docs

4. Web UI の起動(開発)

cd web-ui
cp .env.example .env
npm install
npm run dev

http://localhost:5173 を開く — デフォルトの認証情報: admin / changeme

5. Docker Compose で実行

docker compose up -d

サービス:

REST API エンドポイント

メソッド

パス

説明

GET

/api/connections

接続一覧(認証情報なし)

POST

/api/db/{name}/query

パラメータ化クエリ

POST

/api/db/{name}/sql

生 SQL / ネイティブコマンド

GET

/api/db/{name}/schema

データベーススキーマ

GET

/api/db/{name}/tables

テーブル/コレクション一覧

GET

/api/db/{name}/tables/{table}/describe

テーブル構造

GET/POST

/api/query-history

クエリ履歴

MCP サーバー

.env または Cursor MCP env で設定:

MCP_REST_API_URL=http://localhost:8000
# Option A: bearer token (when REST_API_AUTH_MODE=oauth2)
MCP_REST_API_TOKEN=<jwt-from-/api/auth/token>
# Option B: username/password (works with basic auth; auto-fetches JWT if oauth2)
MCP_REST_API_USER=admin
MCP_REST_API_PASSWORD=changeme

実行:

db-mcp-server

Cursor/Claude MCP 設定に追加:

{
  "mcpServers": {
    "data-nexus-mcp": {
      "command": "db-mcp-server",
      "cwd": "/path/to/data_nexus_mcp",
      "env": {
        "MCP_REST_API_URL": "http://localhost:8000",
        "MCP_REST_API_USER": "admin",
        "MCP_REST_API_PASSWORD": "changeme"
      }
    }
  }
}

注: REST_API_* 変数は REST API プロセス(db-rest-api)に属し、MCP サーバー設定には含めません。

MCP クライアント

db-mcp-client                    # list available tools
db-mcp-client query local_sqlite "SELECT 1"

認証

REST_API_AUTH_MODE を次のいずれかに設定:

  • basic — HTTP 基本認証(開発時のデフォルト)

  • oauth2 — /api/auth/token 経由の JWT ベアラートークン

  • ldap — LDAP バインド(REST_API_LDAP_SERVER と REST_API_LDAP_BASE_DN が必要)

新しいドライバの追加

  1. core_db_command/drivers/mydb.py を作成

  2. BaseDriver をサブクラス化し、driver_type を設定

  3. @DriverRegistry.register でデコレート

  4. core_db_command/drivers/registry_loader.py でインポート

from core_db_command.base import BaseDriver, DriverRegistry

@DriverRegistry.register
class MyDBDriver(BaseDriver):
    driver_type = "mydb"

    async def connect(self): ...
    async def disconnect(self): ...
    async def query(self, query, params=None): ...
    async def execute(self, command, params=None): ...
    async def list_tables(self, schema=None): ...
    async def describe_table(self, table, schema=None): ...

テスト

pytest tests/ -v

セキュリティに関する注意

  • 認証情報は REST API や MCP サーバーによって 決して返されません

  • シークレットは YAML 設定で ${ENV_VAR} プレースホルダーを使用する必要があります

  • すべての API エンドポイントは認証を必要とします

  • クエリ入力は検証され、長さ制限があります

プロジェクト構造

data-nexus-mcp/
├── core_db_command/       # Core library + drivers
├── rest_api_command/      # FastAPI REST API
├── mcp_server/            # MCP server
├── mcp_client/            # MCP client
├── web-ui/                # Vue.js frontend
├── config/                # YAML connection config
├── tests/                 # Unit tests
├── docker-compose.yml
├── Dockerfile
└── pyproject.toml

ライセンス

MIT

Available Tools

5 tools
describe_tableA

Describe the structure of a specific table or collection.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes
schemaNo
connection_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description's verb 'describe' implies a read-only, non-destructive operation, which is basic transparency. However, it doesn't disclose any additional behaviors (e.g., permission requirements, response shape, or limitations) beyond that.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence that is direct and front-loaded with the core action and target. Every word earns its place, with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool is simple and has an output schema to document return values, but the description lacks context about relationships to sibling tools and does not mention the need for connection_name or that schema is optional. It is complete for a trivial description but not for a comprehensive agent-facing tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% and the description adds no meaning to the parameters. The schema titles (table, schema, connection_name) are self-explanatory, but the description doesn't explain their roles or any requirements beyond the schema's 'required' fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Describe') and resource ('structure of a specific table or collection'), clearly distinguishing it from siblings like query_database and execute_sql, which run queries. It precisely communicates what the tool does.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when you need the structure of one specific table, but does not explicitly mention when to avoid it or compare with get_schema or list_tables. No exclusions or alternatives are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

execute_sqlB

Execute raw SQL or native database command on a named connection.

ParametersJSON Schema
NameRequiredDescriptionDefault
paramsNo
commandYes
connection_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Since no annotations are provided, the description carries the full burden of behavioral disclosure. It mentions 'raw SQL or native database command', implying potential write operations and risks, but fails to explicitly state that commands can modify data, require admin privileges, or that results may vary by connection type. The output schema exists but is not referenced.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 11 words, making it very concise. It includes the essential elements (execute, raw SQL, named connection) without fluff. However, the brevity leaves out important contextual details that could be added without significant lengthening.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (3 parameters, no annotations, 0% schema coverage, output schema present), the description is incomplete. It omits the role of 'params', fails to explain what 'native command' means, and does not address security or error behavior. The output schema exists but is not mentioned, so the agent cannot infer what will be returned.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It defines 'connection_name' and 'command' but provides no additional meaning beyond the schema fields. The 'params' parameter is an optional object described only as 'anyOf object or null', with no explanation of its role (e.g., parameterized queries). The description adds minimal value over the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool executes raw SQL or native database commands on a named connection. This distinguishes it from siblings like 'query_database' and 'describe_table' by emphasizing raw execution and the need for a named connection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not specify when to use this tool versus siblings like 'query_database' or 'list_tables'. It lacks guidance on prerequisites (e.g., connection setup, permissions) and when not to use it (e.g., for read-only queries or exploratory analysis).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_schemaC

Retrieve schema information for a named database connection.

ParametersJSON Schema
NameRequiredDescriptionDefault
connection_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden of behavioral disclosure. It does not mention whether the operation is read-only, requires permissions, or what happens if the connection_name is invalid. The minimal phrasing 'Retrieve schema information' provides no insight into side effects, errors, or performance implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is front-loaded and contains no unnecessary words. It is concise and easy to parse. However, it could be slightly more informative without losing conciseness, such as noting the output schema or the nature of the schema information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema, the description does not need to explain return values, but it still lacks context about how to use the connection_name parameter, what the tool returns (beyond schema info), and how it relates to sibling tools. The presence of siblings like 'list_tables' and 'describe_table' makes the lack of differentiation a significant gap. The description is too minimal to be fully actionable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has a single parameter 'connection_name' with type string, but the description adds no meaning beyond the schema. With 0% schema description coverage, the description should explain what constitutes a valid connection name or how to obtain it. It does not, so it provides no added value for parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves schema information for a named database connection. It uses a specific verb-resource pair ('Retrieve schema information') and implies a scope of a connection, which distinguishes it from sibling tools like 'describe_table' that focus on individual tables. However, it does not specify what 'schema information' includes (e.g., tables, columns, types), which slightly reduces precision.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as 'list_tables' or 'describe_table'. There are no prerequisites, exclusions, or context about valid connection names. The description lacks any advisory information to help an agent decide between siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_tablesC

List all tables or collections in a named database connection.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNo
connection_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description must fully disclose behavioral traits. It states the tool 'list[s]' tables, implying a read-only operation, but does not explicitly confirm non-destructiveness, error conditions (e.g., invalid connection_name), rate limits, or behavior when 'schema' is null vs. specified. These are important gaps for a database connection tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence with no wasted words. However, it is so brief that it sacrifices information needed for tool selection and correct invocation. Slightly more detail (e.g., about the schema parameter) could be added without sacrificing conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema (which helps with return values), the description lacks essential context about input semantics (especially the schema parameter), error handling, and behavioral guarantees. For a tool with 0% schema description coverage and no annotations, this description is insufficiently complete for correct agent invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning the description must compensate entirely. While 'connection_name' is mentioned in the description ('named database connection'), the 'schema' parameter (which is optional and can be null) is not explained at all. The description does not clarify how 'schema' affects the listing (e.g., filter by schema, ignored if null). This is a significant gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('List') and resource ('tables or collections') and context ('in a named database connection'), clearly distinguishing this tool from siblings like 'describe_table' (which describes a single table) and 'get_schema' (which retrieves schema-level metadata). It leaves no ambiguity about what this tool returns.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal usage guidance. It does not specify when to use this tool versus 'get_schema' or 'describe_table', nor does it mention any prerequisites (e.g., connection must exist). It lacks exclusion criteria or alternative suggestions, relying on the user/agent to infer context from sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_databaseD

Run a parameterized query on a named database connection.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
paramsNo
connection_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

D1.8/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries full burden for behavioral disclosure. It fails to indicate whether the tool is read-only, whether it modifies data, what permissions are needed, or any side effects. The agent cannot determine safety or appropriateness from the description alone.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely short (one sentence), but this brevity comes at the cost of completeness. It is under-specified rather than concise. Every sentence should earn its place; here, it leaves critical gaps.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema (not shown), the description is incomplete. It does not explain return values, error handling, connection requirements, or the role of 'params'. For a tool with 3 parameters and zero annotations, much more context is needed to be minimally viable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, meaning the schema provides no parameter descriptions. The description adds no value: it does not explain the purpose of 'query', 'params', or 'connection_name', nor how to structure the 'params' object. The agent is left guessing parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Run a parameterized query on a named database connection' clearly states the verb and resource, but it does not differentiate itself from the sibling tool 'execute_sql', which likely performs a similar function. The term 'parameterized query' hints at safety but is not explicit enough to distinguish usage.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus siblings like 'get_schema' or 'execute_sql'. There is no mention of prerequisites, when-not-to-use, or alternatives. The agent must rely on the tool name alone to infer context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 5 tool updatesv0.1.0
    • First observeddescribe_table
    • First observedexecute_sql
    • First observedget_schema
    • First observedlist_tables
    • First observedquery_database

TDQS

B3/5.0

Scored across 5 tools

Disambiguation4/5

Tools are mostly distinct: query_database and execute_sql both run queries but one is parameterized and the other raw; get_schema, list_tables, describe_table each target different metadata. Minor potential for confusion between the two query tools, but descriptions clarify the difference.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with lowercase and underscores: query_database, get_schema, list_tables, describe_table, execute_sql. No mixed conventions or irregularities.

Tool Count5/5

5 tools are well-scoped for a database MCP server. The set covers core operations—querying, schema retrieval, table listing, structure description, raw execution—without being overwhelming or too sparse.

Completeness4/5

The tool surface covers essential query and schema exploration operations. The execute_sql tool can handle DDL, but there are no dedicated create/alter/drop tools; transaction commands are also missing. Overall, it's nearly complete for a typical read-heavy interaction pattern.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables LLMs and agents to interact with relational databases (SQL Server, MySQL, PostgreSQL) through MCP tools. Supports executing queries, inserting records, listing tables, and exposing database schemas with secure credential management.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides universal database operations for AI assistants through MCP, supporting 40+ databases including PostgreSQL, MySQL, MongoDB, Redis, and SQLite with built-in introspection tools for schema exploration.
    6 npm
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to interact with heterogeneous databases (MySQL, MongoDB, BigQuery) through MCP tools, allowing natural language queries and database operations.
    -
  • A
    license
    A
    quality
    A
    maintenance
    Gives AI agents direct access to databases across 8 engines with 145+ tools, enabling schema-aware query execution and management through natural language.
    17
    34 npm
    MIT