lean-lsp-mcp 0.10.1__py3-none-any.whl → 0.10.3__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/server.py +51 -4
- {lean_lsp_mcp-0.10.1.dist-info → lean_lsp_mcp-0.10.3.dist-info}/METADATA +4 -4
- {lean_lsp_mcp-0.10.1.dist-info → lean_lsp_mcp-0.10.3.dist-info}/RECORD +7 -7
- {lean_lsp_mcp-0.10.1.dist-info → lean_lsp_mcp-0.10.3.dist-info}/WHEEL +0 -0
- {lean_lsp_mcp-0.10.1.dist-info → lean_lsp_mcp-0.10.3.dist-info}/entry_points.txt +0 -0
- {lean_lsp_mcp-0.10.1.dist-info → lean_lsp_mcp-0.10.3.dist-info}/licenses/LICENSE +0 -0
- {lean_lsp_mcp-0.10.1.dist-info → lean_lsp_mcp-0.10.3.dist-info}/top_level.txt +0 -0
lean_lsp_mcp/server.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import os
|
|
2
3
|
import re
|
|
3
4
|
import time
|
|
@@ -123,7 +124,7 @@ def rate_limited(category: str, max_requests: int, per_seconds: int):
|
|
|
123
124
|
|
|
124
125
|
# Project level tools
|
|
125
126
|
@mcp.tool("lean_build")
|
|
126
|
-
def lsp_build(ctx: Context, lean_project_path: str = None, clean: bool = False) -> str:
|
|
127
|
+
async def lsp_build(ctx: Context, lean_project_path: str = None, clean: bool = False) -> str:
|
|
127
128
|
"""Build the Lean project and restart the LSP Server.
|
|
128
129
|
|
|
129
130
|
Use only if needed (e.g. new imports).
|
|
@@ -152,13 +153,59 @@ def lsp_build(ctx: Context, lean_project_path: str = None, clean: bool = False)
|
|
|
152
153
|
subprocess.run(["lake", "clean"], cwd=lean_project_path_obj, check=False)
|
|
153
154
|
logger.info("Ran `lake clean`")
|
|
154
155
|
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
# Fetch cache
|
|
157
|
+
subprocess.run(["lake", "exe", "cache", "get"], cwd=lean_project_path_obj, check=False)
|
|
158
|
+
|
|
159
|
+
# Run build with progress reporting
|
|
160
|
+
process = await asyncio.create_subprocess_exec(
|
|
161
|
+
"lake", "build", "--verbose",
|
|
162
|
+
cwd=lean_project_path_obj,
|
|
163
|
+
stdout=asyncio.subprocess.PIPE,
|
|
164
|
+
stderr=asyncio.subprocess.STDOUT
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
output_lines = []
|
|
168
|
+
|
|
169
|
+
while True:
|
|
170
|
+
line = await process.stdout.readline()
|
|
171
|
+
if not line:
|
|
172
|
+
break
|
|
173
|
+
|
|
174
|
+
line_str = line.decode('utf-8', errors='replace').rstrip()
|
|
175
|
+
output_lines.append(line_str)
|
|
176
|
+
|
|
177
|
+
# Parse progress: look for pattern like "[2/8]" or "[10/100]"
|
|
178
|
+
match = re.search(r'\[(\d+)/(\d+)\]', line_str)
|
|
179
|
+
if match:
|
|
180
|
+
current_job = int(match.group(1))
|
|
181
|
+
total_jobs = int(match.group(2))
|
|
182
|
+
|
|
183
|
+
# Extract what's being built
|
|
184
|
+
# Line format: "ℹ [2/8] Built TestLeanBuild.Basic (1.6s)"
|
|
185
|
+
desc_match = re.search(r'\[\d+/\d+\]\s+(.+?)(?:\s+\(\d+\.?\d*[ms]+\))?$', line_str)
|
|
186
|
+
description = desc_match.group(1) if desc_match else "Building"
|
|
187
|
+
|
|
188
|
+
# Report progress using dynamic totals from Lake
|
|
189
|
+
await ctx.report_progress(
|
|
190
|
+
progress=current_job,
|
|
191
|
+
total=total_jobs,
|
|
192
|
+
message=description
|
|
193
|
+
)
|
|
194
|
+
|
|
195
|
+
await process.wait()
|
|
196
|
+
|
|
197
|
+
if process.returncode != 0:
|
|
198
|
+
build_output = "\n".join(output_lines)
|
|
199
|
+
raise Exception(f"Build failed with return code {process.returncode}")
|
|
200
|
+
|
|
201
|
+
# Start LSP client (without initial build since we just did it)
|
|
202
|
+
with OutputCapture():
|
|
203
|
+
client = LeanLSPClient(lean_project_path_obj, initial_build=False, prevent_cache_get=True)
|
|
157
204
|
|
|
158
205
|
logger.info("Built project and re-started LSP client")
|
|
159
206
|
|
|
160
207
|
ctx.request_context.lifespan_context.client = client
|
|
161
|
-
build_output =
|
|
208
|
+
build_output = "\n".join(output_lines)
|
|
162
209
|
return build_output
|
|
163
210
|
except Exception as e:
|
|
164
211
|
return f"Error during build:\n{str(e)}\n{build_output}"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lean-lsp-mcp
|
|
3
|
-
Version: 0.10.
|
|
3
|
+
Version: 0.10.3
|
|
4
4
|
Summary: Lean Theorem Prover MCP
|
|
5
5
|
Author-email: Oliver Dressler <hey@oli.show>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -8,8 +8,8 @@ Project-URL: Repository, https://github.com/oOo0oOo/lean-lsp-mcp
|
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
9
|
Description-Content-Type: text/markdown
|
|
10
10
|
License-File: LICENSE
|
|
11
|
-
Requires-Dist: leanclient==0.3.
|
|
12
|
-
Requires-Dist: mcp[cli]==1.
|
|
11
|
+
Requires-Dist: leanclient==0.3.1
|
|
12
|
+
Requires-Dist: mcp[cli]==1.19.0
|
|
13
13
|
Requires-Dist: orjson>=3.11.1
|
|
14
14
|
Provides-Extra: lint
|
|
15
15
|
Requires-Dist: ruff>=0.2.0; extra == "lint"
|
|
@@ -134,7 +134,7 @@ You can find more details about MCP server configuration for Claude Code [here](
|
|
|
134
134
|
|
|
135
135
|
#### Claude Skill: Lean4 Theorem Proving
|
|
136
136
|
|
|
137
|
-
If 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/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.
|
|
137
|
+
If 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.
|
|
138
138
|
|
|
139
139
|
### 4. Install ripgrep (optional but recommended)
|
|
140
140
|
|
|
@@ -4,11 +4,11 @@ lean_lsp_mcp/client_utils.py,sha256=mN0wQlGLMVR8bV0OqVJ8YHq6vUoty4MzebvA9A3u4dM,
|
|
|
4
4
|
lean_lsp_mcp/file_utils.py,sha256=6dVceZOCb28KsKtoub4QPD272TrtKzFZedg4H-N6KgA,2926
|
|
5
5
|
lean_lsp_mcp/instructions.py,sha256=qdGW1Qh14Gb_ezrMLU_SrS_F1X_r065KIsQu0HamwnU,825
|
|
6
6
|
lean_lsp_mcp/search_utils.py,sha256=cNpWzR1TuNyvRxCeCIb0HoEHGsCIW1ypqN1R1ZpbkdI,4170
|
|
7
|
-
lean_lsp_mcp/server.py,sha256=
|
|
7
|
+
lean_lsp_mcp/server.py,sha256=Nsm8NY_Oiq-JTAHrtcintZP7AudZfIL-72MOuCP2Ju8,29773
|
|
8
8
|
lean_lsp_mcp/utils.py,sha256=8wqjD5gfZhIkM1vLxvLoDkh-RQx_kDrxdRRUb1VQAbI,6040
|
|
9
|
-
lean_lsp_mcp-0.10.
|
|
10
|
-
lean_lsp_mcp-0.10.
|
|
11
|
-
lean_lsp_mcp-0.10.
|
|
12
|
-
lean_lsp_mcp-0.10.
|
|
13
|
-
lean_lsp_mcp-0.10.
|
|
14
|
-
lean_lsp_mcp-0.10.
|
|
9
|
+
lean_lsp_mcp-0.10.3.dist-info/licenses/LICENSE,sha256=CQlxnf0tQyoVrBE93JYvAUYxv6Z5Yg6sX0pwogOkFvo,1071
|
|
10
|
+
lean_lsp_mcp-0.10.3.dist-info/METADATA,sha256=_q8CLTiyHTAZ4bM6nCzLPLm_LDeoqI2_qe-87NoCVOw,17463
|
|
11
|
+
lean_lsp_mcp-0.10.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
12
|
+
lean_lsp_mcp-0.10.3.dist-info/entry_points.txt,sha256=nQbvwctWkWD7I-2f4VrdVQBZYGUw8CnUnFC6QjXxOSE,51
|
|
13
|
+
lean_lsp_mcp-0.10.3.dist-info/top_level.txt,sha256=LGEK0lgMSNPIQ6mG8EO-adaZEGPi_0daDs004epOTF0,13
|
|
14
|
+
lean_lsp_mcp-0.10.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|