What is MCP?
According to modelcontextprotocol.io
MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications. Just as USB-C provides a standardized way to connect your devices to various peripherals and accessories, MCP provides a standardized way to connect AI models to different data sources and tools.
How it works?
A minimum setup consists of an MCP client, an MCP server, and an LLM. The client is set up to connect with the server and knows what the server is capable of via the MCP.
When the user enters a prompt, LLM checks (via MCP client) if an external tool is needed to complete its response. If such a tool exists, it constructs a request to the MCP server. Once the server responds, the LLM analyzes it and decides the next step. This process repeats until the LLM has enough data to respond to the user.
In this demo, the MCP client is Cursor App and the MCP servers are Notion & MySQL.
Sample 1: Integration with Notion
1) Follow the steps at https://github.com/makenotion/notion-mcp-server to set up Notion and get an integration token.
2) Open the Cursor's settings page and look for the MCP Servers menu.
3) Create a new Global MCP server
{
"mcpServers": {
"notionApi": {
"command": "npx",
"args": [
"-y",
"@notionhq/notion-mcp-server"
],
"env": {
"OPENAPI_MCP_HEADERS": "{\"Authorization\": \"Bearer ntn_xxxx\", \"Notion-Version\": \"2022-06-28\" }"
}
}
}
}
4) Save the integration.
5) Now, we can test it. For example, explain a code block and send the explanation to a Notion Page.
6) We can check in the Notion App, a new page is created.
Sample 2: Integration with MySQL Server
1) Next we try to connect to a MySQL Server. We want to understand what a specific schema does, followed by a summary of its content.
2) We will be using the MCP server here: https://github.com/benborla/mcp-server-mysql
3) First, we create a read-only credential for the schema we want to use.
4) Then, we set up the connection in the Cursor App.
{
"mcpServers": {
"MySQL": {
"command": "npx",
"args": [
"mcprunner",
"MYSQL_HOST=127.0.0.1",
"MYSQL_PORT=3306",
"MYSQL_USER=user",
"MYSQL_PASS=pw",
"MYSQL_DB=sample_pos",
"ALLOW_INSERT_OPERATION=false",
"ALLOW_UPDATE_OPERATION=false",
"ALLOW_DELETE_OPERATION=false",
"--",
"npx",
"-y",
"@benborla29/mcp-server-mysql"
]
}
}
}
5) If the connection is successful, we can see 2 MCP servers now.
6) We can ask questions about the Database schema or its data.
7) We can also get some summary.