Created
October 14, 2025 22:46
-
-
Save samuelcolvin/0c81bdafaa23d83767c3723bbeda5e4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # /// script | |
| # requires-python = ">=3.13" | |
| # dependencies = [ | |
| # "mcp", | |
| # "python-dotenv", | |
| # ] | |
| # /// | |
| import asyncio | |
| import os | |
| from dotenv import load_dotenv | |
| from mcp import ClientSession, StdioServerParameters | |
| from mcp.client.stdio import stdio_client | |
| load_dotenv() | |
| server_params = StdioServerParameters( | |
| command='uvx', args=['logfire-mcp@latest', '--read-token', os.environ['LOGFIRE_READ_TOKEN']] | |
| ) | |
| async def main(): | |
| async with stdio_client(server_params) as (read, write): | |
| async with ClientSession(read, write) as session: | |
| await session.initialize() | |
| tools = await session.list_tools() | |
| print('tools:', [tool.name for tool in tools.tools]) | |
| reference = await session.call_tool('schema_reference') | |
| print(reference.content[0].text) | |
| if __name__ == '__main__': | |
| asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment