TypeScript

FileSystem Server

Give your AI agents filesystem access with security controls. Read, write, search, and manage files with configurable permissions.

src/index.ts
import { MCPServer, Tool } from "@modelcontextprotocol/server";
import * as fs from "fs/promises";
import { glob } from "glob";

const server = new MCPServer("filesystem", { port: 3000 });

// Tool: Read file
@Tool()
async readFile(path: string): Promise<string> {
  await sandbox.validate(path);
  return fs.readFile(path, "utf-8");
}

// Tool: Search files
@Tool()
async globSearch(pattern: string): Promise<string[]> {
  return glob(pattern, { cwd: sandbox.root });
}

// Tool: Watch files
@Tool()
async watchFiles(patterns: string[]): Promise<void> {
  // File watcher implementation
}

server.run();

Secure Sandboxing

Restrict access to allowed directories only.

Glob Pattern Search

Find files quickly with pattern matching.

File Watching

React to file changes in real-time.

Built With

TypeScript Node.js FastMCP chokidar
Get Template Browse All Templates