mCP Hands-On Tutorial Summary
Key Concepts:
- mCP (Model Context Protocol): Universal USB port for AI, enabling AI agents to interact with external systems.
- Cloe Desktop: Cloe running as a local application.
- Cursor: Code editor with AI integration.
- Windsurf: Another platform for AI integration.
- fastmCP: A library for creating mCP servers.
- Yahoo Finance: A library for retrieving stock prices.
- Neon: Serverless PostgreSQL database.
- smithery.gl.a: A website to find existing mCPs.
1. Introduction to mCP
- mCP is described as a "Universal USB port for AI," allowing AI agents to connect to external systems and significantly enhance their capabilities.
- A basic AI agent can read/write code, create/delete files, and run terminal commands. With mCP, it can access databases, APIs, private data, and interact with applications.
- The video highlights the evolution from simple chatbots to single agents, then multiple agents, and now multiple agents with external tools via mCP.
- mCP addresses the limitations of isolated code generation by enabling access to browser consoles, network tabs, asset generation, and API integration.
2. Creating a Custom mCP Server (Stock Price Example)
- The video demonstrates creating a custom mCP server to retrieve stock prices using Yahoo Finance.
- Step-by-step process:
-
Install required packages:
pip install mCP-cli Yahoo-finance -
Create a file named
app.py -
Import necessary libraries:
import yfinance as yfandfrom mCP_server.fastmCP import fastMC CP -
Initialize
fastMC CP:mCP = fastMC CP(name="Stock Prices") -
Define a function to get the stock price:
def get_stock_price(ticker_symbol: str) -> float: ticker = yf.Ticker(ticker_symbol) current_price = ticker.fast_info.last_price return current_price -
Register the function as an mCP tool:
@mCP.tool def get_stock_price(ticker_symbol: str) -> float: ticker = yf.Ticker(ticker_symbol) current_price = ticker.fast_info.last_price return current_price -
Run the mCP server:
if __name__ == "__main__": mCP.run(transport="stdio") -
In Cloe Desktop, edit the configuration file (
edit configin the developer settings). -
Add a new entry with the path to the
app.pyfile and the Python command (obtained usingwhich python). -
Restart Cloe Desktop.
-
- The example uses the
yfinancelibrary to fetch real-time stock prices. - The presenter emphasizes the simplicity of creating an mCP server using this method.
3. Integrating with Cloe Desktop
- After creating the mCP server, the video shows how to integrate it with Cloe Desktop.
- The configuration involves specifying the path to the Python executable and the
app.pyscript in the Cloe Desktop settings. - Once configured, Cloe Desktop can use the mCP tool to answer questions like "Get the stock price of Apple."
- The video demonstrates how to grant permission for the chat to access the mCP tool.
4. Integrating with Cursor
- The video explains how to integrate existing mCP servers (like the Neon database mCP) into Cursor.
- It references websites like smithery.gl.a for finding existing mCPs.
- Step-by-step process:
- Obtain the mCP command from a source like smithery.gl.a (requires an API key for Neon).
- Open Cursor settings and navigate to the mCP section.
- Add a new mCP server, providing a name (e.g., "Neon") and the command.
- Save the configuration.
- Cursor then displays the available functions from the mCP server (e.g., "list projects").
- The video demonstrates using the "list projects" function to retrieve project details from a Neon database.
5. Integrating with Windsurf
- The video briefly touches on integrating mCP with Windsurf.
- Windsurf has an mCP icon for configuration.
- The configuration process is similar to Cloe Desktop and Cursor, involving specifying the command for the mCP server.
- After configuration and a refresh, Windsurf can access the mCP tools.
- The example shows Windsurf using the Neon mCP to "list the branches in Neon."
6. Neon Database Integration
- The video showcases a use case of integrating with a Neon serverless PostgreSQL database.
- Neon automatically shuts down when not in use, saving costs.
- With mCP, users can create applications that interact with their database directly from Cursor, including creating schemas, getting database status, and saving data.
7. Conclusion
- The video provides a basic example of creating a custom mCP and integrating it with different IDEs.
- The presenter encourages viewers to explore mCP further and suggests watching another video on creating custom mCPs for a more complete understanding.
- The presenter will put all the code in the description below for the viewers to try out.
Notable Quotes:
- "mCP is nothing but an Universal USB port for AI."
- "Previously it's limited code generation isolated from your development environments unable to access external resources but with m CP you are able to access browser console logs Network tabs generate assets integrate with apis connect to any service you need."
- "With just one bit of command you are able to create a custom mCP."
- "I haven't seen any other easy method to create mCP and this is the easiest way to implement mCP."
Main Takeaways:
- mCP is a powerful tool for extending the capabilities of AI agents by connecting them to external systems.
- Creating custom mCP servers is relatively simple using the
fastmCPlibrary. - mCP can be integrated with various IDEs and platforms, including Cloe Desktop, Cursor, and Windsurf.
- Real-world applications include accessing databases, APIs, and other services directly from within a development environment.
AI summaries can miss context or contain errors. Check important details against the original video.





