listmonk-api 2.3.4__tar.gz → 2.3.6__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.
- {listmonk_api-2.3.4/listmonk_api.egg-info → listmonk_api-2.3.6}/PKG-INFO +3 -9
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/README.md +0 -2
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/__init__.py +16 -1
- listmonk_api-2.3.6/listmonk_api/__main__.py +4 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_campaigns.py +4 -5
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_lists.py +4 -5
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_subscribers.py +4 -5
- listmonk_api-2.3.6/listmonk_api/connector_sources.py +97 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/mcp_server.py +4 -101
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/models.py +24 -23
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/certification.json +6 -6
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/mappings/source.yaml +1 -1
- listmonk_api-2.3.6/listmonk_api/skills/listmonk-api-development/SKILL.md +116 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6/listmonk_api.egg-info}/PKG-INFO +3 -9
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api.egg-info/SOURCES.txt +2 -5
- listmonk_api-2.3.6/listmonk_api.egg-info/entry_points.txt +5 -0
- listmonk_api-2.3.6/listmonk_api.egg-info/requires.txt +8 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/pyproject.toml +12 -13
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_api_clients.py +4 -2
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_auth_and_server.py +3 -4
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_fleet_name.py +2 -2
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_init.py +3 -8
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_mcp_server.py +6 -176
- listmonk_api-2.3.6/tests/test_publication_workflow.py +86 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_startup.py +0 -2
- listmonk_api-2.3.4/listmonk_api/__main__.py +0 -6
- listmonk_api-2.3.4/listmonk_api/connector_sources.py +0 -147
- listmonk_api-2.3.4/listmonk_api/connectors/__init__.py +0 -0
- listmonk_api-2.3.4/listmonk_api/prompts/__init__.py +0 -0
- listmonk_api-2.3.4/listmonk_api/skills/__init__.py +0 -0
- listmonk_api-2.3.4/listmonk_api.egg-info/entry_points.txt +0 -11
- listmonk_api-2.3.4/listmonk_api.egg-info/requires.txt +0 -14
- listmonk_api-2.3.4/scripts/security_sanitizer.py +0 -318
- listmonk_api-2.3.4/tests/test_default_content_surfaces.py +0 -43
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/LICENSE +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/MANIFEST.in +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/__init__.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_base.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_import_api.py +1 -1
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_media.py +1 -1
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_templates.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api/api_client_transactional.py +1 -1
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/api_client.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/auth.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/kg_ingest.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/mcp_config.json +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/__init__.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/fixtures/records.json +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/listmonk.ttl +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/migrations/manifest.json +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/ontology/shapes/connector.shacl.ttl +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-api-operations/SKILL.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-api-operations/agents/openai.yaml +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-api-operations/references/catalog.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-campaign-management/SKILL.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-campaign-management/WORKFLOW.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-subscriber-lists/SKILL.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-subscriber-lists/WORKFLOW.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-transactional-messaging/SKILL.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api/skills/listmonk-transactional-messaging/WORKFLOW.md +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api.egg-info/dependency_links.txt +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/listmonk_api.egg-info/top_level.txt +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/requirements.txt +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/setup.cfg +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/conftest.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_action_discovery.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_init_dynamics.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_kg_ingest.py +0 -0
- {listmonk_api-2.3.4 → listmonk_api-2.3.6}/tests/test_token_auth.py +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: listmonk-api
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.6
|
|
4
4
|
Summary: Agent package for Listmonk
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -12,12 +12,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: agent-connector-sdk[mcp]<
|
|
15
|
+
Requires-Dist: agent-connector-sdk[mcp]<0.6.0,>=0.5.4
|
|
16
16
|
Requires-Dist: requests>=2.34.2
|
|
17
|
-
Provides-Extra: mcp
|
|
18
|
-
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.4.1; extra == "mcp"
|
|
19
|
-
Provides-Extra: all
|
|
20
|
-
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.4.1; extra == "all"
|
|
21
17
|
Provides-Extra: test
|
|
22
18
|
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
23
19
|
Requires-Dist: pytest>=9.1.1; extra == "test"
|
|
@@ -47,8 +43,6 @@ Dynamic: license-file
|
|
|
47
43
|

|
|
48
44
|

