#!/usr/bin/env python3
"""
Sample usage of Stevia Store MCP Server
This example demonstrates how to interact with the server
"""
import asyncio
from mcp.client import stdio_client
from mcp.client.stdio import stdio_client_transport
async def main():
"""Example of connecting to and using the Stevia Store MCP Server"""
# Connect to the server
async with stdio_client_transport("python3", ["src/stevia_store_server.py"]) as transport:
async with stdio_client(transport) as client:
# List available tools
tools = await client.list_tools()
print("Available tools:")
for tool in tools:
print(f" - {tool.name}: {tool.description}")
# Example: Get products
products_result = await client.call_tool("get_products")
print("\nProducts:")
print(products_result)
# Example: Add a new product
add_result = await client.call_tool("add_product", {
"name": "סטיביה דוגמה",
"category": "בדיקה",
"price": 25.0,
"cost": 15.0,
"description": "מוצר לבדיקה",
"sku": "TEST-001"
})
print("\nAdd product result:")
print(add_result)
if __name__ == "__main__":
asyncio.run(main())