MCP and AI Integration

Overview

"BWEB is no longer just a building tool. It is the framework that AI uses to build web applications."

AI integration relies on 3 entry points:

Entry PointRoleDescription
CLAUDE.mdRules and conventionsProject instructions loaded at startup. Conventions, style, patterns.
MCP ServerSpecialized toolsClaude can search documentation, retrieve patterns, convert HTML.
Claude APIDirect actionsHTTP entry point for reading/writing in the 4D database via curl.

Available MCP Tools

ToolDescription
get_4d_contextComplete context (instructions, rules, index)
search_4d_documentationSearch BWEB documentation by keyword
get_4d_patternRetrieve a pattern (formcontroller, orda, listbox...)
read_4d_fileRead a specific documentation file
search_4d_officialSearch on developer.4d.com
convert_html_to_bwebConvert HTML/Tailwind to .bspkExp file
update_4d_documentationUpdate a documentation file

Claude API (/_claude/)

HTTP entry point integrated into the BSPK component. Claude calls 4D directly via curl.

RouteDescription
GET /_claude/pingAvailability test
POST /_claude/execExecute a 4D method
GET /_claude/data/TABLE/queryORDA query with pagination
POST /_claude/data/TABLE/createCreate an entity
POST /_claude/data/TABLE/updateModify an entity
POST /_claude/data/TABLE/deleteDelete an entity

Security: Access authorized on localhost or with a temporary token. Write access protected by a table whitelist (claude-api-write-tables.json).

Complete AI Workflow

  1. Prompt - Describe what you need in natural language
  2. Claude - Reads the documentation (MCP), queries the database (API)
  3. Generation - Creates .bspkExp files, .4dm methods, CSS
  4. Dev Panel - Import, adjustment and deployment

Prompt Examples

  • "Create a landing page for a restaurant with hero, menu grid and reservation form"
  • "Add a listbox connected to the SUPPLIER DataClass with sorting and pagination"
  • "Generate an editing form for the POST entity with validation"
"AI builds, humans maintain and refine."