Skip to main content
Glama

MCP Agents

by amajakai14
client_example.py1.89 kB
""" MCP Client Example - How to connect to and use your MCP server This shows how to connect to your MCP server from another Python application or from LLM applications like Claude Desktop. """ import asyncio from fastmcp import Client async def test_mcp_server(): """Test the MCP server by calling its tools.""" # Connect to your local MCP server # When running, your server will be available at stdio or a specific URL print("Testing MCP Server Connection...") # Example of how a client would connect (when server is running) # async with Client("stdio:python advanced_mcp_server.py") as client: # # # Call a tool # result = await client.call_tool( # name="add_note", # arguments={ # "title": "My First Note", # "content": "This is a test note created via MCP", # "tags": ["test", "mcp"] # } # ) # print(f"Tool result: {result}") # # # Get a resource # resource = await client.get_resource("notes://all") # print(f"Resource content: {resource}") # # # Get a prompt # prompt = await client.get_prompt("note_summarizer", arguments={"note_ids": [1]}) # print(f"Generated prompt: {prompt}") print("Note: Uncomment the client code above when server is running") # Claude Desktop Configuration CLAUDE_CONFIG = { "mcpServers": { "mcp-agents": { "command": "python", "args": ["/Users/means/repository/mcp-agents/advanced_mcp_server.py"], "env": {} } } } if __name__ == "__main__": print("MCP Client Configuration Example") print("=" * 50) print() print("To use with Claude Desktop, add this to your config:") print(CLAUDE_CONFIG) print() asyncio.run(test_mcp_server())

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/amajakai14/mcp-agents'

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