This document provides an overview of the Convoworks GPT project, a WordPress plugin that extends the Convoworks WP plugin with GPT/AI-powered workflow components.
Convoworks GPT is a WordPress plugin that extends Convoworks WP with AI-powered components for integrating OpenAI's GPT models, embeddings, moderation API, and MCP (Model Context Protocol) server capabilities into workflow automation.
- GPT Chat Completion – Components for OpenAI Chat Completion API with function calling support
- Embeddings & Moderation – Vector embeddings and content moderation API wrappers
- MCP Server Platform – Full Model Context Protocol server implementation with Streamable HTTP
- WordPress REST API Integration – Exposes WP REST API as MCP tools/functions
- Service Templates – Ready-to-use templates for chat apps, site admin assistants, research bots, and MCP servers
- Backend: PHP 7.2+, WordPress 5.3+
- Dependencies: Minimal (no heavy PHP libraries, just autoloader)
- Build Tools: Composer, npm (for packaging)
- Extends: Convoworks WP (required)
The plugin has a simple build process:
npm install # Install packaging dependencies
npm run build # Creates distributable zip in build/Unlike Convoworks WP, this plugin has:
- No frontend JavaScript bundles (no Webpack, no AngularJS UI)
- Simple Composer autoload (no complex scoping needed currently)
- Straightforward packaging – just copies source files and runs
composer install --no-dev
Main namespace: Convo\Gpt (src/Convo/Gpt/)
Key areas:
GptPlugin.php– Main plugin registration and initializationGptApiFactory.php,GptApi.php– OpenAI API client wrapperPluginContext.php– Plugin context and configuration helpersUtil.php– Utility functions (token estimation, message serialization, etc.)- Exception classes:
ContextLengthExceededException,RefuseFunctionCallException
GptPackageDefinition.php– Package descriptor registering all GPT componentsGptPackageDefinition.json– JSON metadata for the package- Component classes:
ChatCompletionElement.php,ChatCompletionV2Element.php– GPT API wrapper elementsChatFunctionElement.php,ExternalChatFunctionElement.php– Function calling supportConversationMessagesElement.php– Conversation state managementSystemMessageElement.php,SystemMessageGroupElement.php– System promptsMessagesLimiterElement.php,SimpleMessagesLimiterElement.php– Context length managementEmbeddingsElement.php,ModerationApiElement.php– Other OpenAI API wrappersWpRestProxyFunction.php– WordPress REST API as GPT functionSimpleMcpPromptTemplate.php– MCP prompt templatesMcpServerProcessor.php– MCP server processor
Help/folder – Markdown/HTML help files for each component*.template.json– Service templates (GPT Example Chat, Site Admin, Deep Research, MCP Server Example)
McpServerPlatform.php– MCP platform adapter (implementsIRestPlatform)McpServerPublisher.php– Release manager for MCP servicesStreamableRestHandler.php– Streamable HTTP handler for MCP protocolStreamHandler.php,StreamWriter.php,SseResponse.php– SSE streaming supportMcpSessionManager.php,McpSessionManagerFactory.php– Session managementIMcpSessionStoreInterface.php,McpFilesystemSessionStore.php– Session storageCommandDispatcher.php– Routes MCP commands to service processorsMcpServerCommandRequest.php– MCP command request wrapper
AbstractRestFunctions.php– Base class for REST API function groupsPostRestFunctions.php,PagesRestFunctions.php– Post/page management toolsCommentRestFunctions.php,UserRestFunctions.php– Comment/user toolsMediaRestFunctions.php– Media library toolsTaxonomyRestFunctions.php– Taxonomy/term toolsSettingsRestFunctions.php– WordPress settings toolsPluginRestFunctions.php– Plugin management tools
SettingsProcessor.php,SettingsView.php,SettingsViewModel.php– Settings page (minimal, mostly for MCP config)McpConvoworksManager.php– Helper for accessing Convoworks services from MCP context
The plugin includes several ready-to-use service templates in src/Convo/Gpt/Pckg/:
- gpt-example-chat.template.json – Simple RAG chat for small business sites
- gpt-site-admin.template.json – AI site administrator with WordPress API access
- deep-research-assistant.template.json – Recursive web research and report generation
- mcp-server-example.template.json – MCP server with multiple example patterns
- mcp-server-project.template.json – Basic MCP server project starter
Convoworks GPT is not standalone – it requires Convoworks WP to be installed and activated.
Integration points:
-
Plugin Registration (
GptPlugin::register())- Checks for Convoworks WP presence via
defined('CONVO_WP_VERSION') - Registers the GPT package with Convoworks framework
- Checks for Convoworks WP presence via
-
Package Registration
GptPackageDefinitionis registered with Convoworks'PackageProviderFactory- All GPT components become available in the Convoworks editor
-
Platform Registration (MCP Server)
McpServerPlatformis registered as a new platform type- Appears in service configuration alongside Alexa, Viber, Convo Chat, etc.
-
REST API Integration
- MCP endpoints are exposed through Convoworks' public REST API
- WordPress REST API tools are registered via filters (
convo_mcp_register_wp_posts, etc.)
Defined in convoworks-gpt.php, can be overridden in wp-config.php:
// MCP session storage path (filesystem-based currently)
CONVO_GPT_MCP_SESSION_STORAGE_PATH
// MCP session timeout in seconds (default: 30 days)
CONVO_GPT_MCP_SESSION_TIMEOUT
// Background poll interval in microseconds (default: 300ms)
CONVO_GPT_MCP_LISTEN_USLEEP
// Ping interval in seconds (default: 10s)
CONVO_GPT_MCP_PING_INTERVAL-
PHP component changes
- Edit files in
src/Convo/Gpt/ - No build step needed for local development
- Just refresh WordPress admin to see changes
- Edit files in
-
Help file updates
- Edit Markdown files in
src/Convo/Gpt/Pckg/Help/ - Changes appear immediately in component help sidebar
- Edit Markdown files in
-
Service template updates
- Edit
*.template.jsonfiles insrc/Convo/Gpt/Pckg/ - Templates are re-read when creating new services
- Edit
-
Version bumps
- Update
versioninpackage.json - Run
npm run sync-versionto propagate tocomposer.jsonandconvoworks-gpt.php - Update
CHANGELOG.md
- Update
npm run build # Creates build/convoworks-gpt-vX.Y.Z.zipThis will:
- Read version from
package.json - Copy required files to
dist/temp/convoworks-gpt-vX.Y.Z/ - Run
composer install --no-devin the temp directory - Create a zip archive in
build/ - Clean up temp directory
The resulting zip is ready to upload to WordPress.
- Install Convoworks WP in a local WordPress site
- Clone/symlink this plugin to
wp-content/plugins/convoworks-gpt/ - Run
composer installin the plugin directory - Activate both plugins in WordPress admin
- Create a new Convoworks service using one of the GPT templates
- Test in the Convoworks Test view
Basic tests are in tests/:
ProcessJsonWithConstantsTest.php– JSON processing with constantsSummarizeMessagesTest.php– Message summarization logicTruncateToSizeTest.php– Token-based truncation
Run with:
composer install --dev
vendor/bin/phpunit- Create the component class in
src/Convo/Gpt/Pckg/ - Add component definition in
GptPackageDefinition::_initDefintions() - Create help file in
src/Convo/Gpt/Pckg/Help/(Markdown preferred) - Test in Convoworks editor
- Create new class extending
AbstractRestFunctionsinsrc/Convo/Gpt/Tools/ - Define tool definitions in
getToolDefinitions()method - Implement
execute()method to handle tool calls - Register filter in
GptPlugin::register()for activation
- Edit the
*.template.jsonfile insrc/Convo/Gpt/Pckg/ - Templates are JSON service definitions – edit carefully
- Test by creating a new service from the updated template
- Ensure Convoworks WP is installed and activated first
- Check that
CONVO_WP_VERSIONconstant is defined (should be set by Convoworks WP)
- Check
CONVO_GPT_MCP_SESSION_STORAGE_PATHis writable - Increase
CONVO_GPT_MCP_SESSION_TIMEOUTif sessions expire too quickly - Check PHP error logs for session storage issues
- Verify
GPT_API_KEYis set in service variables - Check
Base URLif using alternative API endpoints - Monitor context length – use message limiters to prevent token overflow
- Run
npm installto ensure packaging dependencies are present - Check that
composer.jsonis valid before building - Ensure version sync has run (
npm run sync-version)
- GitHub Repository: https://github.com/zef-dev/convoworks-gpt
- Convoworks WP: https://wordpress.org/plugins/convoworks-wp/
- Convoworks Website: https://convoworks.com
- OpenAI API Docs: https://platform.openai.com/docs/api-reference
- MCP Specification: https://spec.modelcontextprotocol.io/
For more details on the Convoworks framework itself, see the Convoworks WP documentation.