python-substack 0.1.19__tar.gz → 0.1.21__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.
@@ -1,24 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-substack
3
- Version: 0.1.19
3
+ Version: 0.1.21
4
4
  Summary: A Python wrapper around the Substack API.
5
5
  License: MIT
6
6
  License-File: LICENSE
7
7
  Keywords: substack
8
8
  Author: Paolo Mazza
9
9
  Author-email: mazzapaolo2019@gmail.com
10
- Requires-Python: >=3.9
10
+ Requires-Python: >=3.10,<4.0
11
11
  Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Programming Language :: Python :: 3
13
- Classifier: Programming Language :: Python :: 3.9
14
13
  Classifier: Programming Language :: Python :: 3.10
15
14
  Classifier: Programming Language :: Python :: 3.11
16
15
  Classifier: Programming Language :: Python :: 3.12
17
16
  Classifier: Programming Language :: Python :: 3.13
18
17
  Classifier: Programming Language :: Python :: 3.14
19
18
  Requires-Dist: PyYAML (>=6.0,<7.0)
20
- Requires-Dist: python-dotenv (>=0.21.0,<0.22.0)
21
- Requires-Dist: requests (>=2.31.0,<3.0.0)
19
+ Requires-Dist: python-dotenv (>=1.2.1,<2.0.0)
20
+ Requires-Dist: requests (>=2.32.0,<3.0.0)
22
21
  Project-URL: Homepage, https://github.com/ma2za/python-substack
23
22
  Project-URL: Repository, https://github.com/ma2za/python-substack
24
23
  Description-Content-Type: text/markdown
@@ -38,6 +37,12 @@ You can install python-substack using:
38
37
 
39
38
  $ pip install python-substack
40
39
 
40
+ For the MCP server tools, install the extra dependency set:
41
+
42
+ $ poetry install --with mcp
43
+
44
+ > NOTE: We had to upgrade the package requirements to support Python 3.10 because 3.9 is basically vintage now. If you still run 3.9, please join us in the future (or bring snacks).
45
+
41
46
  ---
42
47
 
43
48
  # Setup
@@ -237,7 +242,14 @@ for _, item in body.items():
237
242
  post.add(item)
238
243
 
239
244
  draft = api.post_draft(post.get_draft())
240
- api.put_draft(draft.get("id"), draft_section_id=post.draft_section_id)
245
+ put_draft_kwargs = {
246
+ "draft_section_id": post.draft_section_id,
247
+ "search_engine_title": post_data.get("search_engine_title"),
248
+ "search_engine_description": post_data.get("search_engine_description"),
249
+ "slug": post_data.get("slug"),
250
+ }
251
+ put_draft_kwargs = {k: v for k, v in put_draft_kwargs.items() if v is not None}
252
+ api.put_draft(draft.get("id"), **put_draft_kwargs)
241
253
 
242
254
  # Publish the draft
243
255
  api.prepublish_draft(draft.get("id"))
@@ -265,6 +277,22 @@ body:
265
277
  src: "local_image.jpg" # Local images will be uploaded automatically
