From dc612222af12968465c38b7aa9fe96a1741e2d4f Mon Sep 17 00:00:00 2001 From: gyx09212214-prog <243787584+gyx09212214-prog@users.noreply.github.com> Date: Thu, 11 Jun 2026 11:58:29 +0800 Subject: [PATCH] Add pip console script --- README.md | 24 ++++++++++++++++-------- pyproject.toml | 14 ++++++++++++-- server.py | 8 +++++++- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index fe2d10c..efcbe86 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,11 @@ This MCP server provides the following tools: ``` + Or install the server as a local Python package: + ```bash + pip install . + ``` + 4. Set up environment variables: ```bash # Create .env file for your API keys @@ -69,6 +74,11 @@ This MCP server provides the following tools: uv run server.py ``` + If installed with `pip install .`, run: + ```bash + financial-datasets-mcp + ``` + ## Connecting to Claude Desktop 1. Install [Claude Desktop](https://claude.ai/desktop) if you haven't already @@ -85,19 +95,17 @@ This MCP server provides the following tools: { "mcpServers": { "financial-datasets": { - "command": "/path/to/uv", - "args": [ - "--directory", - "/absolute/path/to/financial-datasets-mcp", - "run", - "server.py" - ] + "command": "financial-datasets-mcp", + "args": [] } } } ``` - Replace `/path/to/uv` with the result of `which uv` and `/absolute/path/to/financial-datasets-mcp` with the absolute path to this project. + If you prefer using `uv` from a source checkout, keep `command` set to the + absolute path returned by `which uv` and pass `--directory`, + `/absolute/path/to/financial-datasets-mcp`, `run`, and `server.py` in + `args`. 4. Restart Claude Desktop diff --git a/pyproject.toml b/pyproject.toml index 9aa3f2c..84e97b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] -name = "mcp-server" +name = "financial-datasets-mcp-server" version = "0.1.0" -description = "Add your description here" +description = "MCP server for the Financial Datasets stock market API" readme = "README.md" requires-python = ">=3.11" dependencies = [ @@ -9,3 +9,13 @@ dependencies = [ "mcp[cli]>=1.3.0", "python-dotenv>=1.0.0", ] + +[project.scripts] +financial-datasets-mcp = "server:main" + +[build-system] +requires = ["setuptools>=77"] +build-backend = "setuptools.build_meta" + +[tool.setuptools] +py-modules = ["server"] diff --git a/server.py b/server.py index b605551..34d9aa6 100644 --- a/server.py +++ b/server.py @@ -365,7 +365,9 @@ async def get_sec_filings( # Stringify the SEC filings return json.dumps(filings, indent=2) -if __name__ == "__main__": + +def main() -> None: + """Run the Financial Datasets MCP server.""" # Log server startup logger.info("Starting Financial Datasets MCP Server...") @@ -374,3 +376,7 @@ async def get_sec_filings( # This line won't be reached during normal operation logger.info("Server stopped") + + +if __name__ == "__main__": + main()