Cover image
Try Now
2025-04-14

Eine VS -Code -Erweiterung erstellt einen MCP -Server für Calvas Clojure Repl -Verbindung

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

Make CoPilot an Interactive Programmer

Calva MCP Server

VS Code Extension Issues License

A Model Context Protocol server extension for Calva, the Clojure/ClojureScript extension for VS Code, enabling AI assistants to harness the power of the REPL.

Why Calva MCP Server?

"I wish Copilot could actually run my Clojure code instead of just guessing what it might do."

The Calva MCP Server transforms AI coding assistants from static code generators into interactive programming partners by giving them access to your REPL. (Please be mindful about the implications of that before you start using it.)

Turn your AI Agent into an Interactive Programming partner

Tired of AI tools that write plausible-looking Clojure that falls apart at runtime? Calva MCP Server lets your AI assistant:

  • Evaluate code in your actual environment - No more "this might work" guesses
  • See real data structures, not just predict their shape
  • Test functions with real inputs before suggesting them
  • Debug alongside you with access to runtime errors
  • Learn from your codebase's actual behavior

For Clojurians who value Iiteractive Programming

As Clojure developers, we know the REPL isn't just a console - it's the center of our workflow. Now your AI assistant can join that workflow, understanding your data and functions as they actually exist, not just as they appear in static code.

Key Features

  • Seamless integration between GitHub Copilot and your Calva REPL
  • AI-driven code evaluation with full access to your project's runtime (⚠️)
  • Interactive data exploration for smarter code suggestions
  • REPL-powered debugging assistance
  • Works with your existing Clojure/ClojureScript projects

Getting Started

Prerequisites

  • VS Code
  • Calva
  • An AI coding assistant (e.g., GitHub Copilot)
  • Any Clojure environment dependencies your project has (e.g. Clojure, Babashka, etc)

Installation

