| @@ -1,8 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace FluentCart\App\Modules\MCP; |
| 4 | 4 | |
| 5 | +use FluentCart\App\Modules\MCP\Support\CrmContact; | |
| 5 | 6 | use FluentCart\App\Modules\MCP\Support\PermissionGate; |
| 6 | 7 | use FluentCart\App\Modules\MCP\Tools\ContextTools; |
| 7 | 8 | |
| 8 | 9 | /** |
| @@ -71,8 +72,13 @@ | ||
| 71 | 72 | ] as $hook) { |
| 72 | 73 | add_action($hook, $invalidate); |
| 73 | 74 | } |
| 74 | 75 | |
| 76 | + // FluentCRM contact context on get-customer / get-order, mirroring the | |
| 77 | + // contact widget FluentCRM already renders on those admin screens. | |
| 78 | + // No-op unless FluentCRM is active. | |
| 79 | + CrmContact::register(); | |
| 80 | + | |
| 75 | 81 | // Warn the operator if they enabled MCP but no adapter is installed. |
| 76 | 82 | add_action('admin_notices', [$this, 'maybeShowAdapterNotice']); |
| 77 | 83 | } |
| 78 | 84 | |
| @@ -208,14 +214,14 @@ | ||
| 208 | 214 | add_filter('fluent_cart/module_setting/fields', function ($fields) { |
| 209 | 215 | if (!is_array($fields)) { |
| 210 | 216 | $fields = []; |
| 211 | 217 | } |
| 212 | -// $fields['mcp'] = [ | |
| 213 | -// 'title' => __('MCP for AI Agents', 'fluent-cart'), | |
| 214 | -// 'description' => __('Let AI assistants (Claude, Cursor, and other MCP clients) securely read your store and run operator tasks via the Model Context Protocol. Ships off; enable it and connect with an application password.', 'fluent-cart'), | |
| 215 | -// 'type' => 'component', | |
| 216 | -// 'component' => 'McpSettings', | |
| 217 | -// ]; | |
| 218 | + $fields['mcp'] = [ | |
| 219 | + 'title' => __('MCP for AI Agents', 'fluent-cart'), | |
| 220 | + 'description' => __('Let AI assistants (Claude, Cursor, and other MCP clients) securely read your store and run operator tasks via the Model Context Protocol. Ships off; enable it and connect with an application password.', 'fluent-cart'), | |
| 221 | + 'type' => 'component', | |
| 222 | + 'component' => 'McpSettings', | |
| 223 | + ]; | |
| 218 | 224 | return $fields; |
| 219 | 225 | }, 100); |
| 220 | 226 | |
| 221 | 227 | // Default the `mcp.active` flag to off so the shared modules blob always |
| @@ -277,7 +283,9 @@ | ||
| 277 | 283 | } |
| 278 | 284 | |
| 279 | 285 | echo '<div class="notice notice-warning"><p>'; |
| 280 | 286 | echo esc_html__('FluentCart MCP is enabled but no MCP adapter was found. Install FluentHub (recommended) or the MCP Adapter plugin, on WordPress 6.9+.', 'fluent-cart'); |
| 281 | - echo '</p></div>'; | |
| 287 | + echo '</p><p><a class="button button-secondary" href="' . esc_url(admin_url('admin.php?page=fluent-cart#/settings/addons')) . '">'; | |
| 288 | + echo esc_html__('Disable MCP', 'fluent-cart'); | |
| 289 | + echo '</a></p></div>'; | |
| 282 | 290 | } |
| 283 | 291 | } |