Skip to main content
Glama

Simple FastMCP Server

by zongjieshen
client.py1.05 kB
import asyncio from fastmcp import Client # Add your FastMCP Cloud API key here API_KEY = "fmcp_B6_S9f81eWKNDPEZIA6V0yHNnHJNg_HBj5IS1mo2AT8" # Configuration-based client to include headers (per FastMCP Client docs) config = { "mcpServers": { "server": { "transport": "http", "url": "https://zongjie-mcp-server-test.fastmcp.app/mcp", "headers": {"Authorization": f"Bearer {API_KEY}"}, } } } client = Client(config) async def main(): async with client: # Basic server interaction await client.ping() # List available operations tools = await client.list_tools() resources = await client.list_resources() prompts = await client.list_prompts() # Execute operations # With configuration-based clients, tools are prefixed with the server name key result = await client.call_tool("greet", {"name": "FastMCP"}) print(tools) print(resources) print(prompts) asyncio.run(main())

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/zongjieshen/mcp-server'

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