npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

bishop-database-mcp

v0.0.9

Published

Bishop's Database MCP Server - Rust+WASM Workspace with Optimus Prime DevOps Pipeline

Readme

Bishop Database MCP Server

Serveur MCP de base de données ultra-précis avec technologie Rust+WASM

"Je préfère le terme 'Personne Artificielle' - et mes connexions de base de données ne font jamais d'approximations."
— Bishop, Spécialiste en Précision Synthétique

npm version License: MIT Node.js Version WASM

🚀 Qu'est-ce que Bishop Database MCP ?

Bishop Database MCP est un serveur Model Context Protocol (MCP) ultra-performant qui permet à Claude Code et d'autres clients MCP d'interagir avec des bases de données de manière sécurisée et efficace. Construit avec Rust et WebAssembly, il offre :

  • 🎯 Précision Synthétique : Aucune approximation, intégrité à 100%
  • ⚡ Performance WASM : Vitesse native avec la sécurité du sandboxing
  • 🔒 Sécurité Maximale : Validation complète des requêtes et paramètres
  • 🌐 Multi-SGBD : Support SQLite, PostgreSQL, MySQL et SQL Server
  • 📊 Monitoring Avancé : Métriques de performance en temps réel
  • 🔧 Pool de Connexions : Gestion optimisée des ressources

🛠 Fonctionnalités Principales

Opérations de Base de Données

  • Connexion Sécurisée : Établir des connexions avec validation d'intégrité
  • Exécution de Requêtes : SQL sécurisé avec paramètres typés
  • Exploration de Schéma : Lister tables, colonnes et métadonnées
  • Validation d'Intégrité : Vérification automatique des contraintes
  • Monitoring Santé : Diagnostic en temps réel des connexions

Types de Bases de Données Supportées

  • SQLite : Base de données locale haute performance
  • PostgreSQL : SGBD relationnel avancé avec JSON
  • MySQL/MariaDB : Compatibilité complète avec écosystème MySQL
  • SQL Server : Support Microsoft SQL Server via Tiberius

Architecture Technique

  • Rust Core : Moteur de base de données compilé en WebAssembly
  • TypeScript Wrapper : Interface MCP moderne et typée
  • Pool BB8 : Gestion avancée des connexions avec failover
  • Validation Zod : Schémas de validation runtime robustes

📦 Installation

Via npm (Recommandé)

# Installation globale
npm install -g bishop-database-mcp

# Ou installation locale dans votre projet
npm install bishop-database-mcp

Via Claude Code

# Ajouter le serveur MCP à Claude Code
claude mcp add bishop-database npx bishop-database-mcp start

⚙️ Configuration avec Claude Code

1. Configuration MCP Standard

Ajoutez cette configuration à votre fichier mcp.json :

{
  "servers": {
    "bishop-database": {
      "command": "npx",
      "args": ["bishop-database-mcp", "start"],
      "env": {
        "LOG_LEVEL": "info"
      }
    }
  }
}

2. Configuration Avancée

Pour une configuration plus détaillée, créez un fichier bishop-config.json :

{
  "log_level": "debug",
  "max_concurrent_operations": 10,
  "operation_timeout_ms": 30000,
  "wasm_memory_pages": 256,
  "default_pool_config": {
    "min_connections": 1,
    "max_connections": 10,
    "acquire_timeout_seconds": 30,
    "idle_timeout_seconds": 600
  },
  "features": {
    "integrity_validation": true,
    "query_logging": true,
    "performance_metrics": true,
    "connection_pooling": true
  },
  "security": {
    "max_query_size": 1048576,
    "max_results_size": 10485760,
    "allowed_operations": ["SELECT", "INSERT", "UPDATE", "DELETE", "CREATE", "DROP", "ALTER"]
  }
}

Puis utilisez :

{
  "servers": {
    "bishop-database": {
      "command": "npx",
      "args": ["bishop-database-mcp", "start", "--config", "./bishop-config.json"],
      "env": {
        "NODE_ENV": "production"
      }
    }
  }
}

3. Configuration Docker (Production)

{
  "servers": {
    "bishop-database": {
      "command": "docker",
      "args": [
        "run", "--rm", "-i",
        "--network", "host",
        "-v", "${PWD}/data:/app/data",
        "bishop/database-mcp:latest"
      ]
    }
  }
}

