SM

stephanj/mcpjavafilesystem

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

25 stars 11 forks Качество 51 Тренд 0

В этом проекте реализован сервер Model Context Protocol (MCP), который обеспечивает операции файловой системы и инструменты веб-доступа для агентов Large Language Model (LLM).

Обзор

В этом проекте реализован сервер Model Context Protocol (MCP), который обеспечивает операции файловой системы и инструменты веб-доступа для агентов Large Language Model (LLM). Он позволяет помощникам ИИ взаимодействовать как с локальной файловой системой, так и с веб-ресурсами посредством набора четко определенных операций. Сервер выполняет следующие операции: - : Читать полное содержимое файла с правильным обнаружением кодирования - : Создавать или перезаписывать файлы с новым контентом - : Делать редактирование на основе строк с генерацией диффов в стиле git - : Рекурсивно искать файлы и каталоги с использованием шаблонов каталогов - : Получать подробные списки содержимого каталогов - : Создавать каталоги и вложенные структуры каталогов - : Поиск текстовых шаблонов в файлах с номерами строк и контекстом, похожий на команду Unix grep - : Исполнять команды bash в системной оболочке и захватывать их выход - : Извлеките контент с веб-страниц с настраиваемыми тайм-аутами - : Извлеките текстовый контент из документов HTML Эти операции рассматриваются как...

Обзор (машинный перевод)

В этом проекте реализован сервер Model Context Protocol (MCP), который обеспечивает операции файловой системы и инструменты веб-доступа для агентов Large Language Model (LLM). Он позволяет помощникам ИИ взаимодействовать как с локальной файловой системой, так и с веб-ресурсами посредством набора четко определенных операций.

Особенности

Сервер выполняет следующие операции:

###Файловые системы Чтение файлов: прочитайте полное содержимое файла с надлежащим обнаружением кодирования Письменные файлы: Создание или перезапись файлов с новым контентом Редактирование файлов: редактирование на основе линий с помощью генерации диффов в стиле git Поиск файлов: Рекурсивный поиск файлов и каталогов с использованием шаблонов шаров Списочные каталоги: получить подробные списки содержимого каталогов ** Создание каталогов**: создание каталогов и вложенных структур каталогов Grep Files: поиск шаблонов текста в файлах с номерами строк и контекстом, похожих на команду Unix grep Bash Command: Выполняйте команды bash в системной оболочке и захватывайте их выход

Веб-операции

** Веб-страница Поиск **: Извлекать контент с веб-страниц с настраиваемыми тайм-аутами

Эта страница переведена автоматически. Технические детали смотрите в оригинале.

README

Показан фрагмент оригинального README. Открыть оригинал.

Java Filesystem & Web MCP Server

This project implements a Model Context Protocol (MCP) server that provides filesystem operations and web access tools for Large Language Model (LLM) agents. It enables AI assistants to interact with both the local filesystem and web resources through a set of well-defined operations.

Features

The server provides the following operations:

Filesystem Operations

  • Reading Files: Read the complete contents of a file with proper encoding detection
  • Writing Files: Create or overwrite files with new content
  • Editing Files: Make line-based edits with git-style diff generation
  • Searching Files: Recursively search for files and directories using glob patterns
  • Listing Directories: Get detailed listings of directory contents
  • Directory Creation: Create directories and nested directory structures
  • Grep Files: Search for text patterns within files with line numbers and context, similar to Unix grep command
  • Bash Command: Execute bash commands in the system shell and capture their output

Web Operations

  • Web Page Fetching: Retrieve content from web pages with configurable timeouts
  • HTML Content Extraction: Extract text content from HTML documents

These operations are exposed as tools for Large Language Models using the Model Context Protocol (MCP), allowing AI systems to safely interact with the filesystem and access web resources.

Example of the MCP Java tool with DevoxxGenie

Getting Started

Prerequisites

  • Java 17 or higher
  • Maven 3.6+
  • Spring Boot 3.3.6
  • Spring AI MCP Server components

Building the Project

Build the project using Maven:

mvn clean package

Running the Server

The server supports two transport modes:

SSE Mode (HTTP-based, default)

Run the server for SSE-based communication:

java -jar target/devoxx-filesystem-0.0.1-SNAPSHOT.jar

This starts an HTTP server on port 8081 with the SSE endpoint at /sse.

STDIO Mode (for MCP clients like Claude Desktop or DevoxxGenie)

For STDIO-based communication (required by most MCP clients):

java -Dspring.ai.mcp.server.stdio=true \
     -Dspring.main.web-application-type=none \
     -Dspring.main.banner-mode=off \
     -Dlogging.pattern.console= \
     -jar target/devoxx-filesystem-0.0.1-SNAPSHOT.jar

Important flags for STDIO mode:

  • -Dspring.ai.mcp.server.stdio=true - Enables STDIO transport
  • -Dspring.main.web-application-type=none - Disables the web server
  • -Dspring.main.banner-mode=off - Disables Spring Boot banner (required to avoid corrupting JSON-RPC communication)
  • -Dlogging.pattern.console= - Disables console logging

Tool Services

Filesystem Tools

ReadFileService

readFile(String fullPathFile)
Открыть полный README на GitHub

Установка

This server does not publish a one-line install command.

Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →

Конфигурация

{ "mcpServers": { "filesystem": { "command": "/Library/Java/JavaVirtualMachines/liberica-jdk-23.jdk/Contents/Home/bin/java", "args": [ "-Dspring.ai.mcp.server.stdio=true", "-Dspring.main.web-application-type=none", "-Dspring.main.banner-mode=off", "-Dlogging.pattern.console=", "-jar", "~/JavaFileSystemMCP/target/devoxx-filesystem-0.0.1-SNAPSHOT.jar" ] } } }