agda-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agda-mcp load and type-check src/Main.agda"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agda-mcp
MCP server for Agda, providing type checking, go-to-definition, case splitting, auto proof search, and more — directly from Claude Code or any MCP client.
Talks to agda --interaction-json (the same interface powering agda-mode in Emacs/VS Code), so it has access to all of Agda's interactive features without needing agda-language-server.
Installation
Prerequisites
1. Clone and build
git clone https://github.com/DreamLinuxer/agda-mcp.git
cd agda-mcp
uv sync2. Add to your MCP client
Claude Code (globally, for all projects):
claude mcp add --scope user agda-lsp -- uv run --directory /path/to/agda-mcp agda-mcpOther MCP clients — add to your client's MCP config:
{
"mcpServers": {
"agda-lsp": {
"command": "uv",
"args": ["run", "--directory", "/path/to/agda-mcp", "agda-mcp"],
"type": "stdio"
}
}
}Replace /path/to/agda-mcp with the absolute path where you cloned the repo.
Related MCP server: lean-lsp-mcp
Tools
File & navigation
Tool | Description |
| Load/type-check a file, get goals + errors + warnings |
| Symbol kind + definition site at a position |
| Go to definition (file:line:col) |
Goal manipulation (modify source)
Tool | Description |
| Fill a hole with a complete solution |
| Fill a hole with an elaborated solution |
| Refine a goal (may create new subgoals) |
| Introduce a constructor or lambda |
| Auto-choose between refine and intro |
| Case split on a variable in a goal |
| Try to automatically solve a goal |
| Solve a goal if determined by unification |
Goal inspection
Tool | Description |
| Get the type and context of a goal |
| Get just the type of a goal |
| Get the context (bindings) at a goal |
| Goal type + context + inferred type of expr |
| Goal type + context + check expr against type |
| Infer type of an expression at a goal |
| Normalize an expression at a goal |
| Generate helper function type for a goal |
| Explain where a name comes from (at a goal) |
| List module contents (at a goal) |
Toplevel commands
Tool | Description |
| Infer the type of an expression |
| Normalize/evaluate an expression |
| Explain where a name comes from |
| Show all unsolved constraints |
| Show all open goals/meta-variables |
| Search for definitions mentioning given names |
| List names exported by a module |
| Solve all goals determined by unification |
| Try to automatically solve all goals |
Usage examples
Load and type-check a file
agda_load("/path/to/file.agda")
→ Checked. No errors, warnings, or goals.Infer a type
agda_infer("/path/to/file.agda", "map")
→ {a b : Set} {n : ℕ} → (a → b) → Vec a n → Vec b nEvaluate an expression
agda_compute("/path/to/file.agda", "2 + 3")
→ 5Case split
agda_case_split("/path/to/file.agda", 0, "xs")
→ f [] = ?
f (x ∷ xs) = ?Auto-solve a goal
agda_auto("/path/to/file.agda", 0)
→ a , bHow it works
The server spawns a single persistent agda --interaction-json process and communicates via the IOTCM protocol over stdio. File state (highlighting data for go-to-definition, goal types, diagnostics) is cached per file and refreshed on each agda_load call.
Available Tools
30 toolsagda_autoB
Try to automatically solve a goal.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output)
Inputs: goal_id (required), file_path (required). Returns: result
agda_auto_allA
Try to automatically solve all visible goals.
Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file
Inputs: file_path (required). Returns: result
agda_case_splitA
Case split on a variable in a goal. Returns the new clauses.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) variable: The variable name to split on
Inputs: goal_id (required), variable (required), file_path (required). Returns: result
agda_computeA
Normalize (evaluate) an expression.
Args: file_path: Absolute path to the .agda file (for scope) expr: The expression to evaluate (e.g. "add 2 3")
Inputs: expr (required), file_path (required). Returns: result
agda_compute_in_goalA
Normalize (evaluate) an expression in the context of a specific goal.
Unlike agda_compute which works at top level, this evaluates within a goal's local context.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: The expression to evaluate
Inputs: expr (required), goal_id (required), file_path (required). Returns: result
agda_constraintsA
Show all current unsolved constraints.
Useful for debugging type errors or understanding what Agda is stuck on.
Args: file_path: Absolute path to the .agda file
Inputs: file_path (required). Returns: result
agda_contextA
Get the context (available bindings) at a specific goal/hole.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output)
Inputs: goal_id (required), file_path (required). Returns: result
agda_definitionB
Go to the definition of a symbol at a position.
Args: file_path: Absolute path to the .agda file line: Line number (1-based) character: Column number (1-based)
Inputs: line (required), character (required), file_path (required). Returns: result
agda_elaborate_giveA
Fill a goal/hole with an elaborated solution.
Like agda_give, but returns the fully elaborated (normalized) expression. Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: The expression to fill the hole with
Inputs: expr (required), goal_id (required), file_path (required). Returns: result
agda_giveA
Fill a goal/hole with a complete solution.
Agda will check the expression and, if correct, replace the hole in the source file. Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: The expression to fill the hole with
Inputs: expr (required), goal_id (required), file_path (required). Returns: result
agda_goal_infoA
Get the type and context of a specific goal/hole.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output)
Inputs: goal_id (required), file_path (required). Returns: result
agda_goal_typeA
Get the type of a specific goal/hole (without context).
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output)
Inputs: goal_id (required), file_path (required). Returns: result
agda_goal_type_context_checkB
Get goal type, context, and check an expression against the goal type.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: Expression to check against the goal type
Inputs: expr (required), goal_id (required), file_path (required). Returns: result
agda_goal_type_context_inferB
Get goal type, context, and the inferred type of an expression.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: Expression whose type to infer in this goal's context
Inputs: expr (required), goal_id (required), file_path (required). Returns: result
agda_helper_functionA
Generate a helper function type signature for a goal.
The expression should be a partial application like "h x y" where h is the helper name and x, y are arguments. Agda will generate the type signature for h. If empty, uses whatever is in the goal.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: Partial application (e.g. "helper x y")
Inputs: goal_id (required), file_path (required), expr. Returns: result
agda_hoverA
Get type/definition info for a symbol at a position.
Args: file_path: Absolute path to the .agda file line: Line number (1-based) character: Column number (1-based)
Inputs: line (required), character (required), file_path (required). Returns: result
agda_inferA
Infer the type of an expression in the context of a loaded file.
Args: file_path: Absolute path to the .agda file (for scope) expr: The expression to type-check (e.g. "add", "suc zero")
Inputs: expr (required), file_path (required). Returns: result
agda_infer_in_goalA
Infer the type of an expression in the context of a specific goal.
Unlike agda_infer which works at top level, this infers within a goal's local context (with access to locally-bound variables).
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: The expression to type-check
Inputs: expr (required), goal_id (required), file_path (required). Returns: result
agda_introA
Introduce a constructor or lambda abstraction in a goal.
Tries to fill the hole with an appropriate constructor or lambda. Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output)
Inputs: goal_id (required), file_path (required). Returns: result
agda_loadA
Load and type-check an Agda file. Returns goals, errors, and warnings.
This must be called before other commands. Call again after edits to refresh.
Args: file_path: Absolute path to the .agda file
Inputs: file_path (required). Returns: result
agda_metasA
Show all open meta-variables (goals) and their types.
Args: file_path: Absolute path to the .agda file
Inputs: file_path (required). Returns: result
agda_module_contentsB
List the top-level names exported by a module.
Args: file_path: Absolute path to the .agda file module_name: The module name to inspect (e.g. "Data.Nat", "Data.List")
Inputs: file_path (required), module_name (required). Returns: result
agda_module_contents_goalA
List the contents of a module, in the context of a goal.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) module_name: The module or record name to inspect
Inputs: goal_id (required), file_path (required), module_name (required). Returns: result
agda_refineA
Refine a goal by filling it with an expression that may create new subgoals.
If expr is empty, Agda tries to refine using the goal type. Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: Expression to refine with (can be empty)
Inputs: goal_id (required), file_path (required), expr. Returns: result
agda_refine_or_introA
Refine or introduce in a goal (auto-chooses the best action).
Combines refine and intro: tries to refine with the expression if given, otherwise introduces a constructor or lambda. Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) expr: Expression to refine with (can be empty for intro)
Inputs: goal_id (required), file_path (required), expr. Returns: result
agda_search_aboutA
Search for definitions whose type mentions the given names.
Useful for finding relevant lemmas, functions, or constructors.
Args: file_path: Absolute path to the .agda file query: Space-separated names to search for in types
Inputs: query (required), file_path (required). Returns: result
agda_solve_allA
Solve all goals whose solutions have been determined by unification.
Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file
Inputs: file_path (required). Returns: result
agda_solve_oneA
Solve a single goal if its solution has been determined by unification.
Only works if the goal has been fully instantiated (e.g. by constraints). Call agda_load afterwards to refresh goals.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output)
Inputs: goal_id (required), file_path (required). Returns: result
agda_why_in_scopeA
Explain where a name is brought into scope.
Args: file_path: Absolute path to the .agda file name: The name to look up (e.g. "ℕ", "suc", "add")
Inputs: name (required), file_path (required). Returns: result
agda_why_in_scope_goalA
Explain where a name is brought into scope, in the context of a goal.
Like agda_why_in_scope but with access to the goal's local scope.
Args: file_path: Absolute path to the .agda file goal_id: The goal/hole number (from agda_load output) name: The name to look up
Inputs: name (required), goal_id (required), file_path (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Many tools overlap significantly, especially the goal-info variants (agda_goal_info, agda_goal_type, agda_context, agda_goal_type_context_infer, agda_goal_type_context_check) and the top-level vs goal-local pairs (agda_infer vs agda_infer_in_goal, agda_compute vs agda_compute_in_goal, agda_why_in_scope vs agda_why_in_scope_goal). Agents will struggle to choose the correct tool among these near-duplicates.
All tools use the 'agda_' prefix and lowercase snake_case, with a mostly verb_noun structure (load, case_split, infer, compute, give, refine, intro, solve). A few names deviate (e.g., agda_definition, agda_goal_type_context_infer) but the overall pattern is predictable and consistent.
With 30 tools, the server exceeds the 25-tool threshold considered heavy. While the domain of Agda interaction is broad, many tools are redundant variants (e.g., agda_solve_one vs agda_solve_all, agda_auto vs agda_auto_all), suggesting the count could be trimmed without losing functionality.
The tool set covers the core Agda workflow well: loading files, inspecting goals, case splitting, giving/refining/intro, automatic solving, constraint/meta inspection, and module exploration. Minor gaps exist (e.g., no explicit 'revert' or 'abort' command), but agents can work around these with existing tools.
Maintenance
Related MCP Connectors
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Augments MCP Server - A comprehensive framework documentation provider for Claude Code
MCP server for progressive tool usage at any scale (see https://klavis.ai)
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA stateful Model Context Protocol server for interactive Agda proof development, enabling persistent sessions with goal-aware proof actions.24 npm1MIT
- AlicenseBqualityDmaintenanceMCP server for agentic interaction with the Lean theorem prover via LSP, providing tools for understanding, analyzing, and interacting with Lean projects.2123MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that bridges LLMs with the Rocq (Coq) proof assistant via LSP, enabling interactive theorem proving with AI.10Apache 2.0
- AlicenseAqualityBmaintenanceCode intelligence MCP server for Claude Code providing multi-project code graph, semantic search, session history, knowledge base, and web search.154MIT