langgraph-api 0.2.1__py3-none-any.whl → 0.2.3__py3-none-any.whl

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.

Potentially problematic release.


This version of langgraph-api might be problematic. Click here for more details.

langgraph_api/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.2.1"
1
+ __version__ = "0.2.3"
@@ -68,10 +68,7 @@ if HTTP_CONFIG:
68
68
  protected_routes.extend(store_routes)
69
69
  if not HTTP_CONFIG.get("disable_ui"):
70
70
  protected_routes.extend(ui_routes)
71
- # Default for disabling MCP. Until we can verify that the protocol is working
72
- # correctly. This is dependent on the release of an official MCP client
73
- # implementation.
74
- if not HTTP_CONFIG.get("disable_mcp", True):
71
+ if not HTTP_CONFIG.get("disable_mcp"):
75
72
  protected_routes.extend(mcp_routes)
76
73
  else:
77
74
  protected_routes.extend(assistants_routes)
@@ -5,7 +5,12 @@ from functools import lru_cache
5
5
 
6
6
  import orjson
7
7
 
8
- from langgraph_api.config import LANGGRAPH_AUTH, LANGGRAPH_AUTH_TYPE, MOUNT_PREFIX
8
+ from langgraph_api.config import (
9
+ HTTP_CONFIG,
10
+ LANGGRAPH_AUTH,
11
+ LANGGRAPH_AUTH_TYPE,
12
+ MOUNT_PREFIX,
13
+ )
9
14
  from langgraph_api.graph import GRAPHS
10
15
  from langgraph_api.validation import openapi
11
16
 
@@ -19,6 +24,88 @@ def set_custom_spec(spec: dict):
19
24
  CUSTOM_OPENAPI_SPEC = spec
20
25
 
21
26
 
27
+ def get_mcp_openapi_paths() -> dict:
28
+ """Returns the OpenAPI path definitions for the /mcp/ endpoint."""
29
+ return {
30
+ "/mcp/": {
31
+ "get": {
32
+ "operationId": "get_mcp",
33
+ "summary": "MCP Get",
34
+ "description": (
35
+ "Implemented according to the Streamable HTTP Transport "
36
+ "specification."
37
+ ),
38
+ "responses": {
39
+ "405": {
40
+ "description": "GET method not allowed; streaming not "
41
+ "supported.",
42
+ }
43
+ },
44
+ "tags": ["MCP"],
45
+ },
46
+ "post": {
47
+ "operationId": "post_mcp",
48
+ "summary": "MCP Post",
49
+ "description": (
50
+ "Implemented according to the Streamable HTTP Transport "
51
+ "specification.\n"
52
+ "Sends a JSON-RPC 2.0 message to the server.\n\n"
53
+ "- **Request**: Provide an object with `jsonrpc`, `id`, `method`, "
54
+ "and optional `params`.\n"
55
+ "- **Response**: Returns a JSON-RPC response or acknowledgment.\n\n"
56
+ "**Notes:**\n"
57
+ "- Stateless: Sessions are not persisted across requests.\n"
58
+ ),
59
+ "requestBody": {
60
+ "required": True,
61
+ "content": {
62
+ "application/json": {
63
+ "schema": {"type": "object"},
64
+ "description": "A JSON-RPC 2.0 request, notification, "
65
+ "or response object.",
66
+ }
67
+ },
68
+ },
69
+ "responses": {
70
+ "200": {
71
+ "description": "Successful JSON-RPC response.",
72
+ "content": {"application/json": {"schema": {"type": "object"}}},
73
+ },
74
+ "202": {
75
+ "description": "Notification or response accepted; no content "
76
+ "body.",
77
+ },
78
+ "400": {
79
+ "description": "Bad request: invalid JSON or message format, "
80
+ "or unacceptable Accept header.",
81
+ },
82
+ "405": {
83
+ "description": "HTTP method not allowed.",
84
+ },
85
+ "500": {
86
+ "description": "Internal server error or unexpected failure.",
87
+ },
88
+ },
89
+ "tags": ["MCP"],
90
+ },
91
+ "delete": {
92
+ "operationId": "delete_mcp",
93
+ "summary": "Terminate Session",
94
+ "description": (
95
+ "Implemented according to the Streamable HTTP Transport "
96
+ "specification.\n"
97
+ "Terminate an MCP session. The server implementation is stateless, "
98
+ "so this is a no-op.\n\n"
99
+ ),
100
+ "responses": {
101
+ "404": {},
102
+ },
103
+ "tags": ["MCP"],
104
+ },
105
+ }
106
+ }
107
+
108
+
22
109
  @lru_cache(maxsize=1)
23
110
  def get_openapi_spec() -> str:
24
111
  # patch the graph_id enums
@@ -80,6 +167,14 @@ def get_openapi_spec() -> str:
80
167
  final = merge_openapi_specs(openapi, CUSTOM_OPENAPI_SPEC)
81
168
  if MOUNT_PREFIX:
82
169
  final["servers"] = [{"url": MOUNT_PREFIX}]
