Filesystem MCP Server
文件系统 MCP 服务器
模型上下文协议 (MCP) 服务器实现通过标准化工具接口提供文件系统操作、分析和操控功能。
建筑学
该服务器基于 MCP SDK 构建,并分为不同的层:
graph TD
A[MCP Server Layer] --> B[Tool Registry]
B --> C[Operations Layer]
C --> D[File System Operations]
C --> E[Analysis Operations]
C --> F[Stream Operations]成分
服务器层:处理MCP协议通信和工具调度
工具注册表:管理工具注册和执行
操作层:实现核心功能
文件系统接口:提供安全的文件系统访问
Related MCP server: MCP Filesystem Server
安装
克隆存储库:
git clone <repository-url>
cd filesystem-server安装依赖项:
npm install构建服务器:
npm run build配置 MCP 设置(cline_mcp_settings.json):
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": ["path/to/filesystem-server/build/index.js"]
}
}
}工具参考
目录操作
列表目录
列出带有元数据的目录内容。
interface ListDirectoryParams {
path: string; // Directory path
recursive?: boolean; // List recursively (default: false)
}
interface ListDirectoryResult {
entries: {
name: string;
path: string;
isDirectory: boolean;
size: number;
created: string;
modified: string;
accessed: string;
mode: string;
}[];
}创建目录
创建新目录。
interface CreateDirectoryParams {
path: string; // Directory path
recursive?: boolean; // Create parent directories (default: true)
}文件操作
读取文件
读取具有编码支持的文件内容。
interface ReadFileParams {
path: string; // File path
encoding?: string; // File encoding (default: 'utf8')
}写入文件
将内容写入文件。
interface WriteFileParams {
path: string; // File path
content: string; // Content to write
encoding?: string; // File encoding (default: 'utf8')
}追加文件
将内容附加到文件。
interface AppendFileParams {
path: string; // File path
content: string; // Content to append
encoding?: string; // File encoding (default: 'utf8')
}分析操作
分析文本
分析文本文件属性。
interface AnalyzeTextParams {
path: string; // File path
}
interface AnalyzeTextResult {
lineCount: number;
wordCount: number;
charCount: number;
encoding: string;
mimeType: string;
}计算哈希
使用指定的算法计算文件哈希值。
interface CalculateHashParams {
path: string; // File path
algorithm?: 'md5' | 'sha1' | 'sha256' | 'sha512'; // Hash algorithm
}
interface CalculateHashResult {
hash: string;
algorithm: string;
}查找重复项
识别目录中的重复文件。
interface FindDuplicatesParams {
path: string; // Directory path
}
interface FindDuplicatesResult {
duplicates: {
hash: string;
size: number;
files: string[];
}[];
}压缩操作
创建_zip
创建一个 ZIP 档案。
interface CreateZipParams {
files: string[]; // Files to include
output: string; // Output ZIP path
}提取压缩文件
提取 ZIP 档案。
interface ExtractZipParams {
path: string; // ZIP file path
output: string; // Output directory
}错误处理
服务器使用标准 MCP 错误代码:
enum ErrorCode {
ParseError = -32700,
InvalidRequest = -32600,
MethodNotFound = -32601,
InvalidParams = -32602,
InternalError = -32603
}错误响应包括:
错误代码
人类可读的消息
附加上下文(如有)
错误示例:
{
"code": -32602,
"message": "File not found: /path/to/file.txt"
}发展
项目结构
src/
├── operations/ # Core operations implementation
├── tools/ # MCP tool definitions and handlers
├── __tests__/ # Test suites
├── index.ts # Entry point
├── server.ts # MCP server setup
├── types.ts # Type definitions
└── utils.ts # Utility functions运行测试
运行测试套件:
npm test覆盖运行:
npm run test:coverage开发模式
以监视模式运行:
npm run watch代码质量
检查代码库:
npm run lint类型检查:
npm run type-check依赖项
核心依赖项:
@modelcontextprotocol/sdk:MCP 服务器实现
file-type:文件类型检测
mime-types:MIME 类型查找
crypto-js:文件哈希
归档器:ZIP 创建
extract-zip:ZIP 提取
iconv-lite:文本编码
chardet:编码检测
开发依赖项:
typescript:类型系统
开玩笑:测试
eslint:Lint
更漂亮:格式化
ts-node:TypeScript 执行
nodemon:开发服务器
贡献
分叉存储库
创建你的功能分支
为新功能编写测试
确保所有测试通过
提交拉取请求
执照
麻省理工学院
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for Studex tools, notifications, and profile integrations
Model Context Protocol server for todo.vu task management and time tracking.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables enhanced file system operations including reading, writing, copying, moving files with streaming capabilities, directory management, file watching, and change tracking.21MIT
- AlicenseAqualityFmaintenanceA Model Context Protocol server that provides secure and intelligent interaction with files and filesystems, offering smart context management and token-efficient operations for working with large files and complex directory structures.2166MIT
- AlicenseCqualityDmaintenanceA server implementing the Model Context Protocol that provides filesystem operations (read/write, directory management, file movement) through a standardized interface with security controls for allowed directories.94MIT
- AlicenseNot gradedqualityDmaintenanceA server that implements the Model Context Protocol, providing a standardized way to connect AI models to different data sources and tools.711MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/bsmi021/mcp-filesystem-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server