drupal_fastmcp

abderrahimghazali/drupal_fastmcp

3.2

If you are the rightful owner of drupal_fastmcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

Drupal FastMCP is an AI-powered server designed to enhance Drupal 10 development by generating clean, standards-compliant code.

Tools
  1. generate_drupal_module

    Generate complete Drupal 10 modules

  2. generate_drupal_entity

    Create custom content entities

  3. generate_drupal_service

    Build services with DI and SOLID principles

  4. generate_drupal_form

    Generate secure forms with Form API

  5. generate_drupal_plugin

    Create plugins (Block, Field, REST, etc.)

Drupal FastMCP - AI-Powered Drupal Development Server

A powerful MCP (Model Context Protocol) server built with FastMCP that provides AI-powered tools for Drupal 10 development. This server helps developers generate clean, standards-compliant Drupal code following best practices and modern PHP patterns.

Features

šŸš€ AI-Powered Code Generation

  • Generate complete Drupal 10 modules with proper structure
  • Create custom entities following content entity patterns
  • Build services with dependency injection and SOLID principles
  • Generate secure forms with validation and CSRF protection
  • Create plugins with proper annotations and architecture

šŸ” Code Analysis & Best Practices

  • Analyze existing Drupal code for compliance with standards
  • Get comprehensive best practices guides for different topics
  • Security, performance, and architecture recommendations
  • Drupal 10 coding standards enforcement

Available Tools

Code Generation Tools

  • generate_drupal_module - Generate complete Drupal 10 modules
  • generate_drupal_entity - Create custom content entities
  • generate_drupal_service - Build services with DI and SOLID principles
  • generate_drupal_form - Generate secure forms with Form API
  • generate_drupal_plugin - Create plugins (Block, Field, REST, etc.)

Analysis & Guidance Tools

  • analyze_drupal_code - Analyze code for compliance and best practices
  • drupal_best_practices_guide - Get comprehensive development guides

Drupal 10 Standards Compliance

āœ… PHP 8.1+ Features - Modern PHP with strict typing
āœ… SOLID Principles - Clean, maintainable object-oriented design
āœ… PSR-12 Standards - Consistent code formatting
āœ… Security Best Practices - Input validation, XSS prevention, CSRF protection
āœ… Performance Optimization - Caching strategies and efficient queries
āœ… Dependency Injection - Proper service container usage
āœ… Complete Documentation - PHPDoc blocks for all code

Installation

  1. Clone the repository:
git clone https://github.com/abderrahimghazali/drupal_fastmcp.git
cd drupal_fastmcp
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the server:
python main.py

Usage

The server runs as an MCP server using stdio transport, making it compatible with MCP clients and AI assistants that support the Model Context Protocol.

Example Tool Usage

Generate a Drupal Module:

# This would be called by an MCP client
generate_drupal_module(
    module_name="my_custom_module",
    description="A custom module for specific functionality",
    requirements="User management and API integration"
)

Create a Custom Entity:

generate_drupal_entity(
    entity_type="content",
    entity_name="product",
    fields="title, description, price, category",
    features="revision support, translation ready"
)

Architecture

The server follows clean architecture principles:

  • FastMCP Integration - Built on the FastMCP framework for MCP servers
  • Tool-Based Architecture - Each functionality is exposed as a separate tool
  • Drupal Standards Enforcement - All generated code follows Drupal 10 best practices
  • Comprehensive Documentation - Built-in guidance and best practices

Requirements

  • Python 3.8+
  • FastMCP library
  • Knowledge of Drupal 10 development (for using generated code)

Generated Code Features

All generated code includes:

  • PHP 8.1+ strict typing (declare(strict_types=1);)
  • PSR-4 autoloading with proper namespaces
  • Dependency injection via service container
  • Complete PHPDoc documentation
  • Security best practices (input validation, CSRF protection)
  • Performance optimization with caching
  • SOLID principles adherence
  • Drupal coding standards compliance

Contributing

Contributions are welcome! Please ensure any new tools or features maintain the high standards of code quality and Drupal best practices that this project enforces.

License

This project is open source and available under the MIT License.


Built for Drupal 10 developers who value clean, secure, and maintainable code. šŸš€