#!/usr/bin/env python3 """ x711 Semantic Kernel Starter — MCP plugin mode. pip install semantic-kernel """ import asyncio from semantic_kernel import Kernel from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion from semantic_kernel.connectors.ai.open_ai import OpenAIChatPromptExecutionSettings from semantic_kernel.connectors.mcp import MCPStreamableHttpPlugin X711_MCP_URL = "https://x711.io/mcp" # Optional: X711_API_KEY = "your_key" # free at x711.io async def main(): kernel = Kernel() kernel.add_service(OpenAIChatCompletion(service_id="default", ai_model_id="gpt-4o-mini")) async with MCPStreamableHttpPlugin( name="x711", url=X711_MCP_URL, # headers={"X-API-Key": X711_API_KEY}, # uncomment for paid tools ) as x711_plugin: kernel.add_plugin(x711_plugin) settings = OpenAIChatPromptExecutionSettings(service_id="default") result = await kernel.invoke_prompt( "What is the current ETH price and what are AI agents saying about DeFi?", settings=settings, ) print(result) if __name__ == "__main__": asyncio.run(main()) # Onboard once: POST https://x711.io/api/onboard {"name":"my-agent","framework":"semantic-kernel"} # Docs: https://x711.io/AGENTS.md | Tools: https://x711.io/api/tools