api_plugins
Lightweight foundation for building API integrations in Drupal.
Core Philosophy
Don’t create a separate service for every third-party API. Define an API plugin with endpoint-specific configuration and use a single shared service for request execution, authentication, and error handling.
This module provides only the essentials for API integration:
- Plugin discovery and management
- HTTP request handling
- Authentication management
- Base classes for building custom API plugins
No UI. No forms. No fields. Just clean, reusable services for developers.
Installation
composer require drupal/api_plugins drush en api_plugins
Basic Usage
Enable an integration module, for example:
drush en api_plugins_openaiCall an API endpoint via PHP:
$api_service = \Drupal::service('api_plugins.request'); // Call an API plugin $result = $api_service->sendRequest('openai_chat_completions', [ 'prompt' => 'What is the capital city of Czechia?', 'model' => 'gpt-4o-mini', 'temperature' => 0.0, ]); print_r($result);
Apify MCP Server Examples
The Apify MCP Server plugin provides access to major Apify tool categories:
- actors – Actor discovery and management tools
- docs – Documentation search tools
- runs – Actor run information tools
- storage – Dataset and key-value store tools
- specific actors – e.g.
apify/rag-web-browser,compass/crawler-google-places
List Available Tools
Enable the MCP plugin:
drush en api_plugins_mcpProgrammatically list tools:
$plugin_manager = \Drupal::service('plugin.manager.api_endpoint'); $plugin = $plugin_manager->createInstance('apify_mcp_server'); $response = $plugin->sendRequest([ 'method' => 'tools/list', 'id' => 1, ]); print_r($response);
Summary
API Plugins is designed for developers who want consistent, maintainable integrations with third-party APIs — without reinventing the wheel for every integration. Use it as a foundation for modules like api_plugins_openai, api_plugins_mcp, or your own custom API connectors.