Building Your Own MCP Server for AI
Connect It to an AI Client
Point Cursor or Claude Desktop at your stdio server and actually invoke a tool from the assistant.
A server that only runs under mcp dev is a lab. This lesson wires the host you already use so the model can call ping or greet in a real chat.
What the host needs
- A command it can exec (the venv’s
python, not a global one that lacksmcp). - Args — usually the path to
server.py. - A working directory if the script reads relative files.
Cursor
Project or user MCP config is JSON. A typical project file is .cursor/mcp.json:
{
"mcpServers": {
"hello": {
"command": "C:\\\\path\\\\to\\\\hello-mcp\\\\.venv\\\\Scripts\\\\python.exe",
"args": ["C:\\\\path\\\\to\\\\hello-mcp\\\\server.py"]
}
}
}On macOS or Linux use the venv’s bin/python and normal slashes. Restart Cursor (or reload MCP) after you save. The server name hello is what you will see in the tools list.
Claude Desktop
Claude Desktop uses a similar mcpServers map in its config JSON (location depends on OS). Same idea: absolute command and args. Quit the app fully after edits — a tray restart often keeps the old process.
Use a tool on purpose
- Start a new chat and ask a question that requires the tool (“Call ping on my hello server”).
- Approve the tool call if the host asks.
- Confirm the reply includes
pongor your greeting, not a hallucination.