lean-lsp-mcp 0.1.7__py3-none-any.whl → 0.11.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lean_lsp_mcp/__init__.py +26 -1
- lean_lsp_mcp/client_utils.py +122 -0
- lean_lsp_mcp/file_utils.py +100 -0
- lean_lsp_mcp/instructions.py +16 -0
- lean_lsp_mcp/search_utils.py +142 -0
- lean_lsp_mcp/server.py +723 -272
- lean_lsp_mcp/utils.py +228 -10
- lean_lsp_mcp-0.11.2.dist-info/METADATA +569 -0
- lean_lsp_mcp-0.11.2.dist-info/RECORD +14 -0
- {lean_lsp_mcp-0.1.7.dist-info → lean_lsp_mcp-0.11.2.dist-info}/WHEEL +1 -1
- lean_lsp_mcp/prompts.py +0 -42
- lean_lsp_mcp-0.1.7.dist-info/METADATA +0 -191
- lean_lsp_mcp-0.1.7.dist-info/RECORD +0 -11
- {lean_lsp_mcp-0.1.7.dist-info → lean_lsp_mcp-0.11.2.dist-info}/entry_points.txt +0 -0
- {lean_lsp_mcp-0.1.7.dist-info → lean_lsp_mcp-0.11.2.dist-info}/licenses/LICENSE +0 -0
- {lean_lsp_mcp-0.1.7.dist-info → lean_lsp_mcp-0.11.2.dist-info}/top_level.txt +0 -0
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: lean-lsp-mcp
|
|
3
|
-
Version: 0.1.7
|
|
4
|
-
Summary: Lean Theorem Prover MCP
|
|
5
|
-
Author-email: Oliver Dressler <hey@oli.show>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Project-URL: Repository, https://github.com/oOo0oOo/lean-lsp-mcp
|
|
8
|
-
Requires-Python: >=3.10
|
|
9
|
-
Description-Content-Type: text/markdown
|
|
10
|
-
License-File: LICENSE
|
|
11
|
-
Requires-Dist: leanclient>=0.1.8
|
|
12
|
-
Requires-Dist: mcp[cli]>=1.5.0
|
|
13
|
-
Provides-Extra: lint
|
|
14
|
-
Requires-Dist: ruff>=0.2.0; extra == "lint"
|
|
15
|
-
Provides-Extra: dev
|
|
16
|
-
Requires-Dist: ruff>=0.2.0; extra == "dev"
|
|
17
|
-
Dynamic: license-file
|
|
18
|
-
|
|
19
|
-
<h1 align="center">
|
|
20
|
-
lean-lsp-mcp
|
|
21
|
-
</h1>
|
|
22
|
-
|
|
23
|
-
<h4 align="center">Lean Theorem Prover MCP</h4>
|
|
24
|
-
|
|
25
|
-
<p align="center">
|
|
26
|
-
<a href="https://pypi.org/project/lean-lsp-mcp/">
|
|
27
|
-
<img src="https://img.shields.io/pypi/v/lean-lsp-mcp.svg" alt="PyPI version" />
|
|
28
|
-
</a>
|
|
29
|
-
<a href="">
|
|
30
|
-
<img src="https://img.shields.io/github/last-commit/oOo0oOo/lean-lsp-mcp" alt="last update" />
|
|
31
|
-
</a>
|
|
32
|
-
<a href="https://github.com/oOo0oOo/lean-lsp-mcp/blob/master/LICENSE">
|
|
33
|
-
<img src="https://img.shields.io/github/license/oOo0oOo/lean-lsp-mcp.svg" alt="license" />
|
|
34
|
-
</a>
|
|
35
|
-
</p>
|
|
36
|
-
|
|
37
|
-
MCP 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).
|
|
38
|
-
|
|
39
|
-
**Currently beta testing**: Please help us by submitting bug reports, feedback and feature requests.
|
|
40
|
-
|
|
41
|
-
## Setup
|
|
42
|
-
|
|
43
|
-
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/), a Python package manager.
|
|
44
|
-
2. Add JSON configuration to your IDE/Setup.
|
|
45
|
-
3. Configure env variable LEAN_PROJECT_PATH.
|
|
46
|
-
|
|
47
|
-
### Install uv
|
|
48
|
-
|
|
49
|
-
[Install uv](https://docs.astral.sh/uv/getting-started/installation/) for your system.
|
|
50
|
-
|
|
51
|
-
E.g. on Linux/MacOS:
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### VSCode
|
|
58
|
-
|
|
59
|
-
VSCode and VSCode Insiders are supporting MCPs in [agent mode](https://code.visualstudio.com/blogs/2025/04/07/agentMode). For VSCode you might have to enable `Chat > Agent: Enable` in the settings.
|
|
60
|
-
|
|
61
|
-
1. One-click config setup:
|
|
62
|
-
|
|
63
|
-
[](https://insiders.vscode.dev/redirect/mcp/install?name=lean-lsp&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22lean-lsp-mcp%22%5D%2C%22env%22%3A%7B%22LEAN_PROJECT_PATH%22%3A%22path%2520to%2520lean%2520project%2520root%22%7D%7D)
|
|
64
|
-
|
|
65
|
-
[](https://insiders.vscode.dev/redirect/mcp/install?name=lean-lsp&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22lean-lsp-mcp%22%5D%2C%22env%22%3A%7B%22LEAN_PROJECT_PATH%22%3A%22path%2520to%2520lean%2520project%2520root%22%7D%7D&quality=insiders)
|
|
66
|
-
|
|
67
|
-
OR manually add config to `settings.json` (global):
|
|
68
|
-
|
|
69
|
-
```json
|
|
70
|
-
{
|
|
71
|
-
"mcp": {
|
|
72
|
-
"servers": {
|
|
73
|
-
"lean-lsp": {
|
|
74
|
-
"command": "uvx",
|
|
75
|
-
"args": ["lean-lsp-mcp"],
|
|
76
|
-
"env": {
|
|
77
|
-
"LEAN_PROJECT_PATH": "/path/to/lean/project"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
2. Next change the env variable `LEAN_PROJECT_PATH` to point to the root of your Lean project. This is required for the MCP to work. You can also remove this from the config and set this env variable differently.
|
|
86
|
-
|
|
87
|
-
3. Click "Start" above server config, open a Lean file, change to agent mode in the chat and run e.g. "auto proof" to get started:
|
|
88
|
-
|
|
89
|
-

|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
### Cursor
|
|
93
|
-
|
|
94
|
-
1. Open MCP Settings (File > Preferences > Cursor Settings > MCP)
|
|
95
|
-
|
|
96
|
-
2. "+ Add a new global MCP Server" > ("Create File")
|
|
97
|
-
|
|
98
|
-
3. Paste the server config into `mcp.json` file and adjust the `LEAN_PROJECT_PATH` to point to the root of your Lean project:
|
|
99
|
-
|
|
100
|
-
```json
|
|
101
|
-
{
|
|
102
|
-
"mcpServers": {
|
|
103
|
-
"lean-lsp": {
|
|
104
|
-
"command": "uvx",
|
|
105
|
-
"args": ["lean-lsp-mcp"],
|
|
106
|
-
"env": {
|
|
107
|
-
"LEAN_PROJECT_PATH": "/path/to/lean/project"
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
4. Open a Lean file and run e.g. "auto proof" in a new chat.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
### Other Setups
|
|
118
|
-
|
|
119
|
-
Other setups, such as [Claude Desktop](https://modelcontextprotocol.io/quickstart/user), [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#configure-mcp-servers) or [OpenAI Agent SDK](https://openai.github.io/openai-agents-python/mcp/) should work with similar configs (untested).
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
## Tools
|
|
123
|
-
|
|
124
|
-
Lean LSP MCP currently provides various tools to interact with the Lean LSP server:
|
|
125
|
-
|
|
126
|
-
### Meta tools
|
|
127
|
-
|
|
128
|
-
- **lean_auto_proof_instructions**:
|
|
129
|
-
Get detailed instructions on how to use the Lean LSP MCP to automatically prove theorems. This is a tool call because many clients do not support prompts yet, it is also available as a prompt.
|
|
130
|
-
|
|
131
|
-
### Core interactions
|
|
132
|
-
|
|
133
|
-
- **lean_diagnostic_messages**:
|
|
134
|
-
Get all diagnostic messages for a Lean file. This includes infos, warnings and errors.
|
|
135
|
-
|
|
136
|
-
- **lean_goal**:
|
|
137
|
-
Get the proof goal at a specific location in a Lean file.
|
|
138
|
-
|
|
139
|
-
- **lean_term_goal**:
|
|
140
|
-
Get the term goal at a specific position.
|
|
141
|
-
|
|
142
|
-
- **lean_hover_info**:
|
|
143
|
-
Retrieve hover information for symbols, terms, and expressions in a Lean file.
|
|
144
|
-
|
|
145
|
-
- **lean_completions**:
|
|
146
|
-
Code auto-completion: Find available identifiers or import suggestions.
|
|
147
|
-
|
|
148
|
-
- **lean_proofs_complete**:
|
|
149
|
-
Check if all proofs in a file are complete.
|
|
150
|
-
|
|
151
|
-
- **lean_leansearch**:
|
|
152
|
-
Search for theorems in Mathlib using leansearch.net (natural language search).
|
|
153
|
-
|
|
154
|
-
### File operations
|
|
155
|
-
|
|
156
|
-
- **lean_file_contents**:
|
|
157
|
-
Get the contents of a Lean file, optionally with line number annotations.
|
|
158
|
-
|
|
159
|
-
### Project-level tools
|
|
160
|
-
|
|
161
|
-
- **lean_project_path**:
|
|
162
|
-
Get the path to the current Lean project root directory.
|
|
163
|
-
|
|
164
|
-
- **lean_lsp_restart**:
|
|
165
|
-
Restart the LSP server and optionally rebuild the Lean project.
|
|
166
|
-
|
|
167
|
-
## Prompts
|
|
168
|
-
|
|
169
|
-
- **lean_auto_proof_instructions**:
|
|
170
|
-
Get detailed instructions on how to use the Lean LSP MCP to automatically prove theorems.
|
|
171
|
-
|
|
172
|
-
## Related Projects
|
|
173
|
-
|
|
174
|
-
- [LeanTool](https://github.com/GasStationManager/LeanTool): Provides an MCP "code interpreter" for Lean.
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
## License & Citation
|
|
178
|
-
|
|
179
|
-
**MIT** licensed. See [LICENSE](LICENSE) for more information.
|
|
180
|
-
|
|
181
|
-
Citing this repository is highly appreciated but not required by the license.
|
|
182
|
-
|
|
183
|
-
```bibtex
|
|
184
|
-
@software{lean-lsp-mcp,
|
|
185
|
-
author = {Oliver Dressler},
|
|
186
|
-
title = {{Lean LSP MCP: Tools for agentic interaction with the Lean theorem prover}},
|
|
187
|
-
url = {https://github.com/oOo0oOo/lean-lsp-mcp},
|
|
188
|
-
month = {3},
|
|
189
|
-
year = {2025}
|
|
190
|
-
}
|
|
191
|
-
```
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
lean_lsp_mcp/__init__.py,sha256=Rkb2xYCzeXHNuwIRfV6ssfHu9ACh1UXJ35helTKnGRM,64
|
|
2
|
-
lean_lsp_mcp/__main__.py,sha256=XnpTzfJc0T-j9tHtdkA8ovTr1c139ffTewcJGhxYDaM,49
|
|
3
|
-
lean_lsp_mcp/prompts.py,sha256=6jKmtTIvvbQlI103ovWnWs8XPTWNR_T3ahFT0vkLkiU,1839
|
|
4
|
-
lean_lsp_mcp/server.py,sha256=6bzCT_J3ZtinxIK9U2HaWzUEXUSOENEIU_SLLRmf1Q4,15679
|
|
5
|
-
lean_lsp_mcp/utils.py,sha256=CuoE-7wHw-4SvMthIDPa90zE47iuZqk4TS8cJs0n2N4,1347
|
|
6
|
-
lean_lsp_mcp-0.1.7.dist-info/licenses/LICENSE,sha256=CQlxnf0tQyoVrBE93JYvAUYxv6Z5Yg6sX0pwogOkFvo,1071
|
|
7
|
-
lean_lsp_mcp-0.1.7.dist-info/METADATA,sha256=BIuklsmfH6kSjJKOx556RDsgdmEp6RRbja6oTwHOjdo,6563
|
|
8
|
-
lean_lsp_mcp-0.1.7.dist-info/WHEEL,sha256=GHB6lJx2juba1wDgXDNlMTyM13ckjBMKf-OnwgKOCtA,91
|
|
9
|
-
lean_lsp_mcp-0.1.7.dist-info/entry_points.txt,sha256=nQbvwctWkWD7I-2f4VrdVQBZYGUw8CnUnFC6QjXxOSE,51
|
|
10
|
-
lean_lsp_mcp-0.1.7.dist-info/top_level.txt,sha256=LGEK0lgMSNPIQ6mG8EO-adaZEGPi_0daDs004epOTF0,13
|
|
11
|
-
lean_lsp_mcp-0.1.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|