Skip to main content
Glama
resources_mcp_server.py1.1 kB
from mcp.server.fastmcp import FastMCP # Initialize the MCP server for prompting an MCP client mcp = FastMCP("Resources MCP Client") @mcp.resource("inventory://overview") def get_inventory_overview() -> str: """ Send a resource request to the MCP client and return the response. Args: resource_name: The name of the resource to request from the MCP client. Returns: A string containing the MCP client's response. """ overview = """Inventory Overview: - Item A: 100 units - Item B: 250 units - Item C: 75 units" """ return overview.strip() @mcp.resourcee("inventory://{inventory_id}/price") def get_inventory_price(inventory_id: str) -> str: """ Get the price of a specific inventory item. Args: inventory_id: The ID of the inventory item. Returns: A string containing the price of the inventory item. """ prices = { "A": "$10", "B": "$20", "C": "$15" } return prices.get(inventory_id, "Price not available") if __name__ == "__main__": mcp.run()

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