Skip to main content
Glama
portel-dev

NCP - Natural Context Provider

by portel-dev
filesystem-server.js4.87 kB
#!/usr/bin/env node /** * Mock Filesystem MCP Server * Real MCP server structure for file system operations testing */ import { MockMCPServer } from './base-mock-server.js'; const serverInfo = { name: 'filesystem-test', version: '1.0.0', description: 'Local file system operations including reading, writing, directory management, and permissions' }; const tools = [ { name: 'read_file', description: 'Read contents of files from local filesystem. Load configuration files, read text documents, access data files.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File path to read' }, encoding: { type: 'string', description: 'Text encoding (utf8, ascii, etc.)' } }, required: ['path'] } }, { name: 'write_file', description: 'Write content to files on local filesystem. Create configuration files, save data, generate reports.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File path to write to' }, content: { type: 'string', description: 'Content to write to file' }, encoding: { type: 'string', description: 'Text encoding (utf8, ascii, etc.)' }, create_dirs: { type: 'boolean', description: 'Create parent directories if they do not exist' } }, required: ['path', 'content'] } }, { name: 'create_directory', description: 'Create new directories and folder structures. Organize files, set up project structure, create folder hierarchies.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Directory path to create' }, recursive: { type: 'boolean', description: 'Create parent directories if needed' }, mode: { type: 'string', description: 'Directory permissions (octal notation)' } }, required: ['path'] } }, { name: 'list_directory', description: 'List files and directories with filtering and sorting options. Browse folders, find files, explore directory structure.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'Directory path to list' }, recursive: { type: 'boolean', description: 'Include subdirectories recursively' }, include_hidden: { type: 'boolean', description: 'Include hidden files and directories' }, pattern: { type: 'string', description: 'Glob pattern to filter files' } }, required: ['path'] } }, { name: 'delete_file', description: 'Delete files and directories from filesystem. Remove old files, clean up temporary data, delete folders.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File or directory path to delete' }, recursive: { type: 'boolean', description: 'Delete directories and contents recursively' }, force: { type: 'boolean', description: 'Force deletion without confirmation' } }, required: ['path'] } }, { name: 'copy_file', description: 'Copy files and directories to new locations. Backup files, duplicate data, organize content.', inputSchema: { type: 'object', properties: { source: { type: 'string', description: 'Source file or directory path' }, destination: { type: 'string', description: 'Destination path for copy' }, overwrite: { type: 'boolean', description: 'Overwrite destination if it exists' }, preserve_attributes: { type: 'boolean', description: 'Preserve file timestamps and permissions' } }, required: ['source', 'destination'] } }, { name: 'get_file_info', description: 'Get detailed information about files and directories. Check file size, modification time, permissions.', inputSchema: { type: 'object', properties: { path: { type: 'string', description: 'File or directory path' }, follow_symlinks: { type: 'boolean', description: 'Follow symbolic links' } }, required: ['path'] } } ]; // Create and run the server const server = new MockMCPServer(serverInfo, tools); server.run().catch(console.error);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/portel-dev/ncp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server