mcp-local-file-server

mcp-local-file-server

3.3

MCP Local File Server is a server for accessing and manipulating local files using MCP (Managed Control Panel).

The MCP Local File Server is designed to facilitate the management of local files through a web-based interface. It allows users to perform various file operations such as listing, reading, uploading, updating, and deleting files. The server is built using Node.js and can be easily set up by cloning the repository and installing the necessary dependencies. Once started, it runs on the local machine and provides a set of API endpoints to interact with the file system. This server is particularly useful for developers and system administrators who need to manage files on a local server or during development. However, due to its full access to the file system, it should be used with caution and only in trusted environments.

Features

  • File Listing: Allows users to list all files in a specified directory.
  • File Reading: Provides the ability to read the content of a specified file.
  • File Upload: Supports uploading files using multipart/form-data.
  • File Update: Enables updating the content of an existing file.
  • File Deletion: Allows for the removal of files or directories.

Usage with Different Platforms

Node.js

javascript
// Listar arquivos
fetch('http://localhost:3000/files')
  .then(response => response.json())
  .then(files => console.log(files));

// Ler arquivo
fetch('http://localhost:3000/file?path=/caminho/do/arquivo.txt')
  .then(response => response.json())
  .then(data => console.log(data.content));

// Upload de arquivo
const formData = new FormData();
formData.append('file', arquivoParaUpload);
fetch('http://localhost:3000/file', {
  method: 'POST',
  body: formData
});

// Atualizar arquivo
fetch('http://localhost:3000/file', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    path: '/caminho/do/arquivo.txt',
    content: 'Novo conteúdo'
  })
});

// Deletar arquivo
fetch('http://localhost:3000/file?path=/caminho/do/arquivo.txt', {
  method: 'DELETE'
});