VS Code/CoPilot needs a stdio server to talk to. I couldn't find a way for the MCP client to start a stdio server inside a VS Code extension. (I don't think it is possible, really.) Thus, the Calva MCP Server is internally a socket server, which at startup writes the port it binds to to a port file. A node script (a.k.a the wrapper) is bundled with the extension that will start a stdio server wrapping the socket MCP server. The wrapper script takes the port file as an argument. Because of these and other reasons, there will be one Calva MCP server per workspace, and the port file will be written to the .calva directory in the workspace root.

  1. Install Calva MCP Server from the Extensions pane in VS Code
  2. Start the Calva MCP socket server
  3. Add the MCP server config (may vary depending on MCP Client)
  4. Stop the Calva MCP socket server (it's a habit to consider, at least)

CoPilot configuration

In you project's .vscode/mcp.json add a "calva" entry like so:

{
  "servers": {
    // other servers (if any) ...
    "calva": {
      "type": "stdio",
      "command": "node",
      "args": [
        "${extensionInstallFolder:betterthantomorrow.calva-mcp-server}/dist/calva-mcp-server.js",
        "${workspaceFolder}/.calva/mcp-server/port"
      ]
    }
  }
}

The VS Code editor for this file is also the UI for starting and stopping the stdio server.

Using

For CoPilot (or any MCP client) to use the Calva MCP Server, the socket server needs to be started before the stdio wrapper. For CoPilot, the latter is started from the VS Code MCP servers UI. For now the socket server needs to always be started manually.

  1. Connect Calva to your Clojure/ClojureScript project
  2. Issue the command: Calva MCP Server: Start the socket server
  3. In .vscode/mcp.json, use the Start button on the "calva" server.
  4. Start using your AI Agent with REPL superpowers!

⚠️ NB: You are at the mercy of the AI Agent. Using your REPL it can do anything that you can do from that REPL...

When you are done:

  1. Issue the command: Calva MCP Server: Stop the socket server

This way your Clojure REPL is not exposed to any AI Agents (at least not by the Calva MCP Server extension).

How It Works

Calva MCP Server implements the Model Context Protocol (MCP), creating a bridge between AI assistants and your REPL:

  1. When your AI assistant needs to understand your code better, it can execute it in your REPL
  2. The results flow back to the AI, giving it insight into actual data shapes and function behavior
  3. This creates a powerful feedback loop where suggestions improve based on runtime information
  4. You remain in control of this process, benefiting from an AI partner that truly understands your running code
flowchart TD
    subgraph InteractiveProgrammers["Interactive Programmers"]
        User([You])
        AIAgent([AI Agent])
        User <--> AIAgent
    end

    subgraph VSCode["VS Code"]

        MCP["Calva MCP Server"]

        subgraph Calva["Calva"]
            REPLClient["REPL Client"]
        end

        subgraph Project["Clojure Project"]

            subgraph RunningApp["Running Application"]
                SourceCode["Source Code"]
                REPL["REPL"]
            end
        end
    end

    User --> SourceCode
    User --> Calva
    REPLClient --> REPL
    AIAgent --> SourceCode
    AIAgent --> MCP
    MCP --> Calva

    classDef users fill:#ffffff,stroke:#63b132,stroke-width:1px,color:#63b132;
    classDef programmers fill:#63b132,stroke:#000000,stroke-width:2px,color:#ffffff;
    classDef vscode fill:#0078d7,stroke:#000000,stroke-width:1px,color:#ffffff;
    classDef calva fill:#df793b,stroke:#ffffff,stroke-width:1px,color:#ffffff;
    classDef highlight fill:#ffffff,stroke:#000000,stroke-width:1px,color:#000000;
    classDef dark fill:#333333,stroke:#ffffff,stroke-width:1px,color:#ffffff;
    classDef repl fill:#5881d8,stroke:#ffffff,stroke-width:1px,color:#ffffff;
    classDef running fill:#63b132,stroke:#ffffff,stroke-width:1px,color:#ffffff;
    classDef project fill:#888888,stroke:#ffffff,stroke-width:1px,color:#ffffff;

    class User,AIAgent users;
    class VSCode vscode;
    class Calva,MCP calva;
    class REPLClient repl;
    class Project project;
    class SourceCode dark;
    class RunningApp running;
    class REPL repl;
    class InteractiveProgrammers programmers;

WIP

This is a super early, bare bones, MCP server. Currently it only has one tool: evaluate-clojure-code. And currently that tool only evaluates code towards the current REPL connection. (Typically, whatever the REPL Window prompt would use.) Also, it only receives results, so the Agent does not see stdout/stderr output.

The “plan” (hope) is that the code evaluation tool will grow more sophisticated, and that we will expose much more of Calva's features.

Contributing

Contributions are welcome! Issues, PRs, whatever. Before a PR, we appreciate an issue stating the problem being solved. You may also want to reach out discussing the issue before starting to work on it.

License 🍻🗽

MIT

Sponsor my open source work ♥️

You are welcome to show me you like my work using this link:

相关推荐

  • av
  • Führen Sie mühelos LLM -Backends, APIs, Frontends und Dienste mit einem Befehl aus.

  • WangRongsheng
  • 🧑‍🚀 全世界最好的 llm 资料总结(数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Zusammenfassung der weltbesten LLM -Ressourcen.

  • 1Panel-dev
  • 🔥 1Panel bietet eine intuitive Weboberfläche und einen MCP -Server, um Websites, Dateien, Container, Datenbanken und LLMs auf einem Linux -Server zu verwalten.

  • rulego
  • ⛓️Rugele ist ein leichter, leistungsstarker, leistungsstarker, eingebetteter Komponenten-Orchestrierungsregel-Motor-Rahmen für GO.

  • Azure
  • Dieses Repository dient zur Entwicklung des Azure MCP -Servers, wodurch Ihre Agenten die Leistung von Azure verleiht.

  • caio-moliveira
  • Dieses Projekt wurde erstellt, um zu demonstrieren, wie wir uns mit verschiedenen Modellkontextprotokollen (MCPs) verbinden können.

  • MarcusAdriano
  • Estudando mcp usando eine api do bacen ptax

    Reviews

    2.9 (14)
    Avatar
    user_iwouHdbR
    2025-04-26

    Calva-MCP-Server by BetterThanTomorrow is a game-changer for developers. It significantly enhances productivity with its seamless integration and ease of use. The straightforward setup and robust performance make it a must-have tool for anyone looking to optimize their workflow. Highly recommend!

    Avatar
    user_tzpHHHWm
    2025-04-26

    As a dedicated user of the calva-mcp-server developed by BetterThanTomorrow, I can confidently say this product is exceptional. It seamlessly integrates into my workflow, providing robust performance and stability. The user-friendly interface and comprehensive features make it a top choice for developers. Highly recommended!

    Avatar
    user_OVFdtPIh
    2025-04-26

    I have been using the Calva-MCP-Server by BetterThanTomorrow and it has significantly improved my development workflow. The seamless integration and user-friendly interface make it a standout choice for any developer. Highly recommend giving it a try!

    Avatar
    user_oZ7CAVjv
    2025-04-26

    As a devoted user of the calva-mcp-server, I am thrilled with its seamless performance and reliability. Developed by BetterThanTomorrow, this server consistently exceeds my expectations with its innovative features and user-friendly interface. Highly recommended for anyone looking for top-notch MCP application support!

    Avatar
    user_5aAYnHUd
    2025-04-26

    As a loyal user of Calva-MCP-Server, developed by BetterThanTomorrow, I am thoroughly impressed by its performance and reliability. It offers seamless integration and an intuitive interface, making my workflow smoother and more efficient. Whether you're a developer or a system administrator, this tool is a game-changer. Highly recommended!

    Avatar
    user_QjNxWHwp
    2025-04-26

    Calva-MCP-Server is an outstanding tool developed by BetterThanTomorrow. It provides an intuitive and efficient environment for managing MCP applications. The server integration is seamless, making development smoother and more productive. As a dedicated user, I appreciate its robust performance and easy setup. Highly recommended for anyone serious about MCP application development!

    Avatar
    user_EqP17UoV
    2025-04-26

    As a dedicated user of calva-mcp-server, I can confidently say that this product by BetterThanTomorrow has significantly streamlined my MCP applications. The intuitive interface and robust features enhance productivity and make server management seamless. Highly recommended for anyone in need of a reliable MCP solution.

    Avatar
    user_2Yl5VKEd
    2025-04-26

    I've been using the Calva-MCP-Server by BetterThanTomorrow and it has significantly improved my workflow. The integration is seamless and the performance is outstanding. Whether you're a seasoned developer or just starting out, this server is a must-have. The support and documentation are top-notch, making it easy to get started and troubleshoot any issues. Highly recommend!

    Avatar
    user_wuUJDFrW
    2025-04-26

    As a dedicated user of the calva-mcp-server by BetterThanTomorrow, I can confidently say it has revolutionized my workflow. The integration is seamless, and it smoothly interfaces with other tools. Highly recommend for any serious developer!

    Avatar
    user_dasnRGwD
    2025-04-26

    I've been using calva-mcp-server from BetterThanTomorrow for a while now, and I must say it has significantly improved my workflow. The integration with my existing MCP applications is seamless, and the server performance is top-notch. Highly recommend this to anyone looking to streamline their MCP setup!

    Avatar
    user_tYnNWDFp
    2025-04-26

    Calva-MCP-Server by BetterThanTomorrow is a must-have for anyone leveraging the mcp protocol. This server offers seamless integration and enhances productivity manifold. The setup was straightforward, and it's been performing flawlessly. Highly recommend it for a smooth and efficient experience!

    Avatar
    user_AsEUpXKC
    2025-04-26

    As a dedicated user of calva-mcp-server by BetterThanTomorrow, I must say this tool has truly revolutionized my workflow. Its seamless integration and intuitive design make managing mcp applications a breeze. I highly recommend calva-mcp-server for anyone looking to enhance their productivity and streamline their processes.

    Avatar
    user_7VC3VdFN
    2025-04-26

    As a dedicated user of calva-mcp-server, I must say this product has significantly streamlined my development workflow. Created by BetterThanTomorrow, it's incredibly robust and user-friendly, making it the ideal tool for server management. The intuitive interface and reliable performance have exceeded my expectations, and I highly recommend it to anyone in need of an efficient MCP solution.

    Avatar
    user_0ecoLQJN
    2025-04-26

    The calva-mcp-server by BetterThanTomorrow is an outstanding product for anyone looking to improve their development workflow. Its seamless integration and robust features make it a pleasure to use. Highly recommended for all developers!