|
|
49
45
|
|
|
50
|
-
*Version: 2.3.4*
|
|
51
|
-
|
|
52
46
|
> **Documentation** — Installation, deployment, usage across the API, CLI, MCP, and
|
|
53
47
|
> agent interfaces, and guidance for provisioning the Listmonk platform are maintained
|
|
54
48
|
> in the [official documentation](https://knuckles-team.github.io/listmonk-api/).
|
|
@@ -20,8 +20,6 @@
|
|
|
20
20
|

|
|
21
21
|

|
|
22
22
|
|
|
23
|
-
*Version: 2.3.4*
|
|
24
|
-
|
|
25
23
|
> **Documentation** — Installation, deployment, usage across the API, CLI, MCP, and
|
|
26
24
|
> agent interfaces, and guidance for provisioning the Listmonk platform are maintained
|
|
27
25
|
> in the [official documentation](https://knuckles-team.github.io/listmonk-api/).
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import importlib
|
|
4
4
|
import inspect
|
|
5
|
-
from typing import Any
|
|
6
5
|
import warnings
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
# Suppress RequestsDependencyWarning due to chardet 6.x / requests 2.32.x mismatch
|
|
9
9
|
# Centralized here to ensure it runs before any sub-package imports
|
|
@@ -92,3 +92,18 @@ def __getattr__(name: str) -> Any:
|
|
|
92
92
|
|
|
93
93
|
def __dir__() -> list[str]:
|
|
94
94
|
return sorted(list(globals().keys()) + __all__)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
from agent_connector_sdk.connector import Connector
|
|
98
|
+
|
|
99
|
+
from listmonk_api.api_client import ListmonkAPI
|
|
100
|
+
from listmonk_api.auth import get_client
|
|
101
|
+
from listmonk_api.mcp_server import register_prompts
|
|
102
|
+
|
|
103
|
+
connector = Connector(
|
|
104
|
+
api=ListmonkAPI,
|
|
105
|
+
get_client=get_client,
|
|
106
|
+
tools="listmonk_api.mcp_server",
|
|
107
|
+
instructions="Listmonk MCP Server — Manage subscribers, lists, campaigns, templates, media, imports, and transactional messages.",
|
|
108
|
+
extra_registrations=(register_prompts,),
|
|
109
|
+
)
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
from
|
|
1
|
+
from listmonk_api.api.api_client_base import BaseApiClient, PaginationRequest
|
|
2
2
|
from listmonk_api.models import (
|
|
3
3
|
CampaignCreateRequest,
|
|
4
4
|
CampaignStatusRequest,
|
|
5
5
|
)
|
|
6
|
-
from listmonk_api.api.api_client_base import BaseApiClient, PaginationRequest
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class ListmonkAPI(BaseApiClient):
|
|
10
9
|
def get_campaigns(
|
|
11
10
|
self,
|
|
12
|
-
query:
|
|
13
|
-
order_by:
|
|
14
|
-
order:
|
|
11
|
+
query: dict | None = None,
|
|
12
|
+
order_by: str | None = None,
|
|
13
|
+
order: str | None = None,
|
|
15
14
|
max_pages: int = 0,
|
|
16
15
|
per_page: int = 100,
|
|
17
16
|
):
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
from
|
|
1
|
+
from listmonk_api.api.api_client_base import BaseApiClient, PaginationRequest
|
|
2
2
|
from listmonk_api.models import (
|
|
3
3
|
ListCreateRequest,
|
|
4
4
|
ListEditRequest,
|
|
5
5
|
)
|
|
6
|
-
from listmonk_api.api.api_client_base import BaseApiClient, PaginationRequest
|
|
7
6
|
|
|
8
7
|
|
|
9
8
|
class ListmonkAPI(BaseApiClient):
|
|
10
9
|
def get_lists(
|
|
11
10
|
self,
|
|
12
|
-
query:
|
|
13
|
-
order_by:
|
|
14
|
-
order:
|
|
11
|
+
query: dict | None = None,
|
|
12
|
+
order_by: str | None = None,
|
|
13
|
+
order: str | None = None,
|
|
15
14
|
max_pages: int = 0,
|
|
16
15
|
per_page: int = 100,
|
|
17
16
|
):
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
from
|
|
1
|
+
from listmonk_api.api.api_client_base import BaseApiClient, PaginationRequest
|
|
2
2
|
from listmonk_api.models import (
|
|
3
3
|
SubscriberCreateRequest,
|
|
4
4
|
)
|
|
5
|
-
from listmonk_api.api.api_client_base import BaseApiClient, PaginationRequest
|
|
6
5
|
|
|
7
6
|
|
|
8
|
-
def _list_id_filter(list_id:
|
|
7
|
+
def _list_id_filter(list_id: int | list[int] | None) -> str:
|
|
9
8
|
"""Build the ``&list_id=...`` query-filter suffix for one or many list ids."""
|
|
10
9
|
if not list_id:
|
|
11
10
|
return ""
|
|
@@ -17,8 +16,8 @@ def _list_id_filter(list_id: Optional[Union[int, List[int]]]) -> str:
|
|
|
17
16
|
class ListmonkAPI(BaseApiClient):
|
|
18
17
|
def get_subscribers(
|
|
19
18
|
self,
|
|
20
|
-
query:
|
|
21
|
-
list_id:
|
|
19
|
+
query: dict | None = None,
|
|
20
|
+
list_id: int | list[int] | None = None,
|
|
22
21
|
max_pages: int = 0,
|
|
23
22
|
per_page: int = 100,
|
|
24
23
|
):
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Data sources of this connector, declared by tool name (generated by connector-ontology-map migrate).
|
|
2
|
+
|
|
3
|
+
Served live as ``connector://resources``. Regenerate by editing the declarations, not the tools.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
# ruff: noqa: E501
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from agent_connector_sdk.ingest.live_declaration import source_meta
|
|
10
|
+
|
|
11
|
+
SOURCES = (
|
|
12
|
+
source_meta(
|
|
13
|
+
tool="listmonk_get_campaigns",
|
|
14
|
+
source_id="listmonk-campaigns",
|
|
15
|
+
record_type="Campaign",
|
|
16
|
+
id_field="id",
|
|
17
|
+
cursor_field="updated_at",
|
|
18
|
+
page_param="page",
|
|
19
|
+
page_size_param="per_page",
|
|
20
|
+
pagination="page",
|
|
21
|
+
preset={
|
|
22
|
+
"doc_type": "campaign",
|
|
23
|
+
"page_kind": "number",
|
|
24
|
+
"params_style": "args",
|
|
25
|
+
},
|
|
26
|
+
records_path="results",
|
|
27
|
+
server="listmonk-mcp",
|
|
28
|
+
text_field="body",
|
|
29
|
+
title_field="name",
|
|
30
|
+
),
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
SCHEMA_VERSION = 2
|
|
34
|
+
|
|
35
|
+
FIELD_SETS = {
|
|
36
|
+
"fields_1": {
|
|
37
|
+
"campaignStatus": "xsd:string",
|
|
38
|
+
"email": "xsd:string",
|
|
39
|
+
"fromEmail": "xsd:string",
|
|
40
|
+
"listType": "xsd:string",
|
|
41
|
+
"optinType": "xsd:string",
|
|
42
|
+
"sendAt": "xsd:string",
|
|
43
|
+
"subject": "xsd:string",
|
|
44
|
+
"subscriberStatus": "xsd:string",
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
SCHEMA_MAPPINGS = {
|
|
49
|
+
"Campaign": {
|
|
50
|
+
"field_sets": ["fields_1"],
|
|
51
|
+
"ontology_class": None,
|
|
52
|
+
},
|
|
53
|
+
"EmailTemplate": {
|
|
54
|
+
"field_sets": ["fields_1"],
|
|
55
|
+
"ontology_class": None,
|
|
56
|
+
},
|
|
57
|
+
"Subscriber": {
|
|
58
|
+
"field_sets": ["fields_1"],
|
|
59
|
+
"ontology_class": "Person",
|
|
60
|
+
},
|
|
61
|
+
"SubscriptionList": {
|
|
62
|
+
"field_sets": ["fields_1"],
|
|
63
|
+
"ontology_class": None,
|
|
64
|
+
},
|
|
65
|
+
"TransactionalMessage": {
|
|
66
|
+
"field_sets": ["fields_1"],
|
|
67
|
+
"ontology_class": None,
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
RESOURCES = (
|
|
72
|
+
{
|
|
73
|
+
"id_prefix": "campaign",
|
|
74
|
+
"label": "Campaign",
|
|
75
|
+
"name": "Campaign",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"id_prefix": "emailtemplate",
|
|
79
|
+
"label": "Email Template",
|
|
80
|
+
"name": "EmailTemplate",
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"id_prefix": "subscriber",
|
|
84
|
+
"label": "Subscriber",
|
|
85
|
+
"name": "Subscriber",
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"id_prefix": "subscriptionlist",
|
|
89
|
+
"label": "Subscription List",
|
|
90
|
+
"name": "SubscriptionList",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"id_prefix": "transactionalmessage",
|
|
94
|
+
"label": "Transactional Message",
|
|
95
|
+
"name": "TransactionalMessage",
|
|
96
|
+
},
|
|
97
|
+
)
|
|
@@ -23,23 +23,18 @@ with warnings.catch_warnings():
|
|
|
23
23
|
pass
|
|
24
24
|
warnings.filterwarnings("ignore", message=".*urllib3.*or chardet.*")
|
|
25
25
|
warnings.filterwarnings("ignore", message=".*urllib3.*or charset_normalizer.*")
|
|
26
|
-
import asyncio
|
|
27
26
|
import json
|
|
28
27
|
import logging
|
|
29
28
|
import sys
|
|
30
29
|
from threading import local
|
|
31
30
|
from typing import Any
|
|
32
31
|
|
|
33
|
-
import
|
|
34
|
-
from agent_connector_sdk.
|
|
32
|
+
from agent_connector_sdk.config import setting
|
|
33
|
+
from agent_connector_sdk.connector_hooks import RegistrationContext
|
|
35
34
|
from agent_connector_sdk.mcp.action_dispatch import resolve_action
|
|
36
|
-
from agent_connector_sdk.mcp.server import create_mcp_server
|
|
37
|
-
from agent_connector_sdk.mcp.tool_surface import register_tool_surface
|
|
38
35
|
|
|
39
|
-
from listmonk_api.api_client import ListmonkAPI
|
|
40
36
|
from listmonk_api.auth import get_client
|
|
41
37
|
|
|
42
|
-
__version__ = "2.3.4"
|
|
43
38
|
logger = get_logger(name="ListmonkMCP")
|
|
44
39
|
logger.setLevel(logging.DEBUG)
|
|
45
40
|
|
|
@@ -462,8 +457,9 @@ def register_listmonk_ingest_tools(mcp: FastMCP):
|
|
|
462
457
|
return {"entity": entity, "listed": listed, "ingested": result}
|
|
463
458
|
|
|
464
459
|
|
|
465
|
-
def register_prompts(
|
|
460
|
+
def register_prompts(context: RegistrationContext):
|
|
466
461
|
"""Register MCP prompts."""
|
|
462
|
+
mcp = context.server
|
|
467
463
|
|
|
468
464
|
@mcp.prompt
|
|
469
465
|
def create_campaign_prompt(
|
|
@@ -516,96 +512,3 @@ def _validate_openapi_credentials(args: Any) -> None:
|
|
|
516
512
|
_validate_openapi_token_credential()
|
|
517
513
|
return
|
|
518
514
|
_validate_openapi_password_or_client_credentials(args)
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
def get_mcp_instance() -> tuple[Any, Any, Any, Any, Any]:
|
|
522
|
-
"""Initialize and return the MCP instance, args, and middlewares."""
|
|
523
|
-
load_config()
|
|
524
|
-
args, mcp, middlewares = create_mcp_server(
|
|
525
|
-
name="Listmonk",
|
|
526
|
-
version=__version__,
|
|
527
|
-
instructions="Listmonk MCP Server — Manage subscribers, lists, campaigns, templates, media, imports, and transactional messages.",
|
|
528
|
-
)
|
|
529
|
-
imported_tools = []
|
|
530
|
-
imported_resources = []
|
|
531
|
-
# agent_connector_sdk's parser/create_mcp_server does not define the
|
|
532
|
-
# AU-only --openapi-file/--enable-delegation flags (delegation, Eunomia,
|
|
533
|
-
# and OpenAPI import are explicitly AU-internal features, not part of the
|
|
534
|
-
# SDK's scope per agent_connector_sdk.mcp.parser's own docstring), so this
|
|
535
|
-
# branch degrades to permanently inert rather than crashing on a missing
|
|
536
|
-
# attribute.
|
|
537
|
-
if getattr(args, "openapi_file", None):
|
|
538
|
-
if getattr(args, "enable_delegation", False):
|
|
539
|
-
raise ValueError("OpenAPI import not supported with delegation enabled")
|
|
540
|
-
try:
|
|
541
|
-
with open(args.openapi_file) as f:
|
|
542
|
-
spec = json.load(f)
|
|
543
|
-
|
|
544
|
-
async def _load_openapi_tools():
|
|
545
|
-
_validate_openapi_credentials(args)
|
|
546
|
-
api = get_client()
|
|
547
|
-
base_url = args.openapi_base_url or api.base_url
|
|
548
|
-
async with httpx.AsyncClient(base_url=base_url) as client:
|
|
549
|
-
openapi_mcp = FastMCP.from_openapi(
|
|
550
|
-
openapi_spec=spec, client=client, name="OpenAPI Tools"
|
|
551
|
-
)
|
|
552
|
-
tools = await openapi_mcp.get_tools()
|
|
553
|
-
resources = await openapi_mcp.get_resources()
|
|
554
|
-
return (tools, resources)
|
|
555
|
-
|
|
556
|
-
print("Importing OpenAPI tools...", file=sys.stderr)
|
|
557
|
-
imported_tools, imported_resources = asyncio.run(_load_openapi_tools())
|
|
558
|
-
print(
|
|
559
|
-
f"Imported {len(imported_tools)} tools, {len(imported_resources)} resources",
|
|
560
|
-
file=sys.stderr,
|
|
561
|
-
)
|
|
562
|
-
for tool in imported_tools:
|
|
563
|
-
mcp.add_tool(tool)
|
|
564
|
-
for resource in imported_resources:
|
|
565
|
-
mcp.add_resource(resource)
|
|
566
|
-
except Exception as exc:
|
|
567
|
-
print(f"Operation failed: {type(exc).__name__}", file=sys.stderr)
|
|
568
|
-
logger.error("OpenAPI import failed", extra={"error": "Operation failed"})
|
|
569
|
-
sys.exit(1)
|
|
570
|
-
|
|
571
|
-
registered_tags = register_tool_surface(
|
|
572
|
-
mcp,
|
|
573
|
-
client_cls=ListmonkAPI,
|
|
574
|
-
get_client=get_client,
|
|
575
|
-
service="listmonk-api",
|
|
576
|
-
tools_module=sys.modules[__name__],
|
|
577
|
-
)
|
|
578
|
-
register_prompts(mcp)
|
|
579
|
-
for tool in imported_tools:
|
|
580
|
-
mcp.add_tool(tool)
|
|
581
|
-
for resource in imported_resources:
|
|
582
|
-
mcp.add_resource(resource)
|
|
583
|
-
for mw in middlewares:
|
|
584
|
-
mcp.add_middleware(mw)
|
|
585
|
-
return (mcp, args, middlewares, registered_tags, imported_tools)
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
def mcp_server() -> None:
|
|
589
|
-
mcp, args, middlewares, registered_tags, imported_tools = get_mcp_instance()
|
|
590
|
-
print("\nStarting Listmonk MCP Server", file=sys.stderr)
|
|
591
|
-
print(f" Transport: {args.transport.upper()}", file=sys.stderr)
|
|
592
|
-
print(f" Auth: {args.auth_type}", file=sys.stderr)
|
|
593
|
-
print(
|
|
594
|
-
f" Delegation: {('ON' if getattr(args, 'enable_delegation', False) else 'OFF')}",
|
|
595
|
-
file=sys.stderr,
|
|
596
|
-
)
|
|
597
|
-
print(f" Eunomia: {getattr(args, 'eunomia_type', 'disabled')}", file=sys.stderr)
|
|
598
|
-
print(f" Imported OpenAPI Tools: {len(imported_tools)} total", file=sys.stderr)
|
|
599
|
-
if args.transport == "stdio":
|
|
600
|
-
mcp.run(transport="stdio")
|
|
601
|
-
elif args.transport == "streamable-http":
|
|
602
|
-
mcp.run(transport="streamable-http", host=args.host, port=args.port)
|
|
603
|
-
elif args.transport == "sse":
|
|
604
|
-
mcp.run(transport="sse", host=args.host, port=args.port)
|
|
605
|
-
else:
|
|
606
|
-
logger.error("Invalid transport", extra={"transport": args.transport})
|
|
607
|
-
sys.exit(1)
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
if __name__ == "__main__":
|
|
611
|
-
mcp_server()
|
|
@@ -1,42 +1,43 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
1
3
|
from pydantic import AliasChoices, BaseModel, Field
|
|
2
|
-
from typing import Optional, List, Dict, Any
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
class SubscriberCreateRequest(BaseModel):
|
|
6
7
|
email: str
|
|
7
8
|
name: str
|
|
8
9
|
status: str
|
|
9
|
-
lists:
|
|
10
|
-
attribs:
|
|
11
|
-
preconfirm_subscriptions:
|
|
10
|
+
lists: list[int] | None = None
|
|
11
|
+
attribs: dict[str, Any] | None = None
|
|
12
|
+
preconfirm_subscriptions: bool | None = True
|
|
12
13
|
|
|
13
14
|
|
|
14
15
|
class ListCreateRequest(BaseModel):
|
|
15
16
|
name: str
|
|
16
17
|
type: str # visibility_type: 'public' or 'private'
|
|
17
18
|
optin: str # 'single' or 'double'
|
|
18
|
-
tags:
|
|
19
|
+
tags: list[str] | None = None
|
|
19
20
|
|
|
20
21
|
|
|
21
22
|
class ListEditRequest(BaseModel):
|
|
22
|
-
name:
|
|
23
|
-
type:
|
|
24
|
-
optin:
|
|
25
|
-
tags:
|
|
23
|
+
name: str | None = None
|
|
24
|
+
type: str | None = None
|
|
25
|
+
optin: str | None = None
|
|
26
|
+
tags: list[str] | None = None
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
class ImportSubscribersRequest(BaseModel):
|
|
29
30
|
file: str # Base64 encoded or content depending on Listmonk API docs, wait, Listmonk expects binary upload or text? The wrapper takes 'file' as text or base64. Wait, the old wrapper did json dump with `file`... wait, it actually just sent `{"file": "..."}`.
|
|
30
31
|
mode: str
|
|
31
32
|
delim: str = ","
|
|
32
|
-
lists:
|
|
33
|
+
lists: list[int]
|
|
33
34
|
overwrite: bool = True
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
class CampaignCreateRequest(BaseModel):
|
|
37
38
|
name: str
|
|
38
39
|
subject: str
|
|
39
|
-
lists:
|
|
40
|
+
lists: list[int]
|
|
40
41
|
from_email: str
|
|
41
42
|
# Issue #3: listmonk's create-campaign payload key is "type" (older wrappers
|
|
42
43
|
# used "send_type"). Accept either on input (legacy "send_type" or "type"),
|
|
@@ -48,16 +49,16 @@ class CampaignCreateRequest(BaseModel):
|
|
|
48
49
|
)
|
|
49
50
|
content_type: str
|
|
50
51
|
body: str
|
|
51
|
-
altbody:
|
|
52
|
-
send_at:
|
|
53
|
-
messenger:
|
|
54
|
-
template_id:
|
|
55
|
-
tags:
|
|
52
|
+
altbody: str | None = None
|
|
53
|
+
send_at: str | None = None
|
|
54
|
+
messenger: str | None = None
|
|
55
|
+
template_id: int | None = None
|
|
56
|
+
tags: list[str] | None = None
|
|
56
57
|
# Issue #4: attach uploaded media to a campaign. Listmonk campaigns reference
|
|
57
58
|
# attachments by media ID (upload first via the Media API), serialized as the
|
|
58
59
|
# "media" key, e.g. {"media": [1, 2]}. (Base64/file attachments are a
|
|
59
60
|
# transactional-message feature — see TransactionalMessageRequest.)
|
|
60
|
-
media:
|
|
61
|
+
media: list[int] | None = None
|
|
61
62
|
|
|
62
63
|
|
|
63
64
|
class CampaignStatusRequest(BaseModel):
|
|
@@ -74,10 +75,10 @@ class TemplateDefaultRequest(BaseModel):
|
|
|
74
75
|
|
|
75
76
|
class TransactionalMessageRequest(BaseModel):
|
|
76
77
|
template_id: int
|
|
77
|
-
subscriber_email:
|
|
78
|
-
subscriber_id:
|
|
79
|
-
data:
|
|
80
|
-
headers:
|
|
81
|
-
content_type:
|
|
78
|
+
subscriber_email: str | None = None
|
|
79
|
+
subscriber_id: int | None = None
|
|
80
|
+
data: dict[str, Any] | None = None
|
|
81
|
+
headers: list[dict[str, str]] | None = None
|
|
82
|
+
content_type: str | None = None
|
|
82
83
|
# Fix: Added attachment support
|
|
83
|
-
attachments:
|
|
84
|
+
attachments: list[dict[str, str]] | None = None
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"api_version": "
|
|
2
|
+
"api_version": "graphos.io/v1",
|
|
3
3
|
"artifacts": {
|
|
4
4
|
"listmonk_api/ontology/fixtures/records.json": "3bfc9ad808b89d144406d45d220b63c8c40e969068f525844780c02a91e88b3a",
|
|
5
|
-
"listmonk_api/ontology/listmonk.ttl": "
|
|
6
|
-
"listmonk_api/ontology/mappings/source.yaml": "
|
|
5
|
+
"listmonk_api/ontology/listmonk.ttl": "48af73e127239be298130cfebc6c874ef6e669c863ff297ec05e81249e376a3b",
|
|
6
|
+
"listmonk_api/ontology/mappings/source.yaml": "30a210462b94e96490ad68d8e3958b9018486a84e48a3338995c69fa0103fa12",
|
|
7
7
|
"listmonk_api/ontology/migrations/manifest.json": "dcc939c0c761d526c8ec9fd65b0738c519bdc71f7b5d50156b3930057c77ff66",
|
|
8
8
|
"listmonk_api/ontology/shapes/connector.shacl.ttl": "154123bcff104aa4716d3ff7a6f1187ed00a5fe0efad8ced25d002d7aa376472"
|
|
9
9
|
},
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"synthetic_fixture_contract": "passed"
|
|
16
16
|
},
|
|
17
17
|
"compatibility": {
|
|
18
|
-
"
|
|
18
|
+
"agent_utilities": ">=2.5.0,<3",
|
|
19
19
|
"bundle_schema": "2",
|
|
20
20
|
"epistemic_graph": ">=2.27.0,<3"
|
|
21
21
|
},
|
|
22
|
-
"connector": "listmonk-
|
|
22
|
+
"connector": "listmonk-api",
|
|
23
23
|
"kind": "ConnectorSourceAttestation",
|
|
24
24
|
"live_certified": false,
|
|
25
25
|
"mode": "offline-source",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"signer": "UNSIGNED-PREVIEW",
|
|
30
30
|
"signing_public_key": "",
|
|
31
31
|
"status": "source-validated",
|
|
32
|
-
"validated_at": "2026-
|
|
32
|
+
"validated_at": "2026-10-26T21:59:50Z"
|
|
33
33
|
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: listmonk-api-development
|
|
3
|
+
skill_type: skill
|
|
4
|
+
description: >-
|
|
5
|
+
Develop and verify listmonk-api as a connector-owned package while preserving
|
|
6
|
+
its SDK entry point, action-routed tools, Listmonk authentication boundary,
|
|
7
|
+
packaged content, and source-backed spec-delivery publication.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Listmonk API Development
|
|
11
|
+
|
|
12
|
+
Use this skill for changes to the `listmonk-api` connector. The package owns
|
|
13
|
+
Listmonk API calls, mappings, MCP tools, and connector content; it does not own
|
|
14
|
+
the connector SDK, Arbora admission, the shared Pages renderer, or Pipelines
|
|
15
|
+
hooks.
|
|
16
|
+
|
|
17
|
+
## Repository map and runtime boundary
|
|
18
|
+
|
|
19
|
+
- `listmonk_api/__init__.py` creates the SDK `Connector` with `ListmonkAPI`,
|
|
20
|
+
`get_client`, and `listmonk_api.mcp_server` as its tool module. Preserve this
|
|
21
|
+
wiring when changing a tool or client.
|
|
22
|
+
- `listmonk_api/mcp_server.py` registers the action-routed domains
|
|
23
|
+
`subscribers`, `lists`, `imports`, `campaigns`, `media`, `templates`, `tx`,
|
|
24
|
+
and `ingest`, plus prompt registration. The domain API classes live under
|
|
25
|
+
`listmonk_api/api/` and are composed by `listmonk_api/api_client.py`.
|
|
26
|
+
- `listmonk_api/auth.py` reads `LISTMONK_URL`, `LISTMONK_TOKEN`, and optional
|
|
27
|
+
`LISTMONK_USERNAME` through the SDK setting boundary and resolves the named
|
|
28
|
+
`listmonk` TLS profile from `LISTMONK_TLS_PROFILE` or
|
|
29
|
+
`LISTMONK_TLS_PROFILE_REF`.
|
|
30
|
+
- `listmonk_api/ontology/`, `listmonk_api/prompts/`, and
|
|
31
|
+
`listmonk_api/skills/` are packaged connector content. The package-data table
|
|
32
|
+
in `pyproject.toml` includes `skills/**`, `prompts/**`, `ontology/**`, and
|
|
33
|
+
`connectors/**`; inspect a built wheel when changing these files.
|
|
34
|
+
- The only declared current console script is `listmonk-mcp`, provided by
|
|
35
|
+
`agent_connector_sdk.cli:serve`; `python -m listmonk_api` delegates to the SDK
|
|
36
|
+
runner. The tracked `docker/compose.yml` and older docs still mention a
|
|
37
|
+
`listmonk-agent` profile, but current `pyproject.toml` declares no such script
|
|
38
|
+
or `agent_server.py`. Do not invent that runtime or rewrite it as part of a
|
|
39
|
+
Pages/skill change.
|
|
40
|
+
|
|
41
|
+
## Rapid delivery: the 5-minute contract
|
|
42
|
+
|
|
43
|
+
1. Read the owning `specs/` row and this repository's `AGENTS.md` before editing.
|
|
44
|
+
2. Inspect the active client/tool path and its focused tests before changing API
|
|
45
|
+
behavior, auth, ontology content, or packaged skills.
|
|
46
|
+
3. Prefer the smallest connector-owned change. Preserve action names, parameter
|
|
47
|
+
schemas, SDK `Connector` wiring, Listmonk auth/TLS verification, and package
|
|
48
|
+
data declarations unless the owning requirement changes them.
|
|
49
|
+
4. Run the focused tests through the narrow test-slot wrapper, then run the
|
|
50
|
+
repository pre-commit and pre-push gates without bypasses.
|
|
51
|
+
5. For public packaged content, update the patch version and `uv.lock` together;
|
|
52
|
+
inspect the built wheel for the new skill.
|
|
53
|
+
6. Treat Pages as a separate proof: after the exact main SHA has a successful
|
|
54
|
+
Pages run, check `/spec-delivery/`, its `index.html`, and `snapshot.json` over
|
|
55
|
+
HTTPS and record the revision from the snapshot.
|
|
56
|
+
|
|
57
|
+
## Focused development commands
|
|
58
|
+
|
|
59
|
+
From the repository root:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
uv sync --locked
|
|
63
|
+
|
|
64
|
+
/var/tmp/arbora-delivery/scale/run-narrow-test-slot.sh \
|
|
65
|
+
uv run --locked --extra test pytest -q \
|
|
66
|
+
tests/test_init.py \
|
|
67
|
+
tests/test_init_dynamics.py \
|
|
68
|
+
tests/test_action_discovery.py \
|
|
69
|
+
tests/test_auth_and_server.py \
|
|
70
|
+
tests/test_mcp_server.py \
|
|
71
|
+
tests/test_publication_workflow.py
|
|
72
|
+
|
|
73
|
+
uvx pre-commit run --all-files
|
|
74
|
+
uvx pre-commit run --all-files --hook-stage pre-push
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
These checks cover SDK server construction, runtime entry points, action
|
|
78
|
+
discovery, auth/tool behavior, and the Pages/release contract. Do not replace
|
|
79
|
+
them with a live Listmonk call or a credential-bearing test.
|
|
80
|
+
|
|
81
|
+
## Pages and package publication
|
|
82
|
+
|
|
83
|
+
`.github/workflows/pages.yml` is the one Pages caller. It invokes the shared
|
|
84
|
+
Pipelines `pages_pipeline.yml@main` with `content_source: docs` and the version 1
|
|
85
|
+
`.github/spec-dashboard.json` source declaration for `specs/*/status.json`.
|
|
86
|
+
Keep manual dispatch and the docs/spec/config/workflow path filters. The old
|
|
87
|
+
direct `mkdocs gh-deploy` publisher must not be restored because it would compete
|
|
88
|
+
with the shared dashboard build.
|
|
89
|
+
|
|
90
|
+
After a merge, verify the exact main SHA in the successful Pages run and probe:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
curl -fsSI https://knuckles-team.github.io/listmonk-api/
|
|
94
|
+
curl -fsSI https://knuckles-team.github.io/listmonk-api/spec-delivery/
|
|
95
|
+
curl -fsSI https://knuckles-team.github.io/listmonk-api/spec-delivery/index.html
|
|
96
|
+
curl -fsS https://knuckles-team.github.io/listmonk-api/spec-delivery/snapshot.json
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Keep `.github/workflows/pipeline.yml` on the shared `connector: true` and
|
|
100
|
+
`render_connector: true` flags. Central generation owns generated connector
|
|
101
|
+
manifests and release container artifacts; preserve this package's existing
|
|
102
|
+
runtime/auth/port semantics and inspect generated output before making claims.
|
|
103
|
+
|
|
104
|
+
## Change discipline
|
|
105
|
+
|
|
106
|
+
- Keep Listmonk API calls, request models, ontology mappings, and MCP schemas
|
|
107
|
+
under this repository's `CONN-LISTMONK-API-*` boundary. SDK transport and
|
|
108
|
+
central renderer behavior belong to their owner repositories.
|
|
109
|
+
- Use `LISTMONK_URL`, `LISTMONK_TOKEN`, and `LISTMONK_USERNAME` only in injected
|
|
110
|
+
runtime configuration; never print or commit their values. Preserve TLS
|
|
111
|
+
certificate verification and the named profile path.
|
|
112
|
+
- For mutations, inspect current state first, require operator approval where
|
|
113
|
+
the existing connector procedure calls for it, and verify the result. Keep KG
|
|
114
|
+
ingestion opt-in and preserve its provenance/tenant contract.
|
|
115
|
+
- Keep generated status changes and central promotion with the Pipelines/status
|
|
116
|
+
owner. Do not claim Pages or public package results from a local build.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: listmonk-api
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.6
|
|
4
4
|
Summary: Agent package for Listmonk
|
|
5
|
-
Author-email:
|
|
5
|
+
Author-email: Repository Maintainers <maintainers@knuckles.team>
|
|
6
6
|
License: MIT
|
|
7
7
|
Classifier: Development Status :: 4 - Beta
|
|
8
8
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -12,12 +12,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Requires-Python: >=3.12
|
|
13
13
|
Description-Content-Type: text/markdown
|
|
14
14
|
License-File: LICENSE
|
|
15
|
-
Requires-Dist: agent-connector-sdk[mcp]<
|
|
15
|
+
Requires-Dist: agent-connector-sdk[mcp]<0.6.0,>=0.5.4
|
|
16
16
|
Requires-Dist: requests>=2.34.2
|
|
17
|
-
Provides-Extra: mcp
|
|
18
|
-
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.4.1; extra == "mcp"
|
|
19
|
-
Provides-Extra: all
|
|
20
|
-
Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.4.1; extra == "all"
|
|
21
17
|
Provides-Extra: test
|
|
22
18
|
Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
|
|
23
19
|
Requires-Dist: pytest>=9.1.1; extra == "test"
|
|
@@ -47,8 +43,6 @@ Dynamic: license-file
|
|
|
47
43
|

|
|
48
44
|

|
|
49
45
|
|
|
50
|
-
*Version: 2.3.4*
|
|
51
|
-
|
|
52
46
|
> **Documentation** — Installation, deployment, usage across the API, CLI, MCP, and
|
|
53
47
|
> agent interfaces, and guidance for provisioning the Listmonk platform are maintained
|
|
54
48
|
> in the [official documentation](https://knuckles-team.github.io/listmonk-api/).
|