Skip to main content
Glama

MCP File Server

by codyde

MCP文件服务器

模型上下文协议 (MCP) 服务器实现通过标准化接口提供文件系统操作。

概述

MCP 文件服务器使 AI 模型能够通过标准化 API 在本地文件系统上执行文件操作。它使用模型上下文协议SDK 构建,并提供用于读取、创建和列出文件的工具。

特征

  • 创建文件:创建具有指定内容的新文件
  • 读取文件:读取现有文件的内容
  • 列出目录内容:列出文件和目录的详细信息
  • 性能监控:内置 Sentry 集成,用于错误跟踪和性能监控

安装

npm install

用法

启动 MCP 文件服务器:

node src/index.js

服务器使用 MCP 协议通过 stdin/stdout 进行通信。

可用工具

创建文件

使用提供的内容在指定路径创建一个新文件。

参数:

  • filePath :应创建文件的路径
  • content :写入文件的内容

返回:

  • 包含文件路径和大小信息的成功消息

读文件

读取指定路径下的文件内容。

参数:

  • filePath :要读取的文件的路径

返回:

  • 文件内容

列表文件

列出指定路径下的文件和目录。

参数:

  • path :列出内容的目录路径

返回:

  • 包含文件名、大小和类型的 Markdown 表

环境变量

  • SENTRY_DSN :用于错误跟踪的 Sentry 数据源名称(可选)

依赖项

  • @modelcontextprotocol/sdk :MCP SDK 包
  • zod :模式验证
  • @sentry/node :错误跟踪和性能监控

示例

通过 MCP 协议调用这些工具的示例:

{ "name": "createfile", "params": { "filePath": "example/test.txt", "content": "Hello, world!" } }
{ "name": "readfile", "params": { "filePath": "example/test.txt" } }
{ "name": "listfiles", "params": { "path": "example" } }

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

使 AI 模型能够通过标准化的模型上下文协议接口在本地文件系统上执行文件系统操作(读取、创建和列出文件)。

  1. 概述
    1. 特征
      1. 安装
        1. 用法
          1. 可用工具
            1. 创建文件
            2. 读文件
            3. 列表文件
          2. 环境变量
            1. 依赖项
              1. 示例

                Related MCP Servers

                • -
                  security
                  F
                  license
                  -
                  quality
                  A Model Context Protocol server that extends AI capabilities by providing file system access and management functionalities to Claude or other AI assistants.
                  Last updated -
                  3
                  TypeScript
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  A comprehensive MCP (Model Context Protocol) server for file system operations, providing Claude and other AI assistants with access to local files and directories.
                  Last updated -
                  Python
                  MIT License
                  • Apple
                  • Linux
                • -
                  security
                  A
                  license
                  -
                  quality
                  A secure Model Context Protocol server that provides controlled filesystem access within predefined directories, enabling AI models to perform file and directory operations with strict path validation.
                  Last updated -
                  26
                  7
                  TypeScript
                  MIT License
                  • Linux
                  • Apple
                • -
                  security
                  A
                  license
                  -
                  quality
                  Enables AI applications to interact with decentralized storage through a standardized Model Context Protocol interface, allowing file uploads, retrievals, and identity management.
                  Last updated -
                  7
                  TypeScript
                  Apache 2.0
                  • Linux
                  • Apple

                View all related MCP servers

                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/codyde/mcp-file-tool'

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