🎯 Utilisation avec Claude Code

Connexion à une Base de Données

{
  "tool": "connect_database",
  "config": {
    "id": "main-db",
    "name": "Base de Production",
    "db_type": "postgresql",
    "connection": {
      "host": "localhost",
      "port": 5432,
      "database": "myapp",
      "username": "user",
      "password": "password",
      "ssl": true
    },
    "pool": {
      "min_connections": 2,
      "max_connections": 20,
      "acquire_timeout_seconds": 30,
      "idle_timeout_seconds": 300
    }
  }
}

Exécution de Requêtes Sécurisées

{
  "tool": "execute_query",
  "database_id": "main-db",
  "query": "SELECT id, name, email FROM users WHERE created_at > $1 AND status = $2",
  "parameters": [
    {"name": "since", "value": "2024-01-01", "param_type": "Date"},
    {"name": "status", "value": "active", "param_type": "String"}
  ]
}

Exploration de Schéma

{
  "tool": "get_tables",
  "database_id": "main-db"
}
{
  "tool": "get_table_info",
  "database_id": "main-db",
  "table_name": "users"
}

Monitoring et Diagnostics

{
  "tool": "health_check",
  "database_id": "main-db"
}
{
  "tool": "get_performance_metrics"
}

🔧 Outils Disponibles

| Outil | Description | Paramètres | |-------|-------------|------------| | connect_database | Connexion sécurisée à une BDD | config: DatabaseConfig | | execute_query | Exécution de requête SQL | database_id, query, parameters? | | get_tables | Liste des tables | database_id, schema? | | get_table_info | Métadonnées d'une table | database_id, table_name | | validate_integrity | Validation d'intégrité | database_id, checks? | | health_check | Diagnostic de connexion | database_id | | get_performance_metrics | Métriques de performance | (aucun) | | list_databases | Bases de données connectées | (aucun) | | disconnect_database | Fermeture de connexion | database_id |

🏗 Architecture et Performance

Stack Technologique

graph TB
    A[Claude Code] --> B[MCP Protocol]
    B --> C[TypeScript Wrapper]
    C --> D[WASM Bridge]
    D --> E[Rust Core]
    E --> F[Database Drivers]
    F --> G[(Database)]
    
    E --> H[BB8 Pool]
    E --> I[Tokio Runtime]
    E --> J[Serde JSON]

Benchmarks de Performance

| Opération | Temps Moyen | Throughput | |-----------|-------------|------------| | Connexion SQLite | < 10ms | 100+ conn/s | | Requête Simple | < 5ms | 1000+ req/s | | Requête Complexe | < 50ms | 200+ req/s | | Validation Intégrité | < 20ms | 500+ check/s |

🛡 Sécurité

Fonctionnalités de Sécurité

  • Validation Paramètres : Tous les paramètres sont validés et typés
  • SQL Injection Protection : Requêtes préparées obligatoires
  • Sandboxing WASM : Isolation complète du moteur de base
  • Limites de Ressources : Protection contre les requêtes abusives
  • Audit Logging : Traçabilité complète des opérations

Configuration Sécurisée

{
  "security": {
    "max_query_size": 1048576,
    "max_results_size": 10485760,
    "max_connections_per_database": 50,
    "query_timeout_seconds": 30,
    "allowed_operations": ["SELECT", "INSERT", "UPDATE", "DELETE"],
    "forbidden_patterns": ["DROP", "TRUNCATE", "ALTER"],
    "require_ssl": true,
    "audit_level": "full"
  }
}

📋 Exemples Pratiques

Exemple Complet avec Claude Code

// 1. Configuration MCP
const mcpConfig = {
  "servers": {
    "bishop-database": {
      "command": "npx",
      "args": ["bishop-database-mcp", "start"],
      "env": { "LOG_LEVEL": "info" }
    }
  }
};

// 2. Connexion à la base
await mcp.callTool("connect_database", {
  config: {
    id: "analytics-db",
    name: "Analytics Database",
    db_type: "postgresql",
    connection: {
      host: "analytics.company.com",
      port: 5432,
      database: "analytics",
      username: "analyst",
      password: process.env.DB_PASSWORD,
      ssl: true
    }
  }
});

