MCP Server in Python
by lucianoayres
This project demonstrates an MCP server built in Python that provides basic tools like adding two numbers and retrieving an API key from the environment. It allows integration of custom tools into AI-assisted development environments like Cursor AI.
Last updated: N/A
What is MCP Server in Python?
This is an MCP (Model Context Protocol) server implemented in Python. It exposes functionalities as tools that can be called by LLM-based IDEs, enabling integration of custom tools into AI-assisted development environments.
How to use MCP Server in Python?
- Clone the repository. 2. Set up a virtual environment. 3. Install dependencies using
pip install mcp mcp[cli]
. 4. Run the server locally usingmcp dev mcp-server.py
. 5. Configure Cursor AI using the providedmcp.json
file. 6. Use natural language prompts in Cursor Composer to invoke the tools.
Key features of MCP Server in Python
MCP Integration
Addition Tool
Env Var Retrieval
CLI Support
Standard I/O Transport
Use cases of MCP Server in Python
Integrating custom tools into Cursor AI
Extending LLM-based IDE functionality
Automating tasks in development environments
Providing data retrieval capabilities to AI agents
FAQ from MCP Server in Python
What is MCP?
What is MCP?
Model Context Protocol (MCP) provides a standardized approach to integrate custom tools into AI-assisted development environments.
What tools are included in this server?
What tools are included in this server?
The server includes an add
tool that adds two numbers and a getApiKey
tool that retrieves an API key from the environment.
How do I integrate this server with Cursor AI?
How do I integrate this server with Cursor AI?
You need to configure the mcp.json
file with the correct paths to your Python executable and server script, and then place the file in your global Cursor AI configuration directory or project root.
What is the purpose of the update_config.sh script?
What is the purpose of the update_config.sh script?
The update_config.sh
script automates the configuration of your local environment by updating the mcp.json
file with the correct absolute paths for Python and the server script.
Where can I find more information about MCP?
Where can I find more information about MCP?
You can find more information on the Model Context Protocol website (modelcontextprotocol.io) and in the linked resources in the README.