Skip to main content
Glama
mcp_server_retrieve.py1.12 kB
import logging import sys import mcp_retrieve from mcp.server.fastmcp import FastMCP logging.basicConfig( level=logging.INFO, # Default to INFO level format='%(filename)s:%(lineno)d | %(message)s', handlers=[ logging.StreamHandler(sys.stderr) ] ) logger = logging.getLogger("retrieve-server") try: mcp = FastMCP( name = "mcp-retrieve", instructions=( "You are a helpful assistant. " "You retrieve documents in RAG." ), ) logger.info("MCP server initialized successfully") except Exception as e: err_msg = f"Error: {str(e)}" logger.info(f"{err_msg}") ###################################### # RAG ###################################### @mcp.tool() def retrieve(keyword: str) -> str: """ Query the keyword using RAG based on the knowledge base. keyword: the keyword to query return: the result of query """ logger.info(f"search --> keyword: {keyword}") return mcp_retrieve.retrieve(keyword) if __name__ =="__main__": print(f"###### main ######") mcp.run(transport="stdio")

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/ar-codelabs/MCP_NotionMCP_Webviewer'

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