# Working Methodology ## VPS Access Pattern All work goes through the `asktam-mcp` connector tools. The container is `mainwp`. ``` vps_write_file → /tmp/script.php vps_run_command → docker cp /tmp/script.php mainwp:/tmp/script.php vps_run_command → docker exec mainwp php -l /tmp/script.php (syntax check first) vps_run_command → docker exec mainwp php /tmp/script.php (execute) ``` For plugin file deployment: ``` docker cp /tmp/MyFile.php mainwp:/var/www/html/wp-content/plugins/advanced-mcp-plugin/includes/Tools/MyFile.php ``` ## PHP CLI Script Header — Always Required Every PHP script that boots WordPress must start with exactly this: ```php getHandler('tool_name'), [ 'arg1' => 'value1', 'arg2' => 'value2', ]); ``` ## Building Elementor Pages — Full Pattern ```php define('WP_ADMIN', true); define('DOING_CRON', true); // ← mandatory require '/var/www/html/wp-load.php'; $reg = new \AskTamMCP\MCP\Registry(); // 1. Create page as draft — no template yet $pid = wp_insert_post([ 'post_title' => 'My Page', 'post_status' => 'draft', 'post_type' => 'page', 'meta_input' => ['_elementor_edit_mode' => 'builder'], ]); // 2. Add sections via Elementor tools $hero = call_user_func($reg->getHandler('elementor_add_container'), [ 'post_id' => $pid, 'settings' => ['background_color' => '#1e293b', 'min_height' => ['size'=>100,'unit'=>'vh']], ]); $hid = $hero['element_id']; call_user_func($reg->getHandler('elementor_add_heading'), [ 'post_id' => $pid, 'container_id' => $hid, 'title' => 'Your Headline', 'tag' => 'h1', 'settings' => ['title_color' => '#ffffff'], ]); // 3. Publish — NO page_template in wp_update_post wp_update_post(['ID' => $pid, 'post_status' => 'publish']); // 4. Set template via meta AFTER publish update_post_meta($pid, '_wp_page_template', 'elementor-full-width'); // 5. Regenerate Elementor CSS if (class_exists('\Elementor\Core\Files\CSS\Post')) { (new \Elementor\Core\Files\CSS\Post($pid))->update(); } ``` ## Gitea Commits Use `gitea_create_or_update_file` MCP tool. The `content` parameter is the new file content written directly — not a path, not a file read. Write the content inline. ``` gitea_create_or_update_file: repo_name: advanced-mcp-plugin file_path: includes/Tools/MyTools.php content: "