cortexdb-mcp 0.2.1__tar.gz → 0.2.2__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.
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/PKG-INFO +1 -1
- cortexdb_mcp-0.2.2/cortexdb_mcp/__main__.py +5 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/cortexdb_mcp/server.py +48 -18
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/pyproject.toml +1 -1
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/.gitignore +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/Dockerfile +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/README.md +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/cortexdb_mcp/__init__.py +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/cortexdb_mcp/api.py +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/cortexdb_mcp/config.py +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/cortexdb_mcp/insights.py +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/tests/__init__.py +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/tests/test_insights.py +0 -0
- {cortexdb_mcp-0.2.1 → cortexdb_mcp-0.2.2}/tests/test_server.py +0 -0
|
@@ -123,23 +123,29 @@ async def memory_store(
|
|
|
123
123
|
ttl_seconds:
|
|
124
124
|
Auto-expiry time in seconds. Omit for permanent storage.
|
|
125
125
|
"""
|
|
126
|
+
# Always route to /v1/remember. The /v1/episodes endpoint requires a
|
|
127
|
+
# structured Source object (connector + external_id) and a full Actor,
|
|
128
|
+
# which an MCP caller doesn't have. Carry `source`, `episode_type`, and
|
|
129
|
+
# `tags` through the free-form metadata bag instead — the coordinator
|
|
130
|
+
# and recall pipeline both honour `metadata.source` for filtering.
|
|
131
|
+
metadata: dict[str, str] = {"episode_type": episode_type}
|
|
132
|
+
if source is not None:
|
|
133
|
+
metadata["source"] = source
|
|
134
|
+
if tags:
|
|
135
|
+
metadata["tags"] = ",".join(tags)
|
|
136
|
+
|
|
126
137
|
body: dict[str, Any] = {
|
|
127
138
|
"content": content,
|
|
128
|
-
"
|
|
139
|
+
"metadata": metadata,
|
|
129
140
|
}
|
|
130
|
-
if source is not None:
|
|
131
|
-
body["source"] = source
|
|
132
141
|
if tenant_id is not None:
|
|
133
142
|
body["tenant_id"] = tenant_id
|
|
134
143
|
if namespace is not None:
|
|
135
144
|
body["namespace"] = namespace
|
|
136
|
-
if tags is not None:
|
|
137
|
-
body["tags"] = tags
|
|
138
145
|
if ttl_seconds is not None:
|
|
139
146
|
body["ttl_seconds"] = ttl_seconds
|
|
140
147
|
|
|
141
|
-
|
|
142
|
-
result = await _request("POST", path, json_body=body)
|
|
148
|
+
result = await _request("POST", "/v1/remember", json_body=body)
|
|
143
149
|
|
|
144
150
|
event_id = result.get("event_id") or result.get("episode_id") or "unknown"
|
|
145
151
|
return f"Stored successfully. ID: {event_id}"
|
|
@@ -857,29 +863,35 @@ async def export_data(
|
|
|
857
863
|
|
|
858
864
|
@mcp.tool()
|
|
859
865
|
async def import_data(
|
|
860
|
-
|
|
866
|
+
memories: list[dict[str, Any]],
|
|
861
867
|
tenant_id: str | None = None,
|
|
862
|
-
format: str = "json",
|
|
863
868
|
) -> str:
|
|
864
|
-
"""
|
|
869
|
+
"""Bulk-import memories into CortexDB.
|
|
865
870
|
|
|
866
871
|
Parameters
|
|
867
872
|
----------
|
|
868
|
-
|
|
869
|
-
|
|
873
|
+
memories:
|
|
874
|
+
List of memory objects to import. Each item must have a `content`
|
|
875
|
+
field (string); optional fields: `metadata` (dict of str→str),
|
|
876
|
+
`scope` (str).
|
|
870
877
|
tenant_id:
|
|
871
878
|
Tenant scope for the imported data.
|
|
872
|
-
|
|
873
|
-
|
|
879
|
+
|
|
880
|
+
Requires the Starter tier or higher. Free-tier accounts will receive
|
|
881
|
+
HTTP 402 (feature_not_available).
|
|
874
882
|
"""
|
|
875
|
-
|
|
883
|
+
if not isinstance(memories, list) or not memories:
|
|
884
|
+
raise ValueError("memories must be a non-empty list of objects")
|
|
885
|
+
|
|
886
|
+
body: dict[str, Any] = {"memories": memories}
|
|
876
887
|
if tenant_id:
|
|
877
888
|
body["tenant_id"] = tenant_id
|
|
878
889
|
|
|
879
890
|
result = await _request("POST", "/v1/import", json_body=body)
|
|
880
891
|
|
|
881
|
-
imported = result.get("imported",
|
|
882
|
-
|
|
892
|
+
imported = result.get("imported", 0)
|
|
893
|
+
failed = result.get("failed", 0)
|
|
894
|
+
return f"Import complete. {imported} imported, {failed} failed."
|
|
883
895
|
|
|
884
896
|
|
|
885
897
|
# ===========================================================================
|
|
@@ -1078,7 +1090,25 @@ def weekly_digest(tenant_id: str | None = None) -> str:
|
|
|
1078
1090
|
|
|
1079
1091
|
def main() -> None:
|
|
1080
1092
|
"""Run the CortexDB MCP server over stdio transport."""
|
|
1081
|
-
|
|
1093
|
+
import argparse
|
|
1094
|
+
|
|
1095
|
+
parser = argparse.ArgumentParser(
|
|
1096
|
+
prog="cortexdb-mcp",
|
|
1097
|
+
description="CortexDB MCP Server — expose memory operations to AI agents via the Model Context Protocol.",
|
|
1098
|
+
)
|
|
1099
|
+
parser.add_argument(
|
|
1100
|
+
"--transport",
|
|
1101
|
+
choices=["stdio"],
|
|
1102
|
+
default="stdio",
|
|
1103
|
+
help="Transport mode (default: stdio)",
|
|
1104
|
+
)
|
|
1105
|
+
parser.add_argument(
|
|
1106
|
+
"--version",
|
|
1107
|
+
action="version",
|
|
1108
|
+
version="cortexdb-mcp 0.2.1",
|
|
1109
|
+
)
|
|
1110
|
+
args = parser.parse_args()
|
|
1111
|
+
mcp.run(transport=args.transport)
|
|
1082
1112
|
|
|
1083
1113
|
|
|
1084
1114
|
if __name__ == "__main__":
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|