266
278
  ```
267
279
 
280
+ ## MCP FastMCP server
281
+
282
+ This package now includes a FastMCP server in `substack/mcp_fastmcp.py` with the following tools:
283
+
284
+ - `post_draft_from_markdown(...)`: create draft from markdown, optional tag/add/prepublish/publish, and control send/share_automatically.
285
+ - `put_draft(draft_id, update_payload)`: update draft fields.
286
+ - `add_tags(draft_id, tags)`: add tags to a draft/post.
287
+ - `prepublish_draft(draft_id)`: prepublish a draft.
288
+ - `publish_draft(draft_id, send=True, share_automatically=False)`: publish a draft.
289
+
290
+ Use via stdio transport:
291
+
292
+ ```bash
293
+ python -c "from substack.mcp_fastmcp import main; main()"
294
+ ```
295
+
268
296
  # Contributing
269
297
 
270
298
  Install pre-commit:
@@ -13,6 +13,12 @@ You can install python-substack using:
13
13
 
14
14
  $ pip install python-substack
15
15
 
16
+ For the MCP server tools, install the extra dependency set:
17
+
18
+ $ poetry install --with mcp
19
+
20
+ > NOTE: We had to upgrade the package requirements to support Python 3.10 because 3.9 is basically vintage now. If you still run 3.9, please join us in the future (or bring snacks).
21
+
16
22
  ---
17
23
 
18
24
  # Setup
@@ -212,7 +218,14 @@ for _, item in body.items():
212
218
  post.add(item)
213
219
 
214
220
  draft = api.post_draft(post.get_draft())
215
- api.put_draft(draft.get("id"), draft_section_id=post.draft_section_id)
221
+ put_draft_kwargs = {
222
+ "draft_section_id": post.draft_section_id,
223
+ "search_engine_title": post_data.get("search_engine_title"),
224
+ "search_engine_description": post_data.get("search_engine_description"),
225
+ "slug": post_data.get("slug"),
226
+ }
227
+ put_draft_kwargs = {k: v for k, v in put_draft_kwargs.items() if v is not None}
228
+ api.put_draft(draft.get("id"), **put_draft_kwargs)
216
229
 
217
230
  # Publish the draft
218
231
  api.prepublish_draft(draft.get("id"))
@@ -240,6 +253,22 @@ body:
240
253
  src: "local_image.jpg" # Local images will be uploaded automatically
241
254
  ```
242
255
 
256
+ ## MCP FastMCP server
257
+
258
+ This package now includes a FastMCP server in `substack/mcp_fastmcp.py` with the following tools:
259
+
260
+ - `post_draft_from_markdown(...)`: create draft from markdown, optional tag/add/prepublish/publish, and control send/share_automatically.
261
+ - `put_draft(draft_id, update_payload)`: update draft fields.
262
+ - `add_tags(draft_id, tags)`: add tags to a draft/post.
263
+ - `prepublish_draft(draft_id)`: prepublish a draft.
264
+ - `publish_draft(draft_id, send=True, share_automatically=False)`: publish a draft.
265
+
266
+ Use via stdio transport:
267
+
268
+ ```bash
269
+ python -c "from substack.mcp_fastmcp import main; main()"
270
+ ```
271
+
243
272
  # Contributing
244
273
 
245
274
  Install pre-commit:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "python-substack"
3
- version = "0.1.19"
3
+ version = "0.1.21"
4
4
  description = "A Python wrapper around the Substack API."
5
5
  authors = ["Paolo Mazza <mazzapaolo2019@gmail.com>"]
6
6
  license = "MIT"
@@ -16,15 +16,20 @@ homepage = "https://github.com/ma2za/python-substack"
16
16
  keywords = ["substack"]
17
17
 
18
18
  [tool.poetry.dependencies]
19
- python = ">=3.9"
19
+ python = "<4.0,>=3.10"
20
20
 
21
- requests = "^2.31.0"
22
- python-dotenv = "^0.21.0"
21
+ requests = "^2.32.0"
22
+ python-dotenv = "^1.2.1"
23
23
  PyYAML = "^6.0"
24
24
 
25
-
26
25
  [tool.poetry.group.dev.dependencies]
27
26
 
27
+ [tool.poetry.group.mcp]
28
+
29
+ optional = true
30
+
31
+ [tool.poetry.group.mcp.dependencies]
32
+ fastmcp = "^3.1.1"
28
33
 
29
34
  [build-system]
30
35
  requires = ["poetry-core>=1.0.0"]
@@ -3,7 +3,7 @@
3
3
  __author__ = "Paolo Mazza"
4
4
  __email__ = "mazzapaolo2019@gmail.com"
5
5
  __license__ = "MIT License"
6
- __version__ = "1.0"
6
+ __version__ = "0.1.21"
7
7
  __url__ = "https://github.com/ma2za/python-substack"
8
8
  __download_url__ = "https://pypi.python.org/pypi/python-substack"
9
9
  __description__ = "A Python wrapper around the Substack API"