The Java Filesystem & Web MCP Server implements the Model Context Protocol (MCP) to enable AI assistants to interact with both local filesystem and web resources. It provides a set of tools that allow LLMs to read, write, and edit files, search directories, and fetch web content through a standardized protocol.
Build the project using Maven:
mvn clean package
Run the server using the following command:
java -jar target/devoxx-filesystem-0.0.1-SNAPSHOT.jar
Note that the server uses STDIO for communication and doesn't expose HTTP endpoints. It's designed to be launched by an MCP client.
readFile(String fullPathFile)
Reads the complete contents of a file with proper encoding detection and provides detailed error messages if the file cannot be read.
writeFile(String path, String content)
Creates a new file or overwrites an existing file with new content. Automatically creates parent directories if they don't exist.
editFile(String path, String edits, Boolean dryRun)
Makes line-based edits to text files. Returns a git-style diff showing the changes made. Use the dryRun parameter to preview changes without applying them.
searchFiles(String path, String pattern)
Recursively searches for files and directories matching a pattern. The search is case-insensitive and matches partial names.
listDirectory(String path)
Gets a detailed listing of all files and directories in a specified path, clearly distinguishing between files and directories with additional metadata.
fetchWebpage(String url, Integer timeoutMs)
Retrieves content from web pages with configurable timeouts. Uses jsoup to connect to the webpage and fetch its content.
The application is configured via application.properties:
spring.main.web-application-type=none
spring.main.banner-mode=off
logging.pattern.console=
spring.ai.mcp.server.name=filesystem-server
spring.ai.mcp.server.version=0.0.1
logging.file.name=,/JavaFileSystemMCP/target/filesystem-server.log
To integrate with DevoxxGenie:
-Dspring.ai.mcp.server.stdio=true
-Dspring.main.web-application-type=none
-Dlogging.pattern.console=
-jar
/path/to/devoxx-filesystem-0.0.1-SNAPSHOT.jar
To use with Claude Desktop, edit your claude_desktop_config.json file and add:
java -jar target/devoxx-filesystem-0.0.1-SNAPSHOT.jar
When using this server, be aware of the following security implications:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.