# Mcp Go Tools

> 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.

- **Type:** MCP server
- **Install:** `agentstack add mcp-ksysoev-mcp-go-tools`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [ksysoev](https://agentstack.voostack.com/s/ksysoev)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [ksysoev](https://github.com/ksysoev)
- **Source:** https://github.com/ksysoev/mcp-go-tools

## Install

```sh
agentstack add mcp-ksysoev-mcp-go-tools
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# MCP GO Tools

[](https://github.com/ksysoev/mcp-go-tools/actions/workflows/main.yml)
[](https://github.com/ksysoev/mcp-go-tools/actions/workflows/github-code-scanning/codeql)
[](https://codecov.io/gh/ksysoev/mcp-go-tools)
[](https://goreportcard.com/report/github.com/ksysoev/mcp-go-tools)
[](https://opensource.org/licenses/MIT)

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.

## About MCP Protocol

The Model Context Protocol (MCP) is implemented using the `github.com/metoro-io/mcp-golang` library. The server:
- Uses stdio transport for communication
- Supports graceful shutdown
- Handles concurrent operations using errgroups
- Provides Go-specific code generation tools

## Installation

```bash
go install github.com/ksysoev/mcp-go-tools/cmd/mcp-go-tools@latest
```

## Features

- Go-specific code generation and style guidelines
- Command-line interface built with Cobra
- Flexible configuration using YAML/JSON files
- Structured logging with slog
  - File output support with --log-file flag (writes to file instead of stdout)
  - JSON and text formats
  - Configurable log levels
  - Debug logging for request tracking
- Server management commands
- Signal handling for graceful shutdown

## Quick Start

### Basic Command Structure

```bash
mcp-go-tools [command] [flags]
```

For detailed usage examples and patterns, see [USAGE.md](USAGE.md).

### Common Commands

#### Start Server
Starts the MCP server with the specified configuration:
```bash
mcp-go-tools start --config config.yaml
```

#### Run with File Logging
Run the server with logs written to a file instead of stdout:
```bash
# 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.

## Architecture

The application follows a clean, layered architecture typical of Go projects:

1. **API Layer** (`pkg/api`)
   - Handles MCP protocol communication via stdio transport
   - Manages server lifecycle with graceful shutdown
   - Implements Go code generation tools
   - Uses errgroups for concurrent operations

2. **Core Layer** (`pkg/core`)
   - Implements Go code pattern recognition
   - Manages code style rules
   - Processes MCP requests
   - Designed for extensibility with interface-based components

3. **Repository Layer** (`pkg/repo`)
   - Manages Go code patterns and templates
   - Supports named resource definitions
   - Implements simple data persistence
   - Uses Viper for resource configuration mapping

4. **Command Layer** (`pkg/cmd`)
   - Implements CLI commands
   - Handles configuration and logging setup

### Global Flags

```bash
--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)
```

### Configuration File

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.

## Project Structure

```
.
├── cmd/
│   └── mcp-go-tools/              # Main application entry point
├── pkg/
│   ├── api/             # API service implementation
│   ├── cmd/             # Command implementations
│   ├── core/            # Core business logic
│   └── repo/            # Data repositories
```

## Dependencies

- Go 1.23.4 or higher
- github.com/metoro-io/mcp-golang - MCP protocol implementation
- github.com/spf13/cobra - CLI framework
- github.com/spf13/viper - Configuration management
- golang.org/x/sync - Synchronization primitives

## Development

### Project Status

The project is in active development with the following components:
- ✅ CLI framework and command structure
- ✅ Configuration management
- ✅ MCP protocol integration
- ✅ Idiomatic Go code generation
- ✅ Go project templates
- ✅ Mockery support
- 🚧 Add integration linters

### Building from Source

```bash
go build -o mcp-go-tools ./cmd/mcp-go-tools
```

### Running Tests

```bash
go test ./...
```

## Using with Cline

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:

```json
{
  "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 ./...`
```

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [ksysoev](https://github.com/ksysoev)
- **Source:** [ksysoev/mcp-go-tools](https://github.com/ksysoev/mcp-go-tools)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-ksysoev-mcp-go-tools
- Seller: https://agentstack.voostack.com/s/ksysoev
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
