[ANN] Crystal MCP - An MCP Server for Crystal Tooling

Hi everyone,

I’d like to share a project I’ve been working on: Crystal MCP (v0.1.2).

It’s an implementation of the Model Context Protocol for Crystal. The goal is to let AI coding agents (like OpenCode or Claude) interact with Crystal’s existing tooling to better understand your code.

What it does

Instead of just reading text, this server uses the Crystal compiler and ecosystem tools to provide deeper context to the AI:

  • Macro Expansion: It can run crystal tool expand to show the AI exactly what code is being generated behind the scenes.
  • Implementations: It uses crystal tool implementations to find definitions.
  • Linting: It runs ameba to check for code issues.
  • Dependencies: It inspects shard.lock to see what libraries are installed.

Usage

It’s designed to work with any MCP-compliant client. For OpenCode:

  1. Install:

    git clone https://gitlab.com/renich/crystal-mcp.git
    cd crystal-mcp
    make install
    
  2. Configure:
    Add it to your ~/.config/opencode/opencode.json (or equivalent MCP settings):

    {
      "mcpServers": {
        "crystal": {
          "command": "/home/YOUR_USER/.local/bin/crystal-mcp",
          "args": []
        }
      }
    }
    

Repository

The code is available here:

It’s still early days (v0.1.2), so there are likely rough edges. If you find it useful or have suggestions for improvement, I’d appreciate the feedback.

Thanks!

1 Like