// 3. Analyse de données
const results = await mcp.callTool("execute_query", {
  database_id: "analytics-db",
  query: `
    SELECT 
      date_trunc('day', created_at) as date,
      COUNT(*) as daily_users,
      AVG(session_duration) as avg_session
    FROM user_sessions 
    WHERE created_at >= $1 
    GROUP BY date_trunc('day', created_at)
    ORDER BY date DESC
  `,
  parameters: [
    {
      name: "since",
      value: "2024-01-01",
      param_type: "Date"
    }
  ]
});

Migration de Données

{
  "tool": "execute_query",
  "database_id": "main-db",
  "query": "INSERT INTO users_new (id, name, email, migrated_at) SELECT id, name, email, NOW() FROM users_old WHERE active = $1",
  "parameters": [
    {"name": "active", "value": true, "param_type": "Boolean"}
  ]
}

🔍 Debugging et Troubleshooting

Activation du Mode Debug

# Via ligne de commande
bishop-database-mcp start --log-level debug --verbose

# Via variables d'environnement
DEBUG=bishop:* LOG_LEVEL=debug bishop-database-mcp start

Diagnostic WASM

# Test du module WASM
bishop-database-mcp test-wasm

# Informations système
bishop-database-mcp info

# Validation de configuration
bishop-database-mcp validate-config --config ./my-config.json

Logs Structurés

{
  "timestamp": "2024-01-15T10:30:45.123Z",
  "level": "info",
  "component": "database_pool",
  "database_id": "main-db",
  "message": "Connection established",
  "metrics": {
    "active_connections": 5,
    "idle_connections": 2,
    "connection_time_ms": 45
  }
}

🧪 Tests et Validation

Tests d'Intégration

# Exécution des tests complets
npm test

# Tests spécifiques
npm run test:integration
npm run test:wasm
npm run test:security

Validation Tyrion (QA)

Le package inclut une suite de tests Tyrion pour validation complète :

# Validation complète Tyrion
npm run tyrion:validate

# Tests de performance
npm run tyrion:performance

# Audit de sécurité
npm run tyrion:security

🚀 Déploiement en Production

Build Optimisé

# Build de production
npm run build

# Build avec optimisations WASM
RUSTFLAGS="-C opt-level=3" npm run build:wasm

# Package pour distribution
npm run deploy:npm

Docker Production

FROM node:18-alpine
RUN apk add --no-cache rust cargo wasm-pack
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["node", "dist/index.js"]

Monitoring Production

{
  "monitoring": {
    "health_check_interval": 30,
    "metrics_collection": true,
    "performance_tracking": true,
    "error_reporting": {
      "level": "error",
      "include_stack_trace": false,
      "max_error_rate": 0.01
    }
  }
}

📚 Documentation Avancée

🤝 Contribution

Standards de Développement

  • TDD Obligatoire : Tests avant implémentation
  • Rust Best Practices : Code safe et performant
  • Zero Approximation : Précision synthétique Bishop
  • Documentation Complète : Tous les APIs documentés

Setup Développement

# Clone du repository
git clone https://github.com/bishop/mcp-database-wasm.git
cd bishop-database-mcp

# Installation des dépendances
npm install

# Setup Rust/WASM
rustup target add wasm32-unknown-unknown
cargo install wasm-pack

# Build développement
npm run build

# Tests complets
npm test

📊 Roadmap

Version 2.0 (Q2 2024)

  • [ ] Support Redis/MemoryDB
  • [ ] GraphQL Query Interface
  • [ ] Real-time Subscriptions
  • [ ] Advanced Caching Layer
  • [ ] Multi-tenant Isolation

Version 3.0 (Q4 2024)

  • [ ] Distributed Queries
  • [ ] AI Query Optimization
  • [ ] Blockchain Integration
  • [ ] Quantum-safe Encryption

💬 Support et Communauté

📄 License

MIT License - voir LICENSE pour les détails.


"La base de données parfaite n'existe pas... jusqu'à maintenant."
— Bishop, Artificial Person & Database Excellence Specialist

Développé avec ❤️ par l'équipe HOUSE - Honesty, Orchestration, Uncompromising Standards, Engineering