# file-manager-webmcp

> File manager with WebMCP enabled, registering its file operations as tools and handling tool calls.

**Framework:** javascript  **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/javascript/file-manager-webmcp.json
```

**Install Package(s)**

```bash
npm install @syncfusion/ej2-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/file-manager.html

```html
<div class="control-section">
    <div class="sample-container">
        <!-- Initialize FileManager -->
        <div id="container"></div>
    </div>
</div>

```

### src/components/file-manager-webmcp/file-manager.ts

```typescript
import { FileManager, Toolbar, NavigationPane, DetailsView, WebMcpFileManager } from '@syncfusion/ej2-filemanager';

FileManager.Inject(Toolbar, NavigationPane, DetailsView, WebMcpFileManager);

/**
 * File Manager WebMCP tools integration sample
 */
export function initFileManagerWebMcp(): void {
    let hostUrl: string = 'https://physical-service.syncfusion.com/';
    let filemanagerInstance: FileManager = new FileManager({
        enableWebMcp: true,
        webMcpSettings: {
            name: 'explorer',
            tools: ['getSelectedFiles', 'manageFileSystemItems', 'manageFileUploadAndDownload'],
            exposedTo: ['https://www.syncfusion.com/']
        },
        ajaxSettings: {
            downloadUrl: hostUrl + 'api/FileManager/Download',
            getImageUrl: hostUrl + 'api/FileManager/GetImage',
            uploadUrl: hostUrl + 'api/FileManager/Upload',
            url: hostUrl + 'api/FileManager/FileOperations'
        },
        beforeWebMcpToolExecute: (args: any) => {
            // Example business rule
            if (args.toolName.includes('manageFileSystemItems')) {
                const hour: number = 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.');
                }
            }
        }
    });
    filemanagerInstance.appendTo('#container');
}

```
