- Home
- MCP servers
- MCP Guide
MCP Guide
- python
9
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You set up an MCP server to expose tools that a connected AI model can call to access data and perform actions. This lets you extend the model’s capabilities with custom functions and external data sources, controlled through a lightweight, programmable interface.
How to use
Connect your MCP client to a running MCP server to fetch the list of available tools. The client then calls those tools through the established transport, and the model receives the results for further processing. You can use tools like information search, simple calculations, text transformations, and greetings to compose complex tasks for your AI model.
Typical usage flow: start the MCP server, connect the client, retrieve the tools, and invoke the ones you need from your agent. Tools are designed to be straightforward function calls, so you can compose them into prompts and automate common tasks without implementing custom API calls in your application.
How to install
Prerequisites: you need Python and a compatible runtime. Ensure you have Python 3.8+ and a working internet connection.
pip install -r requirements.txt
Create a configuration file with your API keys and server URL. Use placeholders if you don’t have real keys yet.
GROQ_API=your_groq_api_key_here
MODEL_NAME=llama3-8b-8192
MCP_SERVER_URL=http://127.0.0.1:8000
TAVILY_API=your_tavily_api_key_here
Start the MCP server using one of the supported commands. Choose the local, stdio-based server for development or debugging.
python mcp_server.py
or
fastmcp run mcp_server.py
After the server is running, start your client code that connects to the MCP server and requests tools, then perform tool invocations as needed.
Configuration and troubleshooting
Environment variables shown are required for running and authorizing the MCP server and its tools. Keep them in a secure place and do not share keys publicly.
If you encounter issues connecting, verify that the server is running, the URL is reachable, and the client is configured to point to the correct MCP server URL.
If you see transport-related errors, ensure you are using the stdio path for local development or a proper HTTP transport with server-sent events enabled for remote configurations.
Extending functionality
You can add new tools to the MCP server by defining functions and exposing them through the MCP tool interface. For example, you can implement an arithmetic tool or a simple weather lookup function to fetch live data from an API.
After adding new tools, restart the MCP server so the tools become available to clients and agents.
Notes on transports
The MCP supports multiple transports. stdio is recommended for local development due to its simplicity and reliability, while streamable-http suits web applications that benefit from HTTP streaming.
Available tools
tavily_search
Search the internet for information using Tavily-backed sources and return relevant results.
add
Compute the sum of two integers a and b and return the result.
reverse
Reverse the characters in a given text string.
greet
Generate a friendly greeting for a given name.