Skip to main content
Glama
resources_mcp_client.py959 B
from mcp import ClientSession, StdioServerParameters from mcp.client.stdio import stdio_client import asyncio async def main(): server_params = StdioServerParameters( command="uv", args=["run", "resources_mcp_server.py"] ) async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as session: await session.initialize() # List all resources resources = await session.list_resources() print(resources) # Read a specific resource resource = await session.read_resource("inventory://overview") for r in resources.resources: print(f"\n📦 {r.name}") print(f" URI: {r.uri}") print(f" Description: {r.description}") print("\n📄 Resource Contents:") print(resource.contents[0].text) asyncio.run(main())

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sritajkumarpatel/learn_mcp_2025'

If you have feedback or need assistance with the MCP directory API, please join our Discord server