From: Edward Delaporte Date: Sun, 26 Jul 2026 23:37:08 +0000 (-0500) Subject: WIP - convert to MCP skill X-Git-Url: https://apps.delaporte.us/gitweb/matrix-shop-bot.git/commitdiff_plain/bd322769fbd795e4cc1cb022a4af90d42911c1b3?ds=inline WIP - convert to MCP skill --- diff --git a/Makefile b/Makefile index 4760758..c8e3458 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ MODULE=matrix_shop_bot python -m venv .venv .venv/bin/pip install . +.venv-llm: + python -m venv .venv + .venv/bin/pip install -e ".[llm]" + serve: .venv .venv/bin/python app.py diff --git a/mcp.py b/mcp.py new file mode 100644 index 0000000..50a2eff --- /dev/null +++ b/mcp.py @@ -0,0 +1,45 @@ +from fastmcp import FastMCP +from matrix_shop_bot.db import Data + +mcp = FastMCP("Shop Bot") + +@mcp.tool +def add_item(name: str) -> list[str]: + return Data().add_item(name) + +@mcp.tool +def buy(items:str) -> list[str]: + return Data().purchase_items(items) + +@mcp.tool +def list_bought(store:str) -> list[str]: + return Data().list_purchases(store) + +@mcp.tool +def clear(store_name: str, clear_all:bool=False) -> list[str]: + return Data().clear_list(store_name, clear_all) + + +@mcp.tool +def shop_at(store_name:str) -> list[str]: + '''Select store to shop at''' + return Data().get_shopping_list(store_name) + + +@mcp.tool +def list() -> list[str]: + '''Use previous store''' + return Data().get_last_shopping_list() + + +@mcp.tool +def list_stores() -> list[str]: + return Data().get_stores() + + +@mcp.tool +def list_purchases(store: str) -> list[str]: + return Data().list_purchases(store) + +if __name__ == "__main__": + mcp.run() diff --git a/pyproject.toml b/pyproject.toml index 4c0329a..68e0183 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,6 +14,7 @@ dependencies = [ [project.optional-dependencies] test = ['mypy'] +llm = ['fastmcp'] # pip install -e ".[llm]" [tool.setuptools.packages.find] exclude = ["service*", "store*", "backups*"]