lean-lsp-mcp 0.14.1__py3-none-any.whl → 0.16.0__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 +19 -0
- lean_lsp_mcp/instructions.py +31 -12
- lean_lsp_mcp/loogle.py +329 -0
- lean_lsp_mcp/models.py +120 -0
- lean_lsp_mcp/outline_utils.py +190 -59
- lean_lsp_mcp/server.py +666 -519
- lean_lsp_mcp/utils.py +31 -0
- {lean_lsp_mcp-0.14.1.dist-info → lean_lsp_mcp-0.16.0.dist-info}/METADATA +25 -3
- lean_lsp_mcp-0.16.0.dist-info/RECORD +17 -0
- lean_lsp_mcp-0.14.1.dist-info/RECORD +0 -15
- {lean_lsp_mcp-0.14.1.dist-info → lean_lsp_mcp-0.16.0.dist-info}/WHEEL +0 -0
- {lean_lsp_mcp-0.14.1.dist-info → lean_lsp_mcp-0.16.0.dist-info}/entry_points.txt +0 -0
- {lean_lsp_mcp-0.14.1.dist-info → lean_lsp_mcp-0.16.0.dist-info}/licenses/LICENSE +0 -0
- {lean_lsp_mcp-0.14.1.dist-info → lean_lsp_mcp-0.16.0.dist-info}/top_level.txt +0 -0
lean_lsp_mcp/utils.py
CHANGED
|
@@ -353,3 +353,34 @@ def deprecated(func_or_msg: str | Callable | None = None) -> Callable:
|
|
|
353
353
|
return _decorator
|
|
354
354
|
|
|
355
355
|
return _decorator(func_or_msg)
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
# LSP CompletionItemKind enum
|
|
359
|
+
# https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
|
|
360
|
+
COMPLETION_KIND: Dict[int, str] = {
|
|
361
|
+
1: "text",
|
|
362
|
+
2: "method",
|
|
363
|
+
3: "function",
|
|
364
|
+
4: "constructor",
|
|
365
|
+
5: "field",
|
|
366
|
+
6: "variable",
|
|
367
|
+
7: "class",
|
|
368
|
+
8: "interface",
|
|
369
|
+
9: "module",
|
|
370
|
+
10: "property",
|
|
371
|
+
11: "unit",
|
|
372
|
+
12: "value",
|
|
373
|
+
13: "enum",
|
|
374
|
+
14: "keyword",
|
|
375
|
+
15: "snippet",
|
|
376
|
+
16: "color",
|
|
377
|
+
17: "file",
|
|
378
|
+
18: "reference",
|
|
379
|
+
19: "folder",
|
|
380
|
+
20: "enum_member",
|
|
381
|
+
21: "constant",
|
|
382
|
+
22: "struct",
|
|
383
|
+
23: "event",
|
|
384
|
+
24: "operator",
|
|
385
|
+
25: "type_parameter",
|
|
386
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lean-lsp-mcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.16.0
|
|
4
4
|
Summary: Lean Theorem Prover MCP
|
|
5
5
|
Author-email: Oliver Dressler <hey@oli.show>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -8,8 +8,9 @@ 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.
|
|
12
|
-
Requires-Dist: mcp[cli]==1.
|
|
11
|
+
Requires-Dist: leanclient==0.6.1
|
|
12
|
+
Requires-Dist: mcp[cli]==1.23.1
|
|
13
|
+
Requires-Dist: mcp[cli]>=1.22.0
|
|
13
14
|
Requires-Dist: orjson>=3.11.1
|
|
14
15
|
Provides-Extra: lint
|
|
15
16
|
Requires-Dist: ruff>=0.2.0; extra == "lint"
|
|
@@ -348,6 +349,7 @@ Search for Lean definitions and theorems using [loogle.lean-lang.org](https://lo
|
|
|
348
349
|
|
|
349
350
|
- Supports queries by constant, lemma name, subexpression, type, or conclusion.
|
|
350
351
|
- Example: `Real.sin`, `"differ"`, `_ * (_ ^ _)`, `(?a -> ?b) -> List ?a -> List ?b`, `|- tsum _ = _ * tsum _`
|
|
352
|
+
- **Local mode available**: Use `--loogle-local` to run loogle locally (avoids rate limits, see [Local Loogle](#local-loogle) section)
|
|
351
353
|
|
|
352
354
|
<details>
|
|
353
355
|
<summary>Example output (`Real.sin`)</summary>
|
|
@@ -464,6 +466,8 @@ This MCP server works out-of-the-box without any configuration. However, a few o
|
|
|
464
466
|
- `LEAN_LSP_MCP_TOKEN`: Secret token for bearer authentication when using `streamable-http` or `sse` transport.
|
|
465
467
|
- `LEAN_STATE_SEARCH_URL`: URL for a self-hosted [premise-search.com](https://premise-search.com) instance.
|
|
466
468
|
- `LEAN_HAMMER_URL`: URL for a self-hosted [Lean Hammer Premise Search](https://github.com/hanwenzhu/lean-premise-server) instance.
|
|
469
|
+
- `LEAN_LOOGLE_LOCAL`: Set to `true`, `1`, or `yes` to enable local loogle (see [Local Loogle](#local-loogle) section).
|
|
470
|
+
- `LEAN_LOOGLE_CACHE_DIR`: Override the cache directory for local loogle (default: `~/.cache/lean-lsp-mcp/loogle`).
|
|
467
471
|
|
|
468
472
|
You can also often set these environment variables in your MCP client configuration:
|
|
469
473
|
<details>
|
|
@@ -519,6 +523,24 @@ uvx lean-lsp-mcp --transport streamable-http
|
|
|
519
523
|
|
|
520
524
|
Clients should then include the token in the `Authorization` header.
|
|
521
525
|
|
|
526
|
+
### Local Loogle
|
|
527
|
+
|
|
528
|
+
Run loogle locally to avoid the remote API's rate limit (3 req/30s). First run takes ~5-10 minutes to build; subsequent runs start in seconds.
|
|
529
|
+
|
|
530
|
+
```bash
|
|
531
|
+
# Enable via CLI
|
|
532
|
+
uvx lean-lsp-mcp --loogle-local
|
|
533
|
+
|
|
534
|
+
# Or via environment variable
|
|
535
|
+
export LEAN_LOOGLE_LOCAL=true
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
**Requirements:** `git`, `lake` ([elan](https://github.com/leanprover/elan)), ~2GB disk space.
|
|
539
|
+
|
|
540
|
+
**Note:** Local loogle is currently only supported on Unix systems (Linux/macOS). Windows users should use WSL or the remote API.
|
|
541
|
+
|
|
542
|
+
Falls back to remote API if local loogle fails.
|
|
543
|
+
|
|
522
544
|
## Notes on MCP Security
|
|
523
545
|
|
|
524
546
|
There are many valid security concerns with the Model Context Protocol (MCP) in general!
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
lean_lsp_mcp/__init__.py,sha256=MN_bNFyb5-p33JWWGbrlUYBd1UUMQKtZYGC9KCh2mtM,1403
|
|
2
|
+
lean_lsp_mcp/__main__.py,sha256=XnpTzfJc0T-j9tHtdkA8ovTr1c139ffTewcJGhxYDaM,49
|
|
3
|
+
lean_lsp_mcp/client_utils.py,sha256=HgPuB35rMitn2Xm8SCAErsFLq15trB6VMz3FDFgmPd8,4897
|
|
4
|
+
lean_lsp_mcp/file_utils.py,sha256=kCTYQSfmV-R2cm_NCi_L8W5Dcsm0_rTOPpTtpyAin78,1365
|
|
5
|
+
lean_lsp_mcp/instructions.py,sha256=S1y834V8v-SFSYJlxxy6Dj-Z0szMyEBT5SkEyM6Npr8,1756
|
|
6
|
+
lean_lsp_mcp/loogle.py,sha256=ChybtPM8jOxP8s28358yNqcLiYvGlQqkAEFFLzR87Zw,11971
|
|
7
|
+
lean_lsp_mcp/models.py,sha256=M8CmTg0_NL7KwcQ7UX_Zk7ZG1zXoWLINr41NPs_no2Y,4301
|
|
8
|
+
lean_lsp_mcp/outline_utils.py,sha256=-eoZNbx2eaKaYmuyFJnwUMWP8I9YXNWusue_2OYpDBM,10981
|
|
9
|
+
lean_lsp_mcp/search_utils.py,sha256=X2LPynDNLi767UDxbxHpMccOkbnfKJKv_HxvRNxIXM4,3984
|
|
10
|
+
lean_lsp_mcp/server.py,sha256=9Lr7uqG7uei1ygOS_k2h0yEu-4TGkHpIT9-UuDrYtJo,39164
|
|
11
|
+
lean_lsp_mcp/utils.py,sha256=355kzyB3dkwU7_4Mfcg--JXEorFaE2gtqs6-HbH5rRE,11722
|
|
12
|
+
lean_lsp_mcp-0.16.0.dist-info/licenses/LICENSE,sha256=CQlxnf0tQyoVrBE93JYvAUYxv6Z5Yg6sX0pwogOkFvo,1071
|
|
13
|
+
lean_lsp_mcp-0.16.0.dist-info/METADATA,sha256=EYEoi9FZTPAiuVqcmfdAsFtSX5I4UeaJWPJoTfYh9_A,20819
|
|
14
|
+
lean_lsp_mcp-0.16.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
15
|
+
lean_lsp_mcp-0.16.0.dist-info/entry_points.txt,sha256=nQbvwctWkWD7I-2f4VrdVQBZYGUw8CnUnFC6QjXxOSE,51
|
|
16
|
+
lean_lsp_mcp-0.16.0.dist-info/top_level.txt,sha256=LGEK0lgMSNPIQ6mG8EO-adaZEGPi_0daDs004epOTF0,13
|
|
17
|
+
lean_lsp_mcp-0.16.0.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
lean_lsp_mcp/__init__.py,sha256=lxqDq0G_sI2iu2Nniy-pTW7BE9Ux7ZXeDoGf0OAWIDc,763
|
|
2
|
-
lean_lsp_mcp/__main__.py,sha256=XnpTzfJc0T-j9tHtdkA8ovTr1c139ffTewcJGhxYDaM,49
|
|
3
|
-
lean_lsp_mcp/client_utils.py,sha256=HgPuB35rMitn2Xm8SCAErsFLq15trB6VMz3FDFgmPd8,4897
|
|
4
|
-
lean_lsp_mcp/file_utils.py,sha256=kCTYQSfmV-R2cm_NCi_L8W5Dcsm0_rTOPpTtpyAin78,1365
|
|
5
|
-
lean_lsp_mcp/instructions.py,sha256=GUOCDILr5N4H_kNE5hiXtzy4Sz9tu-BnE7Y0ktXIF9M,955
|
|
6
|
-
lean_lsp_mcp/outline_utils.py,sha256=bXBpLp_QnxmvwoP2y1juCYog2eln6329MAKuOXOz0-E,7807
|
|
7
|
-
lean_lsp_mcp/search_utils.py,sha256=X2LPynDNLi767UDxbxHpMccOkbnfKJKv_HxvRNxIXM4,3984
|
|
8
|
-
lean_lsp_mcp/server.py,sha256=qf0iRVeWrrvX91EmJsgbx7DW8kwn28zMs1WyfkxCh5A,37644
|
|
9
|
-
lean_lsp_mcp/utils.py,sha256=qY2Ef82SmD46y0IgyX1jimigkgr6Q8-Hrme-yUYSBGo,11094
|
|
10
|
-
lean_lsp_mcp-0.14.1.dist-info/licenses/LICENSE,sha256=CQlxnf0tQyoVrBE93JYvAUYxv6Z5Yg6sX0pwogOkFvo,1071
|
|
11
|
-
lean_lsp_mcp-0.14.1.dist-info/METADATA,sha256=XzcCebo_ZF4-alJTmjY5Cu2M7OpVgEJmCriT4Sl2CMw,19855
|
|
12
|
-
lean_lsp_mcp-0.14.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
lean_lsp_mcp-0.14.1.dist-info/entry_points.txt,sha256=nQbvwctWkWD7I-2f4VrdVQBZYGUw8CnUnFC6QjXxOSE,51
|
|
14
|
-
lean_lsp_mcp-0.14.1.dist-info/top_level.txt,sha256=LGEK0lgMSNPIQ6mG8EO-adaZEGPi_0daDs004epOTF0,13
|
|
15
|
-
lean_lsp_mcp-0.14.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|