Crystal MCP Server Banner

Crystal MCP Server

pipeline status latest release License: GPL v3 Crystal Donate with Liberapay

A high-performance Model Context Protocol (MCP) server for the Crystal programming language. This server provides Large Language Models (LLMs) and autonomous AI coding agents with deep, context-aware tools to analyze, build, test, format, and inspect Crystal codebases in real time.


Project Goal

The goal of this project is to bridge the gap between AI assistants and the Crystal development ecosystem. By exposing the Crystal compiler's capabilities, testing framework, and ecosystem tooling through the standard JSON-RPC 2.0 stdio transport, we enable AI agents to:


Synergy with Crystalino LSP

For an optimal Crystal development experience in both human IDEs and autonomous AI agent environments, crystal-mcp pairs symbiotically with Crystalino:

| Capability Domain | Crystalino (LSP Server) | Crystal MCP (MCP Server) | | :--- | :--- | :--- | | Protocol | Language Server Protocol (LSP 3.17) | Model Context Protocol (MCP 2024-11-05) | | Primary Consumer | Editors & IDEs (Neovim, Crush, Helix, VSCode) | AI Agents & LLMs (Antigravity, Claude, OpenCode) | | Code Completion | Real-time interactive completion & signature help | Context-directed symbol & stdio queries | | Navigation & Renaming | Go-to-definition, find-references, lexical rename | AST implementation lookup & macro expansion | | Test Execution | N/A (Editor runner) | Targeted spec execution (run_spec with path:line) | | Build & Type Checking | Background compilation & diagnostic publishing | Zero-codegen build validation (check_build) | | Linting & Formatting | Document formatting provider | Ameba static analysis (lint_code) & format_code | | Type Topologies | Document symbols & hierarchical folding ranges | Structured JSON hierarchy & struct layouts (get_hierarchy) |


Tool Catalog

The server exposes 10 MCP tools:

Core & Diagnostic Tools

Compiler Proxy Tools

Testing Engine Tools

Quality & Formatting Tools

Ecosystem & Workspace Tools


Documentation

The project documentation is organized using a modular specification architecture:


Installation & Setup

Building & Installing from Source

  1. Clone the repository:

    git clone https://gitlab.com/renich/crystal-mcp.git
    cd crystal-mcp
  2. Build the release binary:

    make build
  3. Install to ~/.local/bin:

    make install

Verify the installation:

crystal-mcp --version

Client Configuration

Add crystal-mcp to your client configuration:

Google Antigravity (AGY) (~/.gemini/config/mcp_config.json)

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

OpenCode (config.json)

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

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "crystal-mcp": {
      "command": "/home/YOUR_USER/.local/bin/crystal-mcp"
    }
  }
}

VS Code/Cursor (Cline/Roo Code)

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

Development & Verification

This project uses a GNUmakefile for common development tasks:


Supporting the Project

If you find crystal-mcp valuable for your Crystal development, CI/CD pipelines, or autonomous agent workflows, consider supporting its maintenance:

Donate using Liberapay

You can also sponsor Rénich Bon Ćirić directly on Liberapay (renich).


License & Authors