Introducing the Coni Introspection Agent & MCP Server
Imagine sitting in your REPL, writing code, and suddenly forgetting how a standard library function works. Or maybe you need a quick algorithmic implementation, but you don’t want to switch context to a browser or a separate AI chat window.
What if your programming language itself could introspect its own codebase, write code for you, and evaluate it live in your REPL memory?
Today, we’re thrilled to introduce the Coni Introspection Agent—a natively integrated, tool-calling LLM agent built directly into the Coni language ecosystem. And because we know developers love their modern IDEs, we’ve also packaged it with a native Model Context Protocol (MCP) server.
Let’s dive into how you can use this powerhouse today.
Interactive REPL Magic
The Coni Introspection Agent can be invoked directly from your command line or the Coni REPL. It comes pre-equipped with tools to instantly search the Coni standard library, explore Go backend source files, and dynamically parse project configurations.
Here is what it looks like in action. Let’s ask it to write a recursive Fibonacci function and return only raw code so we can immediately inject it into our runtime:
nico@Karabiner-Nicolas coni-lang % rlwrap ./coni repl
[Server] Listening on :3333. Also starting local REPL shell...
______ ____ _ __ ____
/ ____// __ \/ | / // _/
/ / / / / / |/ / / /
/ /___ / /_/ / /| /_/ /
\____/ \____/_/ |_//___/
"Immutable by default."
coni> (require "libs/introspect/src/agent.coni" :as i)
coni> (def generated-code
... (i/introspect "Write a function that calculates fibonacci. REPLY WITH ONLY VALID CONI CODE. NO MARKDOWN."))
[Introspect] Agent is analyzing the codebase...
[Agent Tool Call] -> agent-search-codebase(map[query:fibonacci])
[Agent Tool Result] <- ./tests/archive/fib_test.coni:6:(defn fibonacci? [n?]...
[Agent Tool Call] -> ...
[Introspect] Response:
(defn fibonacci [n]
(if (<= n 1)
n
(+ (fibonacci (- n 1)) (fibonacci (- n 2)))))
#'generated-code
Notice what happened there? The agent autonomously decided to use its agent-search-codebase tool to grep the repository for existing Fibonacci implementations, learned the correct Clojure-like syntax for Coni, and returned a flawless recursive function.
Since we bound its response to generated-code, we can evaluate it directly in the REPL and test it live!
coni> (eval-string generated-code)
#'fibonacci
coni> (fibonacci 2)
1
coni> (fibonacci 3)
2
coni> (fibonacci 10)
55
Zero context switching. Total immersion.
The MCP Server: Bringing Coni to Cursor & Windsurf
We didn’t just want this to live in the terminal. We want the agent to be universally accessible wherever you write code.
By leveraging Coni’s native background HTTP and CSP channel capabilities, we’ve wrapped the introspection agent in a Model Context Protocol (MCP) server. This allows AI-first editors like Cursor, Windsurf, or even custom orchestrators like Agent Studio to interact directly with the Coni agent over SSE (Server-Sent Events).
sequenceDiagram
participant IDE as Cursor / Windsurf
participant MCP as Coni MCP Server (:8086)
participant Agent as Introspection Agent
participant Repo as Coni Source Code
IDE->>MCP: Query: "How do I implement HTTP in Coni?"
MCP->>Agent: Route Prompt via SSE
Agent->>Repo: Tool Call: agent-search-codebase("http server")
Repo-->>Agent: Grep results (libs/http/...)
Agent-->>MCP: LLM Formatted Response & Code
MCP-->>IDE: Stream Answer to Editor
Starting the MCP server is as simple as adding a flag:
nico@Karabiner-Nicolas coni-lang % ./coni inspect --serve
[Introspect] Starting MCP Server on port 8086
Once running, any MCP-compatible client can connect to http://localhost:8086/sse and seamlessly query the Coni agent. Your IDE’s AI assistant can now offload Coni-specific syntax questions, compiler backend investigations, and standard library searches directly to the dedicated Coni expert agent running locally on your machine.
The future of language development is AI-native. And with Coni, that future is already here.