Get the FREE Ultimate OpenClaw Setup Guide →

mcp-codestyle

MCP server from codestyle-mafeng/mcp-codestyle-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio codestyle-mafeng-mcp-codestyle-server java -jar mcp-codestyle-server.jar \
  --env JAVA_OPTS="XX:MaxRAMPercentage=75%" \
  --env SPRING_APPLICATION_NAME="mcp-codestyle-server"

How to use

Codestyle Server MCP is a Java-based MCP server that provides code template search and retrieval capabilities for IDEs and AI agents. It uses an embedded Lucene index for fast local searches and can automatically repair missing templates by fetching metadata and files from a remote repository when configured. The server exposes MCP tools such as codestyleSearch (to browse template groups and descriptions) and getTemplateByPath (to fetch detailed variable information and template content). Clients can interact with these tools via STDIO or a compatible MCP client, enabling seamless integration with editors and AI assistants. The system supports offline full-text search with SmartChineseAnalyzer for Chinese templates and can switch to remote API search if you enable remote search in the configuration. Templates are organized in a Maven-like groupId/artifactId/version structure to support multiple versions.

To use the tools, start the MCP server and then invoke codestyleSearch with a keyword to retrieve a directory tree and template overviews. Use getTemplateByPath with a template path (groupId/artifactId/version) to obtain variable definitions and the actual template content. The included PromptService renders responses using content-result.txt and search-result.txt to ensure consistent layouts, and the system can auto-download templates when they are missing locally.

How to install

Prerequisites:

  • JDK 17+ installed on your machine
  • Maven 3.9+ (or use the provided Maven wrapper in the repository)
  • Git to clone the repository
  1. Clone the repository
git clone https://github.com/itxaiohanglover/mcp-codestyle-server.git
cd mcp-codestyle-server
  1. Build the project
./mvnw clean package -DskipTests
  1. Configure remote/local repository (optional but recommended)
  • Edit src/main/resources/application.yml to configure repository.local-path, repository.remote-path, and repository.remote-search-enabled as needed.
  1. Run the MCP server
java -jar target/mcp-codestyle-server-1.0.0.jar

If you prefer a direct run using the built jar, adjust the jar name to match the built artifact in your environment.

Additional notes

Tips and common issues:

  • The server uses a local Lucene index by default. If you want to enable remote search, set repository.remote-search-enabled: true and provide a valid repository.remote-path.
  • The base local cache path can be overridden with -Dcache.base-path when launching the JVM.
  • Ensure the local path exists and is writable (repository.local-path). The directory structure follows groupId/artifactId/version to support multiple template versions.
  • If templates fail to download, check network access to the remote repository and verify the remote API endpoints described in the README.
  • The content-result.txt and search-result.txt templates define how responses are rendered; customize them if you want a different response layout.

Related MCP Servers

Sponsor this space

Reach thousands of developers