warm-mcp 0.1.5__tar.gz
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.
- warm_mcp-0.1.5/.gitignore +4 -0
- warm_mcp-0.1.5/LICENSE +201 -0
- warm_mcp-0.1.5/PKG-INFO +67 -0
- warm_mcp-0.1.5/README.md +48 -0
- warm_mcp-0.1.5/pyproject.toml +39 -0
- warm_mcp-0.1.5/src/writerslogic_warm_mcp/__init__.py +146 -0
- warm_mcp-0.1.5/src/writerslogic_warm_mcp/__main__.py +5 -0
- warm_mcp-0.1.5/src/writerslogic_warm_mcp/checksums.json +9 -0
warm_mcp-0.1.5/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
warm_mcp-0.1.5/PKG-INFO
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: warm-mcp
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Launcher for the WARM MCP server (warm-mcp): private, on-device persistent memory for AI agents.
|
|
5
|
+
Project-URL: Homepage, https://writerslogic.com/warm/
|
|
6
|
+
Project-URL: Documentation, https://writerslogic.com/warm/docs/latest/integrations/mcp/
|
|
7
|
+
Project-URL: Repository, https://github.com/writerslogic/warm
|
|
8
|
+
Author-email: "WritersLogic, Inc." <david@writerslogic.com>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agent-memory,local-first,mcp,memory,model-context-protocol
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
<a href="https://writerslogic.com/warm/"><img src="https://raw.githubusercontent.com/writerslogic/warm/main/assets/crystal-halo/crystal-detailed-static.png" alt="WARM logo" width="96" align="left"></a>
|
|
21
|
+
|
|
22
|
+
# WARM MCP
|
|
23
|
+
|
|
24
|
+
<!-- mcp-name: io.github.writerslogic/warm-mcp -->
|
|
25
|
+
|
|
26
|
+
Persistent local memory for AI agents through the Model Context Protocol. The server stores memories on your machine and supports stdio and streamable HTTP transports.
|
|
27
|
+
|
|
28
|
+
[Website](https://writerslogic.com/warm/) · [Documentation](https://writerslogic.com/warm/docs/latest/integrations/mcp/) · [Source](https://github.com/writerslogic/warm) · [License](https://github.com/writerslogic/warm/blob/main/LICENSE)
|
|
29
|
+
|
|
30
|
+
<br clear="left">
|
|
31
|
+
|
|
32
|
+
## Run
|
|
33
|
+
|
|
34
|
+
Python 3.9 or newer is required for this launcher. Run it directly with `uvx`:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
uvx warm-mcp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The default stdio transport works with MCP clients that launch a local command. To share one server between clients, use streamable HTTP:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
uvx warm-mcp --transport http
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The HTTP endpoint defaults to `http://127.0.0.1:8765/mcp`. See the [MCP guide](https://writerslogic.com/warm/docs/latest/integrations/mcp/) for client configuration, storage locations, encryption, authentication, and available flags.
|
|
47
|
+
|
|
48
|
+
## What the server provides
|
|
49
|
+
|
|
50
|
+
| Tool | Purpose |
|
|
51
|
+
| --- | --- |
|
|
52
|
+
| `remember` | Save or update a memory. |
|
|
53
|
+
| `recall` | Find memories relevant to a query. |
|
|
54
|
+
| `search` | Search with explicit filters and ranking options. |
|
|
55
|
+
| `get`, `list` | Read one memory or page through a store. |
|
|
56
|
+
| `forget` | Delete selected memories. |
|
|
57
|
+
| `stats`, `export` | Inspect and export a store. |
|
|
58
|
+
|
|
59
|
+
The server also exposes memory resources and prompts. Memories persist across client sessions. By default, recall uses lexical search; semantic recall requires a build configured with a local embedding model.
|
|
60
|
+
|
|
61
|
+
## Launcher and binary
|
|
62
|
+
|
|
63
|
+
The package installs a small Python launcher. On first run, it downloads the matching prebuilt `warm-mcp` binary from the [GitHub release](https://github.com/writerslogic/warm/releases) and verifies its SHA-256 against a checksum table shipped in the package. The server itself runs locally; the launcher needs network access for that first binary download.
|
|
64
|
+
|
|
65
|
+
Set `WARM_MCP_BINARY` to run your own `warm-mcp` build. `WARM_MCP_CACHE_DIR` changes the download cache. The [MCP guide](https://writerslogic.com/warm/docs/latest/integrations/mcp/) covers the server's `WARM_MCP_*` configuration variables.
|
|
66
|
+
|
|
67
|
+
The same launcher is [available on npm](https://www.npmjs.com/package/writerslogic-warm-mcp).
|
warm_mcp-0.1.5/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<a href="https://writerslogic.com/warm/"><img src="https://raw.githubusercontent.com/writerslogic/warm/main/assets/crystal-halo/crystal-detailed-static.png" alt="WARM logo" width="96" align="left"></a>
|
|
2
|
+
|
|
3
|
+
# WARM MCP
|
|
4
|
+
|
|
5
|
+
<!-- mcp-name: io.github.writerslogic/warm-mcp -->
|
|
6
|
+
|
|
7
|
+
Persistent local memory for AI agents through the Model Context Protocol. The server stores memories on your machine and supports stdio and streamable HTTP transports.
|
|
8
|
+
|
|
9
|
+
[Website](https://writerslogic.com/warm/) · [Documentation](https://writerslogic.com/warm/docs/latest/integrations/mcp/) · [Source](https://github.com/writerslogic/warm) · [License](https://github.com/writerslogic/warm/blob/main/LICENSE)
|
|
10
|
+
|
|
11
|
+
<br clear="left">
|
|
12
|
+
|
|
13
|
+
## Run
|
|
14
|
+
|
|
15
|
+
Python 3.9 or newer is required for this launcher. Run it directly with `uvx`:
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
uvx warm-mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The default stdio transport works with MCP clients that launch a local command. To share one server between clients, use streamable HTTP:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
uvx warm-mcp --transport http
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The HTTP endpoint defaults to `http://127.0.0.1:8765/mcp`. See the [MCP guide](https://writerslogic.com/warm/docs/latest/integrations/mcp/) for client configuration, storage locations, encryption, authentication, and available flags.
|
|
28
|
+
|
|
29
|
+
## What the server provides
|
|
30
|
+
|
|
31
|
+
| Tool | Purpose |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `remember` | Save or update a memory. |
|
|
34
|
+
| `recall` | Find memories relevant to a query. |
|
|
35
|
+
| `search` | Search with explicit filters and ranking options. |
|
|
36
|
+
| `get`, `list` | Read one memory or page through a store. |
|
|
37
|
+
| `forget` | Delete selected memories. |
|
|
38
|
+
| `stats`, `export` | Inspect and export a store. |
|
|
39
|
+
|
|
40
|
+
The server also exposes memory resources and prompts. Memories persist across client sessions. By default, recall uses lexical search; semantic recall requires a build configured with a local embedding model.
|
|
41
|
+
|
|
42
|
+
## Launcher and binary
|
|
43
|
+
|
|
44
|
+
The package installs a small Python launcher. On first run, it downloads the matching prebuilt `warm-mcp` binary from the [GitHub release](https://github.com/writerslogic/warm/releases) and verifies its SHA-256 against a checksum table shipped in the package. The server itself runs locally; the launcher needs network access for that first binary download.
|
|
45
|
+
|
|
46
|
+
Set `WARM_MCP_BINARY` to run your own `warm-mcp` build. `WARM_MCP_CACHE_DIR` changes the download cache. The [MCP guide](https://writerslogic.com/warm/docs/latest/integrations/mcp/) covers the server's `WARM_MCP_*` configuration variables.
|
|
47
|
+
|
|
48
|
+
The same launcher is [available on npm](https://www.npmjs.com/package/writerslogic-warm-mcp).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Copyright 2024-2026 WritersLogic Contributors
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ["hatchling>=1.27"]
|
|
5
|
+
build-backend = "hatchling.build"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "warm-mcp"
|
|
9
|
+
version = "0.1.5"
|
|
10
|
+
description = "Launcher for the WARM MCP server (warm-mcp): private, on-device persistent memory for AI agents."
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
requires-python = ">=3.9"
|
|
13
|
+
license = "Apache-2.0"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
authors = [{ name = "WritersLogic, Inc.", email = "david@writerslogic.com" }]
|
|
16
|
+
keywords = ["mcp", "model-context-protocol", "memory", "agent-memory", "local-first"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"License :: OSI Approved :: Apache Software License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Operating System :: MacOS",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Operating System :: Microsoft :: Windows",
|
|
23
|
+
]
|
|
24
|
+
dependencies = []
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://writerslogic.com/warm/"
|
|
28
|
+
Documentation = "https://writerslogic.com/warm/docs/latest/integrations/mcp/"
|
|
29
|
+
Repository = "https://github.com/writerslogic/warm"
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
warm-mcp = "writerslogic_warm_mcp:main"
|
|
33
|
+
writerslogic-warm-mcp = "writerslogic_warm_mcp:main"
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/writerslogic_warm_mcp"]
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.sdist]
|
|
39
|
+
include = ["src/writerslogic_warm_mcp", "README.md", "LICENSE"]
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# Copyright 2024-2026 WritersLogic Contributors
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
"""Launcher for the warm-mcp binary.
|
|
4
|
+
|
|
5
|
+
Finds, or downloads and verifies, the prebuilt binary for this platform, then runs it with stdio
|
|
6
|
+
inherited so the MCP stdio transport passes straight through. Standard library only.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import hashlib
|
|
12
|
+
import json
|
|
13
|
+
import os
|
|
14
|
+
import platform
|
|
15
|
+
import stat
|
|
16
|
+
import subprocess
|
|
17
|
+
import sys
|
|
18
|
+
import tempfile
|
|
19
|
+
import urllib.parse
|
|
20
|
+
import urllib.request
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
__version__ = "0.1.5"
|
|
24
|
+
|
|
25
|
+
TARGETS = {
|
|
26
|
+
("darwin", "arm64"): "aarch64-apple-darwin",
|
|
27
|
+
("darwin", "x86_64"): "x86_64-apple-darwin",
|
|
28
|
+
("linux", "x86_64"): "x86_64-unknown-linux-gnu",
|
|
29
|
+
("linux", "aarch64"): "aarch64-unknown-linux-gnu",
|
|
30
|
+
("windows", "amd64"): "x86_64-pc-windows-msvc",
|
|
31
|
+
("windows", "x86_64"): "x86_64-pc-windows-msvc",
|
|
32
|
+
}
|
|
33
|
+
MAX_BYTES = 256 * 1024 * 1024
|
|
34
|
+
_LOOPBACK = {"localhost", "127.0.0.1", "::1"}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _fail(message: str) -> "NoReturn": # noqa: F821
|
|
38
|
+
sys.stderr.write(f"writerslogic-warm-mcp: {message}\n")
|
|
39
|
+
raise SystemExit(1)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _triple() -> str:
|
|
43
|
+
key = (platform.system().lower(), platform.machine().lower())
|
|
44
|
+
triple = TARGETS.get(key)
|
|
45
|
+
if triple is None:
|
|
46
|
+
_fail(
|
|
47
|
+
f"no prebuilt warm-mcp for {key[0]}-{key[1]}; build it with cargo "
|
|
48
|
+
"(--features mcp) and set WARM_MCP_BINARY"
|
|
49
|
+
)
|
|
50
|
+
return triple
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _cache_dir() -> Path:
|
|
54
|
+
override = os.environ.get("WARM_MCP_CACHE_DIR")
|
|
55
|
+
if override:
|
|
56
|
+
return Path(override)
|
|
57
|
+
home = Path.home()
|
|
58
|
+
system = platform.system().lower()
|
|
59
|
+
if system == "darwin":
|
|
60
|
+
return home / "Library" / "Caches" / "writerslogic-warm-mcp"
|
|
61
|
+
if system == "windows":
|
|
62
|
+
base = os.environ.get("LOCALAPPDATA") or str(home / "AppData" / "Local")
|
|
63
|
+
return Path(base) / "writerslogic-warm-mcp"
|
|
64
|
+
return Path(os.environ.get("XDG_CACHE_HOME") or home / ".cache") / "writerslogic-warm-mcp"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def _sha256(path: Path) -> str:
|
|
68
|
+
digest = hashlib.sha256()
|
|
69
|
+
with path.open("rb") as handle:
|
|
70
|
+
for block in iter(lambda: handle.read(1 << 20), b""):
|
|
71
|
+
digest.update(block)
|
|
72
|
+
return digest.hexdigest()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _expected_checksum(triple: str) -> str:
|
|
76
|
+
override = os.environ.get("WARM_MCP_CHECKSUMS")
|
|
77
|
+
table_path = Path(override) if override else Path(__file__).with_name("checksums.json")
|
|
78
|
+
try:
|
|
79
|
+
table = json.loads(table_path.read_text())
|
|
80
|
+
except (OSError, ValueError):
|
|
81
|
+
_fail(
|
|
82
|
+
f"no checksum table at {table_path}; this package was not built for release. "
|
|
83
|
+
"Set WARM_MCP_BINARY to a binary you trust."
|
|
84
|
+
)
|
|
85
|
+
digest = (table.get("assets") or {}).get(triple, "")
|
|
86
|
+
if len(digest) != 64 or any(c not in "0123456789abcdef" for c in digest):
|
|
87
|
+
_fail(f"checksum table has no valid entry for {triple}")
|
|
88
|
+
return digest
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _download(url: str, destination: Path) -> None:
|
|
92
|
+
parsed = urllib.parse.urlparse(url)
|
|
93
|
+
if parsed.scheme != "https" and not (parsed.scheme == "http" and parsed.hostname in _LOOPBACK):
|
|
94
|
+
raise RuntimeError("refusing a non-HTTPS download from a non-loopback host")
|
|
95
|
+
request = urllib.request.Request(url, headers={"User-Agent": f"writerslogic-warm-mcp/{__version__}"})
|
|
96
|
+
size = 0
|
|
97
|
+
with urllib.request.urlopen(request, timeout=60) as response, destination.open("wb") as out:
|
|
98
|
+
while True:
|
|
99
|
+
block = response.read(1 << 20)
|
|
100
|
+
if not block:
|
|
101
|
+
break
|
|
102
|
+
size += len(block)
|
|
103
|
+
if size > MAX_BYTES:
|
|
104
|
+
raise RuntimeError("download exceeds the size limit")
|
|
105
|
+
out.write(block)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def ensure_binary() -> str:
|
|
109
|
+
override = os.environ.get("WARM_MCP_BINARY")
|
|
110
|
+
if override:
|
|
111
|
+
return override
|
|
112
|
+
triple = _triple()
|
|
113
|
+
exe = ".exe" if platform.system().lower() == "windows" else ""
|
|
114
|
+
directory = _cache_dir() / __version__ / triple
|
|
115
|
+
binary = directory / f"warm-mcp{exe}"
|
|
116
|
+
expected = _expected_checksum(triple)
|
|
117
|
+
if binary.exists() and _sha256(binary) == expected:
|
|
118
|
+
return str(binary)
|
|
119
|
+
base = os.environ.get("WARM_MCP_RELEASE_BASE") or (
|
|
120
|
+
f"https://github.com/writerslogic/warm/releases/download/mcp-v{__version__}"
|
|
121
|
+
)
|
|
122
|
+
url = f"{base.rstrip('/')}/warm-mcp-{triple}{exe}"
|
|
123
|
+
directory.mkdir(parents=True, exist_ok=True, mode=0o700)
|
|
124
|
+
sys.stderr.write(f"writerslogic-warm-mcp: downloading {url}\n")
|
|
125
|
+
handle, partial_name = tempfile.mkstemp(prefix=".download-", dir=directory)
|
|
126
|
+
os.close(handle)
|
|
127
|
+
partial = Path(partial_name)
|
|
128
|
+
try:
|
|
129
|
+
_download(url, partial)
|
|
130
|
+
actual = _sha256(partial)
|
|
131
|
+
if actual != expected:
|
|
132
|
+
raise RuntimeError(f"checksum mismatch: expected {expected}, got {actual}")
|
|
133
|
+
partial.chmod(partial.stat().st_mode | stat.S_IXUSR)
|
|
134
|
+
os.replace(partial, binary)
|
|
135
|
+
except Exception as error: # noqa: BLE001 - report any failure once, then exit
|
|
136
|
+
partial.unlink(missing_ok=True)
|
|
137
|
+
_fail(f"download failed: {error}")
|
|
138
|
+
return str(binary)
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def main() -> None:
|
|
142
|
+
binary = ensure_binary()
|
|
143
|
+
arguments = [binary, *sys.argv[1:]]
|
|
144
|
+
if os.name == "nt":
|
|
145
|
+
raise SystemExit(subprocess.call(arguments))
|
|
146
|
+
os.execv(binary, arguments)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"assets": {
|
|
3
|
+
"aarch64-apple-darwin": "af3c1caa85b2d7559b27a343ee66cf5a93ed6fc77dcea6d0336113969f2252ef",
|
|
4
|
+
"x86_64-apple-darwin": "c9ef79ebe276536281ff261e338333d22f8f0ddfaa5f7cd0514f95326c205e40",
|
|
5
|
+
"x86_64-unknown-linux-gnu": "4871843e9c1210cb1700c95c99cfb1b6ad9dfed6bd3f826240f0c37634ea7343",
|
|
6
|
+
"aarch64-unknown-linux-gnu": "7a29ee9805d2a0e40d5c5f6866db188836bd65f7927dc472683702227c235344",
|
|
7
|
+
"x86_64-pc-windows-msvc": "e9c0289a79fca6c2c71fb62ee6a7b9cf519204d0732e53015ae13eb4dbcbb997"
|
|
8
|
+
}
|
|
9
|
+
}
|