Quick Start
Get started quickly with Model Context Protocol implementation
MCP Quick Start Guide
This guide provides a practical approach to implementing Model Context Protocol in your applications, with beginner-friendly explanations and examples. Follow these steps to quickly set up and understand MCP servers and clients.
Choose Your Path
If you just want to use MCP with existing applications like Claude Desktop:
1. Install Claude Desktop
Download and install Claude Desktop for your operating system.
2. Configure MCP Servers
- Open Claude Desktop
- Click on the Claude menu and select "Settings..."
- Click on "Developer" in the left sidebar
- Click "Edit Config" to open your configuration file
3. Add a Filesystem Server
Replace the file contents with this configuration (adjust the paths for your system):
Remember to replace username
with your actual username.
4. Restart Claude and Try It Out
After saving the configuration, restart Claude Desktop and you should see a hammer icon in the chat interface. You can now ask Claude to interact with files on your desktop or in your downloads folder!
You need to have Node.js installed for this example. If you don't have it yet, download it from nodejs.org.
Installation
First, set up a new project and install the MCP SDK:
Building a Simple MCP Server
Let's create a weather server that provides weather forecasts and alerts as tools.
Create your server file
Create a file named weather-server.ts
:
This is a simplified example. In a real implementation, you would connect to a weather API service to get actual forecasts and alerts.
Run your server
The server will start and wait for client connections. Since it's using stdio transport, it won't display any output until a client connects.
Test with Claude Desktop
The easiest way to test your server is to connect it to Claude Desktop:
- Open your Claude Desktop configuration file
- Add your weather server configuration:
Or for Python:
- Restart Claude Desktop
- Ask weather-related questions like "What's the weather forecast for New York?" and Claude will use your weather server.
Test with MCP Inspector
Alternatively, you can use the MCP Inspector tool to test your server:
Or for Python:
The MCP Inspector will open in your browser and allow you to interact with your server, test tools, and view logs.
Building an MCP Client
Now let's create a simple client that connects to your weather server:
Create a file named weather-client.ts
:
Run your client to test the connection to the server:
Next Steps
Congratulations! You've created your first MCP server and client. Here are some ways to expand on this foundation:
Add Resources
Enhance your server to provide data resources in addition to tools. Learn how to expose and manage resources.
Add Prompts
Create reusable prompt templates for common interactions to standardize AI workflows.
Connect to Real APIs
Replace the hardcoded responses with real API calls to external services or databases.
Deploy with SSE
Deploy your server with Server-Sent Events for remote access across the network.
Check out the Example Servers for more complete implementations and inspiration.
Debugging Tips
If you encounter issues with your MCP server or client:
- Use MCP Inspector: The best tool for testing and debugging servers
- Check Logs: MCP servers should log to stderr, not stdout
- Verify JSON Schema: Make sure your tool schemas are valid
- Test Tool Execution: Try calling your tools directly through the Inspector
- Check Claude Desktop Logs: If using Claude Desktop, check its log files for errors
For more comprehensive debugging strategies, see our Debugging Guide.
How is this guide?