diff --git a/pyproject.toml b/pyproject.toml index dd8fe01..cac8aa3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "unsplash-mcp-server" version = "0.1.0" -description = "Add your description here" +description = "MCP server for searching Unsplash photos" readme = "README.md" requires-python = ">=3.11" dependencies = [ @@ -9,3 +9,9 @@ dependencies = [ "httpx>=0.26.0", "python-dotenv>=1.1.0", ] + +[project.scripts] +unsplash-mcp-server = "server:main" + +[tool.setuptools] +py-modules = ["server"] diff --git a/server.py b/server.py index 3fd6065..187c780 100644 --- a/server.py +++ b/server.py @@ -112,3 +112,21 @@ async def search_photos( except Exception as e: print(f"Request error: {str(e)}") raise + + +def main(): + """Entry point for uvx remote execution.""" + import sys + import io + + # Ensure UTF-8 encoding for stdout/stderr + if sys.stdout.encoding != 'utf-8': + sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8') + if sys.stderr.encoding != 'utf-8': + sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8') + + mcp.run() + + +if __name__ == "__main__": + main()