Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ readme = "README.md"
requires-python = ">=3.11"
dependencies = [
"httpx>=0.28.1",
"mcp[cli]>=1.3.0",
"mcp[cli]>=1.8.0",
"python-dotenv>=1.0.0",
]
100 changes: 89 additions & 11 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import sys
from mcp.server.fastmcp import FastMCP
from mcp.types import ToolAnnotations
from dotenv import load_dotenv

# Configure logging to write to stderr
Expand Down Expand Up @@ -40,7 +41,14 @@ async def make_request(url: str) -> dict[str, any] | None:
return {"Error": str(e)}


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Income Statements",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_income_statements(
ticker: str,
period: str = "annual",
Expand Down Expand Up @@ -72,7 +80,14 @@ async def get_income_statements(
return json.dumps(income_statements, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Balance Sheets",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_balance_sheets(
ticker: str,
period: str = "annual",
Expand Down Expand Up @@ -104,7 +119,14 @@ async def get_balance_sheets(
return json.dumps(balance_sheets, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Cash Flow Statements",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_cash_flow_statements(
ticker: str,
period: str = "annual",
Expand Down Expand Up @@ -136,7 +158,14 @@ async def get_cash_flow_statements(
return json.dumps(cash_flow_statements, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Current Stock Price",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_current_stock_price(ticker: str) -> str:
"""Get the current / latest price of a company.

Expand All @@ -162,7 +191,14 @@ async def get_current_stock_price(ticker: str) -> str:
return json.dumps(snapshot, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Historical Stock Prices",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_historical_stock_prices(
ticker: str,
start_date: str,
Expand Down Expand Up @@ -198,7 +234,14 @@ async def get_historical_stock_prices(
return json.dumps(prices, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Company News",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_company_news(ticker: str) -> str:
"""Get news for a company.

Expand All @@ -222,7 +265,14 @@ async def get_company_news(ticker: str) -> str:
return json.dumps(news, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Available Crypto Tickers",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_available_crypto_tickers() -> str:
"""
Gets all available crypto tickers.
Expand All @@ -242,7 +292,14 @@ async def get_available_crypto_tickers() -> str:
return json.dumps(tickers, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Crypto Prices",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_crypto_prices(
ticker: str,
start_date: str,
Expand Down Expand Up @@ -272,7 +329,14 @@ async def get_crypto_prices(
return json.dumps(prices, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Historical Crypto Prices",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_historical_crypto_prices(
ticker: str,
start_date: str,
Expand Down Expand Up @@ -308,7 +372,14 @@ async def get_historical_crypto_prices(
return json.dumps(prices, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get Current Crypto Price",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_current_crypto_price(ticker: str) -> str:
"""Get the current / latest price of a crypto currency.

Expand All @@ -334,7 +405,14 @@ async def get_current_crypto_price(ticker: str) -> str:
return json.dumps(snapshot, indent=2)


@mcp.tool()
@mcp.tool(
annotations=ToolAnnotations(
title="Get SEC Filings",
readOnlyHint=True,
destructiveHint=False,
openWorldHint=True,
)
)
async def get_sec_filings(
ticker: str,
limit: int = 10,
Expand Down