cortexhub 2.0.2__tar.gz → 2.0.3__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.
- {cortexhub-2.0.2 → cortexhub-2.0.3}/PKG-INFO +3 -1
- {cortexhub-2.0.2 → cortexhub-2.0.3}/README.md +2 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/pyproject.toml +1 -1
- {cortexhub-2.0.2 → cortexhub-2.0.3}/src/cortexhub/client.py +4 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/src/cortexhub/mcp_oauth.py +21 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/.gitignore +0 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/LICENSE +0 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/src/cortexhub/__init__.py +0 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/src/cortexhub/_config.py +0 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/src/cortexhub/errors.py +0 -0
- {cortexhub-2.0.2 → cortexhub-2.0.3}/src/cortexhub/session.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cortexhub
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.3
|
|
4
4
|
Summary: MCP gateway client for CortexHub programmatic agent access.
|
|
5
5
|
Project-URL: Homepage, https://cortexhub.ai
|
|
6
6
|
Project-URL: Documentation, https://docs.cortexhub.ai
|
|
@@ -44,6 +44,8 @@ from cortexhub import Cortexhub
|
|
|
44
44
|
session = Cortexhub().session(
|
|
45
45
|
agent="helpdesk-bot",
|
|
46
46
|
mcp_session_id="chat-42", # optional: separate conversations in Cloud
|
|
47
|
+
conversation_title="Engineering standup", # optional: shown to operators
|
|
48
|
+
last_user_message="Create a standup page in Engineering Confluence", # optional
|
|
47
49
|
)
|
|
48
50
|
# session.mcp.url and session.mcp.headers → pass to your MCP transport
|
|
49
51
|
```
|
|
@@ -22,6 +22,8 @@ from cortexhub import Cortexhub
|
|
|
22
22
|
session = Cortexhub().session(
|
|
23
23
|
agent="helpdesk-bot",
|
|
24
24
|
mcp_session_id="chat-42", # optional: separate conversations in Cloud
|
|
25
|
+
conversation_title="Engineering standup", # optional: shown to operators
|
|
26
|
+
last_user_message="Create a standup page in Engineering Confluence", # optional
|
|
25
27
|
)
|
|
26
28
|
# session.mcp.url and session.mcp.headers → pass to your MCP transport
|
|
27
29
|
```
|
|
@@ -48,6 +48,8 @@ class Cortexhub(CortexhubMcpOAuthClient):
|
|
|
48
48
|
*,
|
|
49
49
|
agent: str,
|
|
50
50
|
mcp_session_id: str | None = None,
|
|
51
|
+
conversation_title: str | None = None,
|
|
52
|
+
last_user_message: str | None = None,
|
|
51
53
|
invocation_mode: Literal["interactive", "scheduled", "programmatic"] | None = None,
|
|
52
54
|
refresh: bool = False,
|
|
53
55
|
) -> McpOAuthSession:
|
|
@@ -55,6 +57,8 @@ class Cortexhub(CortexhubMcpOAuthClient):
|
|
|
55
57
|
return super().session(
|
|
56
58
|
agent=agent,
|
|
57
59
|
mcp_session_id=mcp_session_id,
|
|
60
|
+
conversation_title=conversation_title,
|
|
61
|
+
last_user_message=last_user_message,
|
|
58
62
|
invocation_mode=invocation_mode,
|
|
59
63
|
refresh=refresh,
|
|
60
64
|
)
|
|
@@ -15,6 +15,8 @@ from .session import SessionMcp
|
|
|
15
15
|
|
|
16
16
|
_INVOCATION_MODE_HEADER = "X-CortexHub-Invocation-Mode"
|
|
17
17
|
_AGENT_HEADER = "X-CortexHub-Agent"
|
|
18
|
+
_CONVERSATION_TITLE_HEADER = "X-CortexHub-Conversation-Title"
|
|
19
|
+
_LAST_USER_MESSAGE_HEADER = "X-CortexHub-Last-User-Message"
|
|
18
20
|
_BEARER_HEADER = "Authorization"
|
|
19
21
|
|
|
20
22
|
|
|
@@ -39,6 +41,8 @@ class McpOAuthSession:
|
|
|
39
41
|
access_token: str
|
|
40
42
|
agent: str | None = None
|
|
41
43
|
mcp_session_id: str | None = None
|
|
44
|
+
conversation_title: str | None = None
|
|
45
|
+
last_user_message: str | None = None
|
|
42
46
|
invocation_mode: InvocationMode | None = None
|
|
43
47
|
mcp: SessionMcp = field(init=False)
|
|
44
48
|
|
|
@@ -50,6 +54,10 @@ class McpOAuthSession:
|
|
|
50
54
|
headers[_AGENT_HEADER] = self.agent
|
|
51
55
|
if self.mcp_session_id:
|
|
52
56
|
headers["Mcp-Session-Id"] = self.mcp_session_id
|
|
57
|
+
if self.conversation_title:
|
|
58
|
+
headers[_CONVERSATION_TITLE_HEADER] = self.conversation_title
|
|
59
|
+
if self.last_user_message:
|
|
60
|
+
headers[_LAST_USER_MESSAGE_HEADER] = self.last_user_message
|
|
53
61
|
if self.invocation_mode:
|
|
54
62
|
headers[_INVOCATION_MODE_HEADER] = self.invocation_mode
|
|
55
63
|
self.mcp = SessionMcp(url=f"{base_url()}/v1/mcp", headers=headers)
|
|
@@ -106,6 +114,8 @@ class CortexhubMcpOAuthClient:
|
|
|
106
114
|
*,
|
|
107
115
|
agent: str,
|
|
108
116
|
mcp_session_id: str | None = None,
|
|
117
|
+
conversation_title: str | None = None,
|
|
118
|
+
last_user_message: str | None = None,
|
|
109
119
|
invocation_mode: InvocationMode | None = None,
|
|
110
120
|
refresh: bool = False,
|
|
111
121
|
) -> McpOAuthSession:
|
|
@@ -114,6 +124,9 @@ class CortexhubMcpOAuthClient:
|
|
|
114
124
|
Pass ``mcp_session_id`` (your chat or conversation id) to group tool
|
|
115
125
|
activity into separate rows in CortexHub Cloud.
|
|
116
126
|
|
|
127
|
+
Pass ``conversation_title`` and ``last_user_message`` so operators can
|
|
128
|
+
see session context in the portal (sent on every MCP request via headers).
|
|
129
|
+
|
|
117
130
|
Pass ``invocation_mode`` for cron or background workers when policy allows
|
|
118
131
|
unattended execution; omit for interactive sessions (gateway default).
|
|
119
132
|
"""
|
|
@@ -125,10 +138,18 @@ class CortexhubMcpOAuthClient:
|
|
|
125
138
|
)
|
|
126
139
|
token = self.fetch_token(refresh=refresh)
|
|
127
140
|
session_id = (mcp_session_id or "").strip() or None
|
|
141
|
+
title = (conversation_title or "").strip() or None
|
|
142
|
+
user_message = (last_user_message or "").strip() or None
|
|
143
|
+
if title and len(title) > 500:
|
|
144
|
+
title = title[:500]
|
|
145
|
+
if user_message and len(user_message) > 500:
|
|
146
|
+
user_message = user_message[:500]
|
|
128
147
|
return McpOAuthSession(
|
|
129
148
|
access_token=token.access_token,
|
|
130
149
|
agent=agent.strip(),
|
|
131
150
|
mcp_session_id=session_id,
|
|
151
|
+
conversation_title=title,
|
|
152
|
+
last_user_message=user_message,
|
|
132
153
|
invocation_mode=invocation_mode,
|
|
133
154
|
)
|
|
134
155
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|