Introduction
LLMs have a cutoff date and relies on web search to get the most current data. It often hallucinates by using a unreliable source or outdated training data. In this tutorial, we’ll build a simple Tako MCP Server that clients can use to search Tako for real-time data and ground their answer based on authoritative sources.Prerequisites
- Tako API key
- Python >= 3.9 or TypeScript >= 5.1.6
- Python Tako SDK or TypeScript Tako SDK
- MCP Server SDK
Building Tako MCP
Starting your project
Let’s start by creating a new project directory using uv and install necessary packagesInitialize MCP Server and Tako client
We will need to import all the necessary modules and initialize MCP Server and Tako client.TAKO_API_KEY
which is passed from an environment variable. We will configure the environment variable when we connect our server to a client.Write Search Tako tool
We will write a tool that takes in client’s input as a string and search Tako by callingknowledge_search
from the Tako client.Also add a docstring description so the client can understand the functionality of the tool.Add a prompt to optimize your query
Although Tako can take any natural language queries, we can add a prompt for the client to use to fine-tune their queries to Tako. Check out this guide for more information!Server Initialization
Now add a line to start your server when the code runs.Add Tako MCP Server to Claude Desktop
Add the following to your .cursor/mcp.json or claude_desktop_config.json (MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json)Python
Query Tako MCP using Claude Desktop
Try using the prompt we created above and query Tako.- Query Input: “Compare Magnificent 7 stock companies on relevant metrics.”
- Chat Input: Write me a research report on the magnificent 7 companies. Embed the result in an iframe whenever necessary