Labsco
MCP SERVER

Java Filesystem & Web MCP Server

by stephanj

Filesystem and web access for an agent, as a Java server — read, edit with diffs, grep, run bash, fetch a page.

Local Filesystem Access
Summary
The dry-run diff on edits is the detail that makes handing an agent write access reasonable.

editFile replaces exact line sequences and returns a git-style diff, and dryRun lets you see that diff before anything is written — so a proposed change can be reviewed rather than discovered afterwards. The set is otherwise the familiar agent toolkit, with grep carrying context lines and a result cap so a wide search does not flood the context. executeBash is the one to think about: it runs arbitrary shell commands with whatever privileges the server has.

What it is

A Spring Boot server that exposes local filesystem operations and web fetching to an MCP client, built on Spring AI's MCP server components.

What you get
  • readFile and writeFile — read a file with encoding detection, or create and overwrite one, parent directories included
  • editFile — line-based edits that return a git-style diff, with a dryRun flag to see the change before applying it
  • grepFiles — text search inside files with line numbers and context lines, optional regex, case control and a result cap
  • searchFiles — recursive search for files and directories by pattern, case-insensitive and matching partial names
  • listDirectory and createDirectory — detailed listings, and several directories created in one call
  • executeBash — a shell command run with a working directory and a timeout, returning stdout and stderr
  • fetchWebpage — a URL retrieved and its text extracted, with a configurable timeout
  • Both transports: SSE over HTTP on port 8081, or stdio for clients that need it
Requirements

Java 17 or higher and Maven 3.6 or higher; built with mvn clean package. No account and no key — but it reads, writes and executes on the machine it runs on, so scope that machine accordingly. For stdio mode the banner and console logging must be switched off, otherwise the log output corrupts the JSON-RPC stream.

Setup effort

Build from source — clone the repository and build it, then point your client at the binary