WebMCP Tools Integration for Syncfusion® React Gantt Chart
WebMCP allows AI assistants running in the browser to interact directly with Syncfusion® React Gantt Chart components through natural language prompts.
Instead of relying on DOM inspection or simulating user interactions, AI assistants can interact directly with component APIs through WebMCP tools. This approach provides more reliable and accurate results.
Once connected, an AI assistant can perform tasks such as:
- Manage project tasks and task updates.
- Schedule and reschedule work across the project timeline.
- Manage task dependencies and hierarchy.
- Search, filter, sort, and navigate the project timeline.
- Expand and collapse records.
- Export project data and review undo and redo history.
The React Gantt Chart component provides WebMCP tools that enable AI agents to manage tasks, schedule projects, handle dependencies and hierarchies, navigate timelines, perform search, filtering, and sorting operations, export project data, and execute undo and redo actions.
WebMCP is currently an experimental browser capability and requires a Chromium-based browser with WebMCP support enabled. Availability and required browser flags may change as the specification evolves.
Prerequisites
- Syncfusion® React Gantt Chart component
- Chromium-based Browser (like Chrome, Edge, or Brave)
- Node.js 24+ (LTS recommended).
- WebMCP browser extension installed
- AI API key configured in the extension
WebMCP setup
Before you can use WebMCP locally, enable the feature flag and install the browser extension:
- Enable
WebMCP for testingflag viachrome://flags/. Click “Relaunch” to restart Chrome. - Search for “WebMCP - Model Context Tool Inspector” in Chrome Web Store. Click “Add to Chrome”.
- Visit Google AI Studio to create or copy an API key. Open the WebMCP extension → paste your API key.
The WebMCP extension is now configured and ready to interact with WebMCP-enabled Syncfusion® React Gantt Chart component.
Integrating WebMCP tools
Follow these steps to integrate WebMCP support into Syncfusion® React Gantt Chart component.
Step 1: Create an application
Create an React application and integrate the Syncfusion® React Gantt Chart component by following the Getting Started with React Gantt Chart guide. After completing the setup, follow the steps below to enable WebMCP integration.
Step 2: Enable WebMCP support
Import the WebMcpGantt module and inject it into the component to make WebMCP functionality available.
import { GanttComponent, ColumnsDirective, ColumnDirective, Inject, Edit, Toolbar, Selection, Filter, Sort, WebMcpGantt } from '@syncfusion/ej2-react-gantt';
const dataSource = [
{ TaskID: 1, TaskName: 'Project Planning', StartDate: new Date('2025-01-06'), Duration: 5, Progress: 70, ChildTasks: [
{ TaskID: 2, TaskName: 'Requirement Analysis', StartDate: new Date('2025-01-06'), Duration: 3, Progress: 100 },
{ TaskID: 3, TaskName: 'Design phase', StartDate: new Date('2025-01-09'), Duration: 4, Progress: 60, Dependency: '2', ChildTasks: [
{ TaskID: 4, TaskName: 'UI Review', StartDate: new Date('2025-01-10'), Duration: 3, Progress: 20, Dependency: '3' }
]}
]}
];
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Dependency',
child: 'ChildTasks'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
export default function App() {
return (
<GanttComponent
id='gantt'
dataSource={dataSource}
taskFields={taskFields}
editSettings={editSettings}
toolbar={toolbar}
allowSorting={true}
allowFiltering={true}
enableWebMcp={true}
height="450px"
>
<Inject services={[WebMcpGantt, Selection, Sort, Filter, Toolbar, Edit]} />
</GanttComponent>
);
}Step 3: Register component tools
Set the enableWebMcp property to true and configure the webMcpSettings property to register the component’s available tools with the WebMCP runtime.
When enableWebMcp is enabled, supported component tools are automatically registered with the WebMCP runtime and become discoverable by authorized WebMCP clients.
For example, a component may expose tools such as:
-
createTask– Creates one or more project tasks. -
updateTask– Updates task information such as dates, duration, or progress. -
getProjectTasks– Retrieves the current project task collection.
An AI assistant can discover these tools and invoke them based on user prompts.
import { GanttComponent, Inject, Edit, Toolbar, Selection, Filter, Sort, WebMcpGantt } from '@syncfusion/ej2-react-gantt';
const dataSource = [
{ TaskID: 1, TaskName: 'Project Planning', StartDate: new Date('2025-01-06'), Duration: 5, Progress: 70, ChildTasks: [
{ TaskID: 2, TaskName: 'Requirement Analysis', StartDate: new Date('2025-01-06'), Duration: 3, Progress: 100 },
{ TaskID: 3, TaskName: 'Design phase', StartDate: new Date('2025-01-09'), Duration: 4, Progress: 60, Dependency: '2', ChildTasks: [
{ TaskID: 4, TaskName: 'UI Review', StartDate: new Date('2025-01-10'), Duration: 3, Progress: 20, Dependency: '3' }
]}
]}
];
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Dependency',
child: 'ChildTasks'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
const webMcpSettings = {
tools: []
};
export default function App() {
return (
<GanttComponent
id='gantt'
dataSource={dataSource}
taskFields={taskFields}
editSettings={editSettings}
toolbar={toolbar}
allowSorting={true}
allowFiltering={true}
enableWebMcp={true}
webMcpSettings={webMcpSettings}
height="450px"
>
<Inject services={[WebMcpGantt, Selection, Sort, Filter, Toolbar, Edit]} />
</GanttComponent>
);
}Step 4: Customize tool registration
Use the webMcpSettings property to customize how WebMCP tools are exposed to AI agents. The available settings are listed below.
| Property | Description |
|---|---|
name |
Prefix applied to registered tool names. If name: gantt is specified, a tool such as createTask may be registered as gantt_createTask, allowing multiple component instances to coexist without tool name conflicts. |
tools |
List of tool names to expose. Any supported tools not included in this list will not be registered. |
exposedTo |
List of trusted domains that are allowed to interact with the component through WebMCP. |
import { GanttComponent, Inject, Edit, Toolbar, Selection, Filter, Sort, WebMcpGantt } from '@syncfusion/ej2-react-gantt';
const dataSource = [
{ TaskID: 1, TaskName: 'Project Planning', StartDate: new Date('2025-01-06'), Duration: 5, Progress: 70, ChildTasks: [
{ TaskID: 2, TaskName: 'Requirement Analysis', StartDate: new Date('2025-01-06'), Duration: 3, Progress: 100 },
{ TaskID: 3, TaskName: 'Design phase', StartDate: new Date('2025-01-09'), Duration: 4, Progress: 60, Dependency: '2', ChildTasks: [
{ TaskID: 4, TaskName: 'UI Review', StartDate: new Date('2025-01-10'), Duration: 3, Progress: 20, Dependency: '3' }
]}
]}
];
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Dependency',
child: 'ChildTasks'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
const webMcpSettings = {
name: 'gantt',
tools: ['createTask','deleteTask','updateTask','getProjectTasks'],
exposedTo: ['https://www.syncfusion.com/']
};
export default function App() {
const beforeWebMcpToolExecute = (args) => {
if (args.toolName === 'gantt_updateTask') {
const hour = new Date().getHours();
if (hour < 9 || hour > 17) {
args.cancel = true;
console.log('Task updates are allowed only between 9:00 AM and 5:00 PM.');
}
}
};
return (
<GanttComponent
id='gantt'
dataSource={dataSource}
taskFields={taskFields}
editSettings={editSettings}
toolbar={toolbar}
enableWebMcp={true}
allowSorting={true}
allowFiltering={true}
webMcpSettings={webMcpSettings}
beforeWebMcpToolExecute={beforeWebMcpToolExecute}
height="450px"
>
<Inject services={[WebMcpGantt, Selection, Sort, Filter, Toolbar, Edit]} />
</GanttComponent>
);
}Use the
exposedToproperty to restrict WebMCP access to trusted domains. This helps prevent unauthorized WebMCP clients from interacting with your component tools.
Step 5: Monitor and control tool execution
The beforeWebMcpToolExecute event is triggered before a tool is executed. This event allows you to:
- Audit tool usage.
- Validate incoming requests.
- Cancel tool execution when necessary.
- Apply custom business rules and security policies.
AI-generated requests should always be validated before executing write operations. Restrict access using
exposedToand perform additional authorization checks withinbeforeWebMcpToolExecutewhen modifying application data.
import { GanttComponent, Inject, Edit, Toolbar, Selection, Filter, Sort, PdfExport, WebMcpGantt } from '@syncfusion/ej2-react-gantt';
import './App.css'
const dataSource = [
{ TaskID: 1, TaskName: 'Project Planning', StartDate: new Date('2025-01-06'), Duration: 5, Progress: 70, ChildTasks: [
{ TaskID: 2, TaskName: 'Requirement Analysis', StartDate: new Date('2025-01-06'), Duration: 3, Progress: 100 },
{ TaskID: 3, TaskName: 'Design phase', StartDate: new Date('2025-01-09'), Duration: 4, Progress: 60, Dependency: '2', ChildTasks: [
{ TaskID: 4, TaskName: 'UI Review', StartDate: new Date('2025-01-10'), Duration: 3, Progress: 20, Dependency: '3' }
]}
]}
];
const taskFields = {
id: 'TaskID',
name: 'TaskName',
startDate: 'StartDate',
duration: 'Duration',
progress: 'Progress',
dependency: 'Dependency',
child: 'ChildTasks'
};
const editSettings = {
allowAdding: true,
allowEditing: true,
allowDeleting: true,
allowTaskbarEditing: true,
showDeleteConfirmDialog: true
};
const toolbar = ['Add', 'Edit', 'Delete', 'Update', 'Cancel'];
const webMcpSettings = {
name: 'gantt',
tools: ['createTask', 'deleteTask', 'updateTask', 'getProjectTasks'],
exposedTo: ['https://www.syncfusion.com/']
};
export default function App() {
const beforeWebMcpToolExecute = (args) => {
if (args.toolName === 'gantt_updateTask') {
const hour = new Date().getHours();
if (hour < 9 || hour > 17) {
args.cancel = true;
console.log('Task updates are allowed only between 9:00 AM and 5:00 PM.');
}
}
};
return (
<GanttComponent
id='gantt'
dataSource={dataSource}
taskFields={taskFields}
editSettings={editSettings}
toolbar={toolbar}
allowSorting={true}
allowFiltering={true}
enableWebMcp={true}
webMcpSettings={webMcpSettings}
beforeWebMcpToolExecute={beforeWebMcpToolExecute}
height="450px"
>
<Inject services={[WebMcpGantt,Selection,Sort,Filter,Toolbar,Edit,PdfExport]}/>
</GanttComponent>
);
}Best practices
- Expose only the tools required by your application.
- Use the
nameproperty when multiple component instances exist on the same page. - Configure
exposedToto limit access to trusted domains. - Monitor tool activity through the
beforeWebMcpToolExecuteevent. - Apply application-specific validation before executing tool operations.
Explore the demo
Explore the Syncfusion® React Gantt Chart component with WebMCP integration through this demo.