image-search-mcp 0.1.1__py3-none-any.whl → 0.1.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.
- image_search_mcp/main.py +28 -10
- {image_search_mcp-0.1.1.dist-info → image_search_mcp-0.1.3.dist-info}/METADATA +1 -1
- image_search_mcp-0.1.3.dist-info/RECORD +8 -0
- image_search_mcp-0.1.1.dist-info/RECORD +0 -8
- {image_search_mcp-0.1.1.dist-info → image_search_mcp-0.1.3.dist-info}/WHEEL +0 -0
- {image_search_mcp-0.1.1.dist-info → image_search_mcp-0.1.3.dist-info}/entry_points.txt +0 -0
- {image_search_mcp-0.1.1.dist-info → image_search_mcp-0.1.3.dist-info}/top_level.txt +0 -0
image_search_mcp/main.py
CHANGED
|
@@ -43,17 +43,35 @@ def main():
|
|
|
43
43
|
if args.sse:
|
|
44
44
|
try:
|
|
45
45
|
import uvicorn
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
#
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
app
|
|
46
|
+
from starlette.applications import Starlette
|
|
47
|
+
from starlette.routing import Route
|
|
48
|
+
from mcp.server.sse import SseServerTransport
|
|
49
|
+
|
|
50
|
+
# 1. Initialize SSE transport
|
|
51
|
+
# The transport handles the /sse and /messages endpoints
|
|
52
|
+
sse = SseServerTransport("/messages")
|
|
53
|
+
|
|
54
|
+
# 2. Define the ASGI app routes manually to match FastMCP internal logic
|
|
55
|
+
async def handle_sse(request):
|
|
56
|
+
async with sse.connect_sse(request.scope, request.receive, request.send) as (read_stream, write_stream):
|
|
57
|
+
# Use the underlying server from FastMCP instance
|
|
58
|
+
await mcp._server.run(
|
|
59
|
+
read_stream,
|
|
60
|
+
write_stream,
|
|
61
|
+
mcp._server.create_initialization_options()
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
starlette_app = Starlette(
|
|
65
|
+
debug=True,
|
|
66
|
+
routes=[
|
|
67
|
+
Route("/sse", endpoint=handle_sse),
|
|
68
|
+
Route("/messages", endpoint=sse.handle_post_message, methods=["POST"]),
|
|
69
|
+
]
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
app = starlette_app
|
|
55
73
|
|
|
56
|
-
#
|
|
74
|
+
# 3. Apply Auth Middleware if token is provided
|
|
57
75
|
auth_token = os.environ.get("MCP_AUTH_TOKEN")
|
|
58
76
|
if auth_token:
|
|
59
77
|
print(f"🔒 Authentication enabled. Require Bearer token.")
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
image_search_mcp/__init__.py,sha256=h6DgLFO4TMUk7_wCJ2jn2Y6IkFmfzb-Z7jX-G5UCYVc,43
|
|
2
|
+
image_search_mcp/main.py,sha256=A6cWVtrVJWWF7Wtmi6JGO-KsPa6F42PUWN59gg-TVVk,3514
|
|
3
|
+
image_search_mcp/server.py,sha256=zDfg1BAB1yPFdvBBkGbBxsGpUEnOAMORnA7LN-4g5Xg,13445
|
|
4
|
+
image_search_mcp-0.1.3.dist-info/METADATA,sha256=zBm3X1ZwWYLKFe63VjnMySbSvDymx5ORAGUn44kqrRQ,5434
|
|
5
|
+
image_search_mcp-0.1.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
+
image_search_mcp-0.1.3.dist-info/entry_points.txt,sha256=BD8buPHSQ9yLqGM6w_UGTKjYkVRu_IjH_R736MsDQXM,64
|
|
7
|
+
image_search_mcp-0.1.3.dist-info/top_level.txt,sha256=toz9LX_-JYwJIcGbvfVSH0ap99Nsp2mdzvitLWHyYWo,17
|
|
8
|
+
image_search_mcp-0.1.3.dist-info/RECORD,,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
image_search_mcp/__init__.py,sha256=h6DgLFO4TMUk7_wCJ2jn2Y6IkFmfzb-Z7jX-G5UCYVc,43
|
|
2
|
-
image_search_mcp/main.py,sha256=GmXTnS47NjXZiJH3QB2UryiI8Hyr8QBVFKfyfTDFH4o,2808
|
|
3
|
-
image_search_mcp/server.py,sha256=zDfg1BAB1yPFdvBBkGbBxsGpUEnOAMORnA7LN-4g5Xg,13445
|
|
4
|
-
image_search_mcp-0.1.1.dist-info/METADATA,sha256=pL67qCh6bxWI2k7qBPI2gcUGlEEuMwGDc0TUTfwoNvo,5434
|
|
5
|
-
image_search_mcp-0.1.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
6
|
-
image_search_mcp-0.1.1.dist-info/entry_points.txt,sha256=BD8buPHSQ9yLqGM6w_UGTKjYkVRu_IjH_R736MsDQXM,64
|
|
7
|
-
image_search_mcp-0.1.1.dist-info/top_level.txt,sha256=toz9LX_-JYwJIcGbvfVSH0ap99Nsp2mdzvitLWHyYWo,17
|
|
8
|
-
image_search_mcp-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|