We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pearch-ai/mcp_pearch'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
from fastmcp import FastMCP
import os
import urllib.request
import urllib.parse
import json
from typing import List, Dict, Any
mcp = FastMCP("Pearch_MCP")
@mcp.tool()
def search_people(
query: str,
search_type: str = "fast",
limit: int = 5,
timeout: int = 1800
) -> List[Dict[str, Any]]:
api_key = os.environ.get("PEARCH_API_KEY")
if not api_key:
raise ValueError("PEARCH_API_KEY environment variable is not set")
base_url = "https://api.pearch.ai/v1/search"
params = {
"query": query,
"type": search_type,
"limit": limit,
"timeout": timeout
}
url = base_url + "?" + urllib.parse.urlencode(params)
headers = {
"accept": "application/json",
"Authorization": f"Bearer {api_key}"
}
req = urllib.request.Request(url, headers=headers, method="GET")
with urllib.request.urlopen(req, timeout=timeout) as resp:
if resp.getcode() != 200:
raise RuntimeError(f"HTTP {resp.getcode()}")
return json.load(resp)
if __name__ == "__main__":
mcp.run()