image-search-mcp 0.1.4__tar.gz → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: image-search-mcp
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: MCP server for Reverse Image Search using PicImageSearch
5
5
  Author-email: Your Name <your.email@example.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "image-search-mcp"
7
- version = "0.1.4"
7
+ version = "0.1.6"
8
8
  description = "MCP server for Reverse Image Search using PicImageSearch"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -43,33 +43,25 @@ def main():
43
43
  if args.sse:
44
44
  try:
45
45
  import uvicorn
46
- from starlette.applications import Starlette
47
- from starlette.routing import Route, Mount
48
- from mcp.server.sse import SseServerTransport
49
-
50
- # 1. Initialize SSE transport
51
- sse = SseServerTransport("/messages")
52
-
53
- # 2. Define the SSE handler as a raw ASGI app to get scope, receive, send
54
- async def handle_sse(scope, receive, send):
55
- async with sse.connect_sse(scope, receive, send) as (read_stream, write_stream):
56
- # Use the underlying server from FastMCP instance
57
- await mcp._server.run(
58
- read_stream,
59
- write_stream,
60
- mcp._server.create_initialization_options()
61
- )
62
-
63
- starlette_app = Starlette(
64
- debug=True,
65
- routes=[
66
- # Mount handles the path prefix and passes raw ASGI arguments
67
- Mount("/sse", app=handle_sse),
68
- Route("/messages", endpoint=sse.handle_post_message, methods=["POST"]),
69
- ]
70
- )
46
+
47
+ # The most robust way to get the ASGI app from FastMCP (v2.3.2+)
48
+ # This app already includes the necessary SSE routes (/sse, /messages)
49
+ if hasattr(mcp, "http_app"):
50
+ app = mcp.http_app()
51
+ elif hasattr(mcp, "as_asgi_app"):
52
+ app = mcp.as_asgi_app()
53
+ else:
54
+ # Fallback to internal app if methods are missing
55
+ app = getattr(mcp, "_app", mcp)
71
56
 
72
- app = starlette_app
57
+ # Check for Auth Token
58
+ auth_token = os.environ.get("MCP_AUTH_TOKEN")
59
+ if auth_token:
60
+ print(f"🔒 Authentication enabled. Require Bearer token.")
61
+ app = AuthMiddleware(app, auth_token)
62
+
63
+ print(f"Starting SSE server on {args.host}:{args.port}...")
64
+ uvicorn.run(app, host=args.host, port=args.port)
73
65
 
74
66
  # 3. Apply Auth Middleware if token is provided
75
67
  auth_token = os.environ.get("MCP_AUTH_TOKEN")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: image-search-mcp
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: MCP server for Reverse Image Search using PicImageSearch
5
5
  Author-email: Your Name <your.email@example.com>
6
6
  License: MIT