A Go-focused Model Context Protocol (MCP) server that provides idiomatic Go code generation, style guidelines, and best practices. This tool helps Language Models understand and generate high-quality Go code following established patterns and conventions.
Note: This project is under active development. The following features are currently being implemented:
- Go-specific code pattern recognition and generation
- Idiomatic Go code style enforcement
- Go project structure templates
The project follows clean architecture principles and is designed for extensibility.
The Model Context Protocol (MCP) is implemented using the github.com/metoro-io/mcp-golang
library. The server:
go install github.com/ksysoev/mcp-go-tools/cmd/mcp-go-tools@latest
mcp-go-tools [command] [flags]
For detailed usage examples and patterns, see USAGE.md.
Starts the MCP server with the specified configuration:
mcp-go-tools start --config config.yaml
Run the server with logs written to a file instead of stdout:
# JSON format (default)
mcp-go-tools start --config config.yaml --log-file=server.log
# Text format with debug level for request tracking
mcp-go-tools start --config config.yaml --log-file=server.log --log-text --log-level=debug
Note: When --log-file is provided, logs will be written only to the specified file, not to stdout.
The application follows a clean, layered architecture typical of Go projects:
API Layer (pkg/api
)
Core Layer (pkg/core
)
Repository Layer (pkg/repo
)
Command Layer (pkg/cmd
)
--config string Config file path
--log-level string Log level (debug, info, warn, error) (default "info")
--log-text Log in text format, otherwise JSON
--log-file string Log file path (if set, logs to stdout)
The tool supports configuration via a JSON/YAML file. Specify the config file path using the --config
flag. See example.config.yaml for Go-specific patterns and rules.
.
├── cmd/
│ └── mcp-go-tools/ # Main application entry point
├── pkg/
│ ├── api/ # API service implementation
│ ├── cmd/ # Command implementations
│ ├── core/ # Core business logic
│ └── repo/ # Data repositories
The project is in active development with the following components:
go build -o mcp-go-tools ./cmd/mcp-go-tools
go test ./...
To use this MCP server with Cline, add it to Cline's MCP settings
Add the following configuration to the mcpServers
object in the settings file:
{
"mcpServers": {
"code-tools": {
"command": "mcp-go-tools",
"args": ["server", "--config=/Users/user/mcp-go-tools/example.config.yaml"],
"env": {}
}
}
}
Custom instructions example:
Use project template to initialize new applications in GoLang, it's available in MCP server code-tools `codestyle` with category `template`
Every time you need to generate code use MCP server code-tools to `codestyle` for required category `code`, `documentation`, `testing`
example of request to MCP server code-tool:
{
"method": "tools/call",
"params": {
"name": "codestyle",
"arguments": {
"categories": "testing" #Comma separate list
},
}
}
Before finishing task you should run `golangci-lint` and recursively address issues until all issues are fixed
to fix field alignment issues you should use `fieldalignment -fix ./...`
This project is licensed under the MIT License - see the LICENSE file for details.
{
"mcpServers": {
"code-tools": {
"env": {},
"args": [
"server",
"--config=/Users/user/mcp-go-tools/example.config.yaml"
],
"command": "mcp-go-tools"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.