# file-manager-webmcp

> File manager with WebMCP enabled, registering its file operations as tools and handling tool calls.

**Framework:** react  **Component:** FileManager  **Variant:** webmcp

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/react/ts/file-manager-webmcp.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-react-filemanager
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/file-manager-webmcp/FileManager.tsx

```tsx
import { FileManagerComponent, Inject, NavigationPane, DetailsView, Toolbar, WebMcpFileManager } from '@syncfusion/ej2-react-filemanager';

/**
 * File Manager WebMCP tools integration sample
 */
const WebMcp = () => {
  let hostUrl = "https://physical-service.syncfusion.com/";
  const ajaxSettings = {
    downloadUrl: hostUrl + 'api/FileManager/Download',
    getImageUrl: hostUrl + 'api/FileManager/GetImage',
    uploadUrl: hostUrl + 'api/FileManager/Upload',
    url: hostUrl + 'api/FileManager/FileOperations'
  };

  const beforeWebMcpToolExecute = (args: any) => {
    // Example business rule
    if (args.toolName.includes('manageFileSystemItems')) {
      const hour = new Date().getHours();
      if (hour < 9 || hour > 17) {
        args.cancel = true;
        console.log('File system operations are allowed only between 9:00 AM and 5:00 PM.');
      }
    }
  };

  return (
    <div>
      <div className="control-section">
        <FileManagerComponent id="filemanager" ajaxSettings={ajaxSettings} enableWebMcp={true}
          webMcpSettings={{
            name: 'explorer',
            tools: ['getSelectedFiles', 'manageFileSystemItems', 'manageFileUploadAndDownload'],
            exposedTo: ['https://www.syncfusion.com/']
          }}
          beforeWebMcpToolExecute={beforeWebMcpToolExecute}>
          <Inject services={[NavigationPane, DetailsView, Toolbar, WebMcpFileManager]} />
        </FileManagerComponent>
      </div>
    </div>
  );
}
export default WebMcp;

```