170
+
171
+ MCP_ENABLED = HTTP_CONFIG is None or not HTTP_CONFIG.get("disable_mcp")
172
+
173
+ if MCP_ENABLED:
174
+ # Add the MCP paths to the OpenAPI spec
175
+ mcp_path = get_mcp_openapi_paths()
176
+ final["paths"]["/mcp/"] = mcp_path["/mcp/"]
177
+
83
178
  return orjson.dumps(final)
84
179
 
85
180
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: langgraph-api
3
- Version: 0.2.1
3
+ Version: 0.2.3
4
4
  Summary:
5
5
  License: Elastic-2.0
6
6
  Author: Nuno Campos
@@ -16,7 +16,7 @@ Requires-Dist: cryptography (>=42.0.0,<45.0)
16
16
  Requires-Dist: httpx (>=0.25.0)
17
17
  Requires-Dist: jsonschema-rs (>=0.20.0,<0.30)
18
18
  Requires-Dist: langchain-core (>=0.2.38) ; python_version < "4.0"
19
- Requires-Dist: langgraph (>=0.2.56) ; python_version < "4.0"
19
+ Requires-Dist: langgraph (>=0.3.27) ; python_version < "4.0"
20
20
  Requires-Dist: langgraph-checkpoint (>=2.0.23) ; python_version < "4.0"
21
21
  Requires-Dist: langgraph-runtime-inmem (>=0.0.7)
22
22
  Requires-Dist: langgraph-sdk (>=0.1.66,<0.2.0) ; python_version < "4.0"
@@ -1,10 +1,10 @@
1
1
  LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
2
- langgraph_api/__init__.py,sha256=HfjVOrpTnmZ-xVFCYSVmX50EXaBQeJteUHG-PD6iQs8,22
3
- langgraph_api/api/__init__.py,sha256=IKKMrC5gCHTzjprbg8jgZDrAJRuqJfSUgEkZAgh3l-M,5771
2
+ langgraph_api/__init__.py,sha256=PNiDER4qM19h9zdsdfgKt2_dT4WgYK7EguJ8RU2qA_g,22
3
+ langgraph_api/api/__init__.py,sha256=QvtYjGTr6FLglHVk4MA8ijgtOiRbLpkq_DzLAqPA3-w,5585
4
4
  langgraph_api/api/assistants.py,sha256=6oYFRKlvqheJQGbWjFhQOUnnSbvsbrdMYLRJP7WtSRo,14481
5
5
  langgraph_api/api/mcp.py,sha256=RvRYgANqRzNQzSmgjNkq4RlKTtoEJYil04ot9lsmEtE,14352
6
6
  langgraph_api/api/meta.py,sha256=sTgkhE-DaFWpERG6F7KelZfDsmJAiVc4j5dg50tDkSo,2950
7
- langgraph_api/api/openapi.py,sha256=OGwzPpYO4e98iqtgL7UEfzI6jP4zXahJ1R-7VgOSZeg,11046
7
+ langgraph_api/api/openapi.py,sha256=HZ6JfH-NKh1pvxTf2lMfxCDuNiRx-Pp-TNahRME4Jgg,14598
8
8
  langgraph_api/api/runs.py,sha256=dhHZ3xu7V0anftqzXaOYnhVEryJpVeqzu60MFiUw4u8,18010
9
9
  langgraph_api/api/store.py,sha256=G4Fm8hgFLlJUW5_ekLS_IOgCfpFy-TK9uq5r9QTOELQ,5447
10
10
  langgraph_api/api/threads.py,sha256=ogMKmEoiycuaV3fa5kpupDohJ7fwUOfVczt6-WSK4FE,9322
@@ -101,8 +101,8 @@ langgraph_license/validation.py,sha256=ZKraAVJArAABKqrmHN-EN18ncoNUmRm500Yt1Sc7t
101
101
  langgraph_runtime/__init__.py,sha256=O4GgSmu33c-Pr8Xzxj_brcK5vkm70iNTcyxEjICFZxA,1075
102
102
  logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
103
103
  openapi.json,sha256=BMQQYQaTAvCCIqB5YSjriXRHmX9cVsWPWPNfEBs-_kA,133200
104
- langgraph_api-0.2.1.dist-info/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
105
- langgraph_api-0.2.1.dist-info/METADATA,sha256=kwJldMbtg9R4-P56cwNUpX_S78I12S2xsfmWx0HfxBA,4235
106
- langgraph_api-0.2.1.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
107
- langgraph_api-0.2.1.dist-info/entry_points.txt,sha256=3EYLgj89DfzqJHHYGxPH4A_fEtClvlRbWRUHaXO7hj4,77
108
- langgraph_api-0.2.1.dist-info/RECORD,,
104
+ langgraph_api-0.2.3.dist-info/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
105
+ langgraph_api-0.2.3.dist-info/METADATA,sha256=Uvk47wSJz1ljR22IYjNhE1CWCsb_Y8AsPJ14gMcQpHc,4235
106
+ langgraph_api-0.2.3.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
107
+ langgraph_api-0.2.3.dist-info/entry_points.txt,sha256=3EYLgj89DfzqJHHYGxPH4A_fEtClvlRbWRUHaXO7hj4,77
108
+ langgraph_api-0.2.3.dist-info/RECORD,,