{"id":32594093,"url":"https://github.com/oOo0oOo/lean-lsp-mcp","last_synced_at":"2025-10-30T02:06:01.031Z","repository":{"id":285399917,"uuid":"957012445","full_name":"oOo0oOo/lean-lsp-mcp","owner":"oOo0oOo","description":"Lean Theorem Prover MCP","archived":false,"fork":false,"pushed_at":"2025-10-21T03:10:25.000Z","size":856,"stargazers_count":141,"open_issues_count":4,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-10-23T07:24:51.735Z","etag":null,"topics":["lean4","lsp","mcp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oOo0oOo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-03-29T10:47:49.000Z","updated_at":"2025-10-21T22:19:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"6ffc0837-2b5b-4b53-85e7-cacbf9bf755c","html_url":"https://github.com/oOo0oOo/lean-lsp-mcp","commit_stats":null,"previous_names":["ooo0ooo/lean-lsp-mcp"],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/oOo0oOo/lean-lsp-mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oOo0oOo%2Flean-lsp-mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oOo0oOo%2Flean-lsp-mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oOo0oOo%2Flean-lsp-mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oOo0oOo%2Flean-lsp-mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oOo0oOo","download_url":"https://codeload.github.com/oOo0oOo/lean-lsp-mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oOo0oOo%2Flean-lsp-mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281542856,"owners_count":26519432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["lean4","lsp","mcp"],"created_at":"2025-10-30T02:02:48.261Z","updated_at":"2025-10-30T02:06:01.024Z","avatar_url":"https://github.com/oOo0oOo.png","language":"Python","funding_links":[],"categories":["Research \u0026 Science","📚 Projects (1974 total)","📦 Other","Python"],"sub_categories":["Wiki \u0026 Collaboration","MCP Servers"],"readme":"\u003ch1 align=\"center\"\u003e\n  lean-lsp-mcp\n\u003c/h1\u003e\n\n\u003ch3 align=\"center\"\u003eLean Theorem Prover MCP\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://pypi.org/project/lean-lsp-mcp/\"\u003e\n    \u003cimg src=\"https://img.shields.io/pypi/v/lean-lsp-mcp.svg\" alt=\"PyPI version\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/last-commit/oOo0oOo/lean-lsp-mcp\" alt=\"last update\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/oOo0oOo/lean-lsp-mcp/blob/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/oOo0oOo/lean-lsp-mcp.svg\" alt=\"license\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\nMCP server that allows agentic interaction with the [Lean theorem prover](https://lean-lang.org/) via the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/) using [leanclient](https://github.com/oOo0oOo/leanclient). This server provides a range of tools for LLM agents to understand, analyze and interact with Lean projects.\n\n## Key Features\n\n* **Rich Lean Interaction**: Access diagnostics, goal states, term information, hover documentation and more.\n* **External Search Tools**: Use `LeanSearch`, `Loogle`, `Lean Finder`, `Lean Hammer` and `Lean State Search` to find relevant theorems and definitions.\n* **Easy Setup**: Simple configuration for various clients, including VSCode, Cursor and Claude Code.\n\n## Setup\n\n### Overview\n\n1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/), a Python package manager.\n2. Make sure your Lean project builds quickly by running `lake build` manually.\n3. Configure your IDE/Setup\n4. (Optional, highly recommended) Install [ripgrep](https://github.com/BurntSushi/ripgrep?tab=readme-ov-file#installation) (`rg`) to reduce hallucinations using local search.\n\n### 1. Install uv\n\n[Install uv](https://docs.astral.sh/uv/getting-started/installation/) for your system. On Linux/MacOS: `curl -LsSf https://astral.sh/uv/install.sh | sh`\n\n### 2. Run `lake build`\n\n`lean-lsp-mcp` will run `lake serve` in the project root to use the language server (for most tools). Some clients (e.g. Cursor) might timeout during this process. Therefore, it is recommended to run `lake build` manually before starting the MCP. This ensures a faster build time and avoids timeouts.\n\n### 3. Configure your IDE/Setup\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eVSCode\u003c/b\u003e\u003c/summary\u003e\nOne-click config setup:\n\n[![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=flat-square\u0026logo=visualstudiocode\u0026logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=lean-lsp\u0026config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22lean-lsp-mcp%22%5D%7D)\n\n[![Install in VS Code Insiders](https://img.shields.io/badge/VS_Code_Insiders-Install_Server-24bfa5?style=flat-square\u0026logo=visualstudiocode\u0026logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=lean-lsp\u0026config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22lean-lsp-mcp%22%5D%7D\u0026quality=insiders)\n\nOR using the setup wizard:\n\nCtrl+Shift+P \u003e \"MCP: Add Server...\" \u003e \"Command (stdio)\" \u003e \"uvx lean-lsp-mcp\" \u003e \"lean-lsp\" (or any name you like) \u003e Global or Workspace\n\nOR manually add config to `mcp.json`:\n\n```jsonc\n{\n    \"servers\": {\n        \"lean-lsp\": {\n            \"type\": \"stdio\",\n            \"command\": \"uvx\",\n            \"args\": [\n                \"lean-lsp-mcp\"\n            ]\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eCursor\u003c/b\u003e\u003c/summary\u003e\n1. Open MCP Settings (File \u003e Preferences \u003e Cursor Settings \u003e MCP)\n\n2. \"+ Add a new global MCP Server\" \u003e (\"Create File\")\n\n3. Paste the server config into `mcp.json` file:\n\n```jsonc\n{\n    \"mcpServers\": {\n        \"lean-lsp\": {\n            \"command\": \"uvx\",\n            \"args\": [\"lean-lsp-mcp\"]\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eClaude Code\u003c/b\u003e\u003c/summary\u003e\nRun one of these commands in the root directory of your Lean project (where `lakefile.toml` is located):\n\n```bash\n# Local-scoped MCP server\nclaude mcp add lean-lsp uvx lean-lsp-mcp\n\n# OR project-scoped MCP server\n# (creates or updates a .mcp.json file in the current directory)\nclaude mcp add lean-lsp -s project uvx lean-lsp-mcp\n```\n\nYou can find more details about MCP server configuration for Claude Code [here](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#configure-mcp-servers).\n\u003c/details\u003e\n\n#### Claude Skill: Lean4 Theorem Proving\n\nIf you are using [Claude Desktop](https://modelcontextprotocol.io/quickstart/user) or [Claude Code](https://claude.ai/code), you can also install the [Lean4 Theorem Proving Skill](https://github.com/cameronfreer/lean4-skills/tree/main/plugins/lean4-theorem-proving). This skill provides additional prompts and templates for interacting with Lean4 projects and includes a section on interacting with the `lean-lsp-mcp` server.\n\n### 4. Install ripgrep (optional but recommended)\n\nFor the local search tool `lean_local_search`, install [ripgrep](https://github.com/BurntSushi/ripgrep?tab=readme-ov-file#installation) (`rg`) and make sure it is available in your PATH.\n\n## MCP Tools\n\n\n### File interactions (LSP)\n\n#### lean_file_contents\n\nGet the contents of a Lean file, optionally with line number annotations.\n\n#### lean_diagnostic_messages\n\nGet all diagnostic messages for a Lean file. This includes infos, warnings and errors.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output\u003c/summary\u003e\n\n```\nl20c42-l20c46, severity: 1\nsimp made no progress\n\nl21c11-l21c45, severity: 1\nfunction expected at\n  h_empty\nterm has type\n  T ∩ compl T = ∅\n\n...\n```\n\u003c/details\u003e\n\n#### lean_goal\n\nGet the proof goal at a specific location (line or line \u0026 column) in a Lean file.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output (line)\u003c/summary\u003e\n\n```\nBefore:\nS : Type u_1\ninst✝¹ : Fintype S\ninst✝ : Nonempty S\nP : Finset (Set S)\nhPP : ∀ T ∈ P, ∀ U ∈ P, T ∩ U ≠ ∅\nhPS : ¬∃ T ∉ P, ∀ U ∈ P, T ∩ U ≠ ∅\ncompl : Set S → Set S := fun T ↦ univ \\ T\nhcompl : ∀ T ∈ P, compl T ∉ P\nall_subsets : Finset (Set S) := Finset.univ\nh_comp_in_P : ∀ T ∉ P, compl T ∈ P\nh_partition : ∀ (T : Set S), T ∈ P ∨ compl T ∈ P\n⊢ P.card = 2 ^ (Fintype.card S - 1)\nAfter:\nno goals\n```\n\u003c/details\u003e\n\n#### lean_term_goal\n\nGet the term goal at a specific position (line \u0026 column) in a Lean file.\n\n#### lean_hover_info\n\nRetrieve hover information (documentation) for symbols, terms, and expressions in a Lean file (at a specific line \u0026 column).\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output (hover info on a `sorry`)\u003c/summary\u003e\n\n```\nThe `sorry` tactic is a temporary placeholder for an incomplete tactic proof,\nclosing the main goal using `exact sorry`.\n\nThis is intended for stubbing-out incomplete parts of a proof while still having a syntactically correct proof skeleton.\nLean will give a warning whenever a proof uses `sorry`, so you aren't likely to miss it,\nbut you can double check if a theorem depends on `sorry` by looking for `sorryAx` in the output\nof the `#print axioms my_thm` command, the axiom used by the implementation of `sorry`.\n```\n\u003c/details\u003e\n\n#### lean_declaration_file\n\nGet the file contents where a symbol or term is declared.\n\n#### lean_completions\n\nCode auto-completion: Find available identifiers or import suggestions at a specific position (line \u0026 column) in a Lean file.\n\n#### lean_run_code\n\nRun/compile an independent Lean code snippet/file and return the result or error message.\n\u003cdetails\u003e\n\u003csummary\u003eExample output (code snippet: `#eval 5 * 7 + 3`)\u003c/summary\u003e\n\n```\nl1c1-l1c6, severity: 3\n38\n```\n\u003c/details\u003e\n\n#### lean_multi_attempt\n\nAttempt multiple lean code snippets on a line and return goal state and diagnostics for each snippet.\nThis tool is useful to screen different proof attempts before using the most promising one.\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output (attempting `rw [Nat.pow_sub (Fintype.card_pos_of_nonempty S)]` and `by_contra h_neq`)\u003c/summary\u003e\n\n```\n  rw [Nat.pow_sub (Fintype.card_pos_of_nonempty S)]:\nS : Type u_1\ninst✝¹ : Fintype S\ninst✝ : Nonempty S\nP : Finset (Set S)\nhPP : ∀ T ∈ P, ∀ U ∈ P, T ∩ U ≠ ∅\nhPS : ¬∃ T ∉ P, ∀ U ∈ P, T ∩ U ≠ ∅\n⊢ P.card = 2 ^ (Fintype.card S - 1)\n\nl14c7-l14c51, severity: 1\nunknown constant 'Nat.pow_sub'\n\n  by_contra h_neq:\n S : Type u_1\ninst✝¹ : Fintype S\ninst✝ : Nonempty S\nP : Finset (Set S)\nhPP : ∀ T ∈ P, ∀ U ∈ P, T ∩ U ≠ ∅\nhPS : ¬∃ T ∉ P, ∀ U ∈ P, T ∩ U ≠ ∅\nh_neq : ¬P.card = 2 ^ (Fintype.card S - 1)\n⊢ False\n\n...\n```\n\u003c/details\u003e\n\n### Local Search Tools\n\n#### lean_local_search\n\nSearch for Lean definitions and theorems in the local Lean project and stdlib.\nThis is useful to confirm declarations actually exist and prevent hallucinating APIs.\n\nThis tool requires [ripgrep](https://github.com/BurntSushi/ripgrep?tab=readme-ov-file#installation) (`rg`) to be installed and available in your PATH.\n\n### External Search Tools\n\nCurrently most external tools are separately **rate limited to 3 requests per 30 seconds**. Please don't ruin the fun for everyone by overusing these amazing free services!\n\nPlease cite the original authors of these tools if you use them!\n\n#### lean_leansearch\n\nSearch for theorems in Mathlib using [leansearch.net](https://leansearch.net) (natural language search).\n\n[Github Repository](https://github.com/frenzymath/LeanSearch) | [Arxiv Paper](https://arxiv.org/abs/2403.13310)\n\n- Supports natural language, mixed queries, concepts, identifiers, and Lean terms.\n- Example: `bijective map from injective`, `n + 1 \u003c= m if n \u003c m`, `Cauchy Schwarz`, `List.sum`, `{f : A → B} (hf : Injective f) : ∃ h, Bijective h`\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output (query by LLM: `bijective map from injective`)\u003c/summary\u003e\n\n```json\n  {\n    \"module_name\": \"Mathlib.Logic.Function.Basic\",\n    \"kind\": \"theorem\",\n    \"name\": \"Function.Bijective.injective\",\n    \"signature\": \" {f : α → β} (hf : Bijective f) : Injective f\",\n    \"type\": \"∀ {α : Sort u_1} {β : Sort u_2} {f : α → β}, Function.Bijective f → Function.Injective f\",\n    \"value\": \":= hf.1\",\n    \"informal_name\": \"Bijectivity Implies Injectivity\",\n    \"informal_description\": \"For any function $f \\\\colon \\\\alpha \\\\to \\\\beta$, if $f$ is bijective, then $f$ is injective.\"\n  },\n  ...\n```\n\u003c/details\u003e\n\n#### lean_loogle\n\nSearch for Lean definitions and theorems using [loogle.lean-lang.org](https://loogle.lean-lang.org/).\n\n[Github Repository](https://github.com/nomeata/loogle)\n\n- Supports queries by constant, lemma name, subexpression, type, or conclusion.\n- Example: `Real.sin`, `\"differ\"`, `_ * (_ ^ _)`, `(?a -\u003e ?b) -\u003e List ?a -\u003e List ?b`, `|- tsum _ = _ * tsum _`\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output (`Real.sin`)\u003c/summary\u003e\n\n```json\n[\n  {\n    \"type\": \" (x : ℝ) : ℝ\",\n    \"name\": \"Real.sin\",\n    \"module\": \"Mathlib.Data.Complex.Trigonometric\"\n  },\n  ...\n]\n```\n\u003c/details\u003e\n\n#### lean_leanfinder\n\nSemantic search for Mathlib theorems using [Lean Finder](https://huggingface.co/spaces/delta-lab-ai/Lean-Finder).\n\n[Arxiv Paper](https://arxiv.org/abs/2510.15940)\n\n- Supports informal descriptions, user questions, proof states, and statement fragments.\n- Examples: `algebraic elements x,y over K with same minimal polynomial`, `Does y being a root of minpoly(x) imply minpoly(x)=minpoly(y)?`, `⊢ |re z| ≤ ‖z‖` + `transform to squared norm inequality`, `theorem restrict Ioi: restrict Ioi e = restrict Ici e`\n\n\u003cdetails\u003e\n\u003csummary\u003eExample output\u003c/summary\u003e\n\nQuery: `Does y being a root of minpoly(x) imply minpoly(x)=minpoly(y)?`\n\n```json\n  [\n    [\n      \"/-- If `y : L` is a root of `minpoly K x`, then `minpoly K y = minpoly K x`. -/\\ntheorem eq_of_root {x y : L} (hx : IsAlgebraic K x)\\n    (h_ev : Polynomial.aeval y (minpoly K x) = 0) : minpoly K y = minpoly K x :=\\n  ((eq_iff_aeval_minpoly_eq_zero hx.isIntegral).mpr h_ev).symm\",\n      \n      \"Let $L/K$ be a field extension, and let $x, y \\\\in L$ be elements such that $y$ is a root of the minimal polynomial of $x$ over $K$. If $x$ is algebraic over $K$, then the minimal polynomial of $y$ over $K$ is equal to the minimal polynomial of $x$ over $K$, i.e., $\\\\text{minpoly}_K(y) = \\\\text{minpoly}_K(x)$. This means that if $y$ satisfies the polynomial equation defined by $x$, then $y$ shares the same minimal polynomial as $x$.\"\n    ],\n    ...\n  ]\n```\n\u003c/details\u003e\n\n#### lean_state_search\n\nSearch for applicable theorems for the current proof goal using [premise-search.com](https://premise-search.com/).\n\n[Github Repository](https://github.com/ruc-ai4math/Premise-Retrieval) | [Arxiv Paper](https://arxiv.org/abs/2501.13959)\n\nA self-hosted version is [available](https://github.com/ruc-ai4math/LeanStateSearch) and encouraged. You can set an environment variable `LEAN_STATE_SEARCH_URL` to point to your self-hosted instance. It defaults to `https://premise-search.com`.\n\nUses the first goal at a given line and column.\nReturns a list of relevant theorems.\n\u003cdetails\u003e \u003csummary\u003eExample output (line 24, column 3)\u003c/summary\u003e\n\n```json\n[\n  {\n    \"name\": \"Nat.mul_zero\",\n    \"formal_type\": \"∀ (n : Nat), n * 0 = 0\",\n    \"module\": \"Init.Data.Nat.Basic\"\n  },\n  ...\n]\n```\n\u003c/details\u003e\n\n\n#### lean_hammer_premise\n\nSearch for relevant premises based on the current proof state using the [Lean Hammer Premise Search](https://github.com/hanwenzhu/lean-premise-server).\n\n[Github Repository](https://github.com/hanwenzhu/lean-premise-server) | [Arxiv Paper](https://arxiv.org/abs/2506.07477)\n\nA self-hosted version is [available](https://github.com/hanwenzhu/lean-premise-server) and encouraged. You can set an environment variable `LEAN_HAMMER_URL` to point to your self-hosted instance. It defaults to `http://leanpremise.net`.\n\nUses the first goal at a given line and column.\nReturns a list of relevant premises (theorems) that can be used to prove the goal.\n\nNote: We use a simplified version, [LeanHammer](https://github.com/JOSHCLUNE/LeanHammer) might have better premise search results.\n\u003cdetails\u003e\u003csummary\u003eExample output (line 24, column 3)\u003c/summary\u003e\n\n```json\n[\n  \"MulOpposite.unop_injective\",\n  \"MulOpposite.op_injective\",\n  \"WellFoundedLT.induction\",\n  ...\n]\n```\n\u003c/details\u003e\n\n### Project-level tools\n\n#### lean_build\n\nRebuild the Lean project and restart the Lean LSP server.\n\n### Disabling Tools\n\nMany clients allow the user to disable specific tools manually (e.g. lean_build).\n\n**VSCode**: Click on the Wrench/Screwdriver icon in the chat.\n\n**Cursor**: In \"Cursor Settings\" \u003e \"MCP\" click on the name of a tool to disable it (strikethrough).\n\n## MCP Configuration\n\nThis MCP server works out-of-the-box without any configuration. However, a few optional settings are available.\n\n### Environment Variables\n\n- `LEAN_LOG_LEVEL`: Log level for the server. Options are \"INFO\", \"WARNING\", \"ERROR\", \"NONE\". Defaults to \"INFO\".\n- `LEAN_PROJECT_PATH`: Path to your Lean project root. Set this if the server cannot automatically detect your project.\n- `LEAN_LSP_MCP_TOKEN`: Secret token for bearer authentication when using `streamable-http` or `sse` transport.\n- `LEAN_STATE_SEARCH_URL`: URL for a self-hosted [premise-search.com](https://premise-search.com) instance.\n- `LEAN_HAMMER_URL`: URL for a self-hosted [Lean Hammer Premise Search](https://github.com/hanwenzhu/lean-premise-server) instance.\n\nYou can also often set these environment variables in your MCP client configuration:\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eVSCode mcp.json Example\u003c/b\u003e\u003c/summary\u003e\n\n```jsonc\n{\n    \"servers\": {\n        \"lean-lsp\": {\n            \"type\": \"stdio\",\n            \"command\": \"uvx\",\n            \"args\": [\n                \"lean-lsp-mcp\"\n            ],\n            \"env\": {\n                \"LEAN_PROJECT_PATH\": \"/path/to/your/lean/project\",\n                \"LEAN_LOG_LEVEL\": \"NONE\"\n            }\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n### Transport Methods\n\nThe Lean LSP MCP server supports the following transport methods:\n\n- `stdio`: Standard input/output (default)\n- `streamable-http`: HTTP streaming\n- `sse`: Server-sent events (MCP legacy, use `streamable-http` if possible)\n\nYou can specify the transport method using the `--transport` argument when running the server. For `sse` and `streamable-http` you can also optionally specify the host and port:\n\n```bash\nuvx lean-lsp-mcp --transport stdio # Default transport\nuvx lean-lsp-mcp --transport streamable-http # Available at http://127.0.0.1:8000/mcp\nuvx lean-lsp-mcp --transport sse --host localhost --port 12345 # Available at http://localhost:12345/sse\n```\n\n### Bearer Token Authentication\n\nTransport via `streamable-http` and `sse` supports bearer token authentication. This allows publicly accessible MCP servers to restrict access to authorized clients.\n\nSet the `LEAN_LSP_MCP_TOKEN` environment variable (or see section 3 for setting env variables in MCP config) to a secret token before starting the server.\n\nExample Linux/MacOS setup:\n\n```bash\nexport LEAN_LSP_MCP_TOKEN=\"your_secret_token\"\nuvx lean-lsp-mcp --transport streamable-http\n```\n\nClients should then include the token in the `Authorization` header.\n\n## Notes on MCP Security\n\nThere are many valid security concerns with the Model Context Protocol (MCP) in general!\n\nThis MCP server is meant as a research tool and is currently in beta.\nWhile it does not handle any sensitive data such as passwords or API keys, it still includes various security risks:\n- Access to your local file system.\n- No input or output validation.\n\nPlease be aware of these risks. Feel free to audit the code and report security issues!\n\nFor more information, you can use [Awesome MCP Security](https://github.com/Puliczek/awesome-mcp-security) as a starting point.\n\n## Development\n\n### MCP Inspector\n\n```bash\nnpx @modelcontextprotocol/inspector uvx --with-editable path/to/lean-lsp-mcp python -m lean_lsp_mcp.server\n```\n\n### Run Tests\n\n```bash\nuv sync --all-extras\nuv run pytest tests\n```\n\n## Related Projects\n\n- [LeanTool](https://github.com/GasStationManager/LeanTool)\n- [LeanExplore MCP](https://www.leanexplore.com/docs/mcp)\n\n## License \u0026 Citation\n\n**MIT** licensed. See [LICENSE](LICENSE) for more information.\n\nCiting this repository is highly appreciated but not required by the license.\n\n```bibtex\n@software{lean-lsp-mcp,\n  author = {Oliver Dressler},\n  title = {{Lean LSP MCP: Tools for agentic interaction with the Lean theorem prover}},\n  url = {https://github.com/oOo0oOo/lean-lsp-mcp},\n  month = {3},\n  year = {2025}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FoOo0oOo%2Flean-lsp-mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FoOo0oOo%2Flean-lsp-mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FoOo0oOo%2Flean-lsp-mcp/lists"}