Mahesh's suggestions
This commit is contained in:
parent
1a3cc6d43d
commit
6d6e4ccf38
2 changed files with 22 additions and 22 deletions
|
|
@ -9,7 +9,7 @@ In this tutorial, we'll build a simple MCP weather server and connect it to a ho
|
||||||
|
|
||||||
Many LLMs (including Claude) do not currently have the ability to fetch the forecast and severe weather alerts. Let's use MCP to solve that!
|
Many LLMs (including Claude) do not currently have the ability to fetch the forecast and severe weather alerts. Let's use MCP to solve that!
|
||||||
|
|
||||||
We'll build a server that exposes two tools: `get-alerts` and `get-forecast`. Then we'll connect the server to an MCP host (in this case, Claude Desktop):
|
We'll build a server that exposes two tools: `get-alerts` and `get-forecast`. Then we'll connect the server to an MCP host (in this case, Claude for Desktop):
|
||||||
|
|
||||||
<Frame>
|
<Frame>
|
||||||
<img src="/images/weather-alerts.png" />
|
<img src="/images/weather-alerts.png" />
|
||||||
|
|
@ -19,10 +19,10 @@ We'll build a server that exposes two tools: `get-alerts` and `get-forecast`. Th
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
Servers can connect to any host. We've chosen Claude desktop here for simplicity, but we also have guides on [building your own client](/tutorials/building-a-client)
|
Servers can connect to any client. We've chosen Claude desktop here for simplicity, but we also have guides on [building your own client](/tutorials/building-a-client)
|
||||||
</Note>
|
</Note>
|
||||||
|
|
||||||
<Accordion title="Why Claude Desktop and not Claude.ai?">
|
<Accordion title="Why Claude for Desktop and not Claude.ai?">
|
||||||
Because servers are locally run, MCP currently only supports desktop hosts. Remote hosts are in active development.
|
Because servers are locally run, MCP currently only supports desktop hosts. Remote hosts are in active development.
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
|
|
@ -398,12 +398,12 @@ Let's now test your server from an existing MCP host, Claude for Desktop.
|
||||||
## Testing your server with Claude for Desktop
|
## Testing your server with Claude for Desktop
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
Unfortunately, Claude for Desktop is not yet available on Linux. Linux users can proceed to the [Building a client](/tutorials/building-a-client) tutorial for a workaround.
|
Claude for Desktop is not yet available on Linux. Linux users can proceed to the [Building a client](/tutorials/building-a-client) tutorial to build an MCP client that connects to the server we just built.
|
||||||
</Note>
|
</Note>
|
||||||
|
|
||||||
First, make sure you have Claude for Desktop installed. [You can install the latest version here.](https://claude.ai/download)
|
First, make sure you have Claude for Desktop installed. [You can install the latest version here.](https://claude.ai/download)
|
||||||
|
|
||||||
Next, open your Claude Desktop App configuration at `~/Library/Application Support/Claude/claude_desktop_config.json` in a text editor.
|
Next, open your Claude for Desktop App configuration at `~/Library/Application Support/Claude/claude_desktop_config.json` in a text editor.
|
||||||
|
|
||||||
For example, if you have [VS Code](https://code.visualstudio.com/) installed:
|
For example, if you have [VS Code](https://code.visualstudio.com/) installed:
|
||||||
|
|
||||||
|
|
@ -432,7 +432,7 @@ Add this configuration (replace the parent folder path):
|
||||||
"command": "uv",
|
"command": "uv",
|
||||||
"args": [
|
"args": [
|
||||||
"--directory",
|
"--directory",
|
||||||
"/PATH/TO/PARENT/FOLDER/weather",
|
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
|
||||||
"run",
|
"run",
|
||||||
"weather"
|
"weather"
|
||||||
]
|
]
|
||||||
|
|
@ -449,7 +449,7 @@ Add this configuration (replace the parent folder path):
|
||||||
"command": "uv",
|
"command": "uv",
|
||||||
"args": [
|
"args": [
|
||||||
"--directory",
|
"--directory",
|
||||||
"C:\\PATH\TO\PARENT\FOLDER\weather",
|
"C:\\ABSOLUTE\PATH\TO\PARENT\FOLDER\weather",
|
||||||
"run",
|
"run",
|
||||||
"weather"
|
"weather"
|
||||||
]
|
]
|
||||||
|
|
@ -460,11 +460,11 @@ Add this configuration (replace the parent folder path):
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
This tells Claude Desktop:
|
This tells Claude for Desktop:
|
||||||
1. There's an MCP server named "weather"
|
1. There's an MCP server named "weather"
|
||||||
2. Launch it by running `uv --directory /PATH/TO/PARENT/FOLDER/weather run weather`
|
2. Launch it by running `uv --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/weather run weather`
|
||||||
|
|
||||||
Save the file, and restart **Claude Desktop**.
|
Save the file, and restart **Claude for Desktop**.
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab title="Node">
|
<Tab title="Node">
|
||||||
### Prerequisite knowledge
|
### Prerequisite knowledge
|
||||||
|
|
@ -916,7 +916,7 @@ Unfortunately, Claude for Desktop is not yet available on Linux. Linux users can
|
||||||
|
|
||||||
First, make sure you have Claude for Desktop installed. [You can install the latest version here.](https://claude.ai/download)
|
First, make sure you have Claude for Desktop installed. [You can install the latest version here.](https://claude.ai/download)
|
||||||
|
|
||||||
Next, open your Claude Desktop App configuration at `~/Library/Application Support/Claude/claude_desktop_config.json` in a text editor.
|
Next, open your Claude for Desktop App configuration at `~/Library/Application Support/Claude/claude_desktop_config.json` in a text editor.
|
||||||
|
|
||||||
For example, if you have [VS Code](https://code.visualstudio.com/) installed:
|
For example, if you have [VS Code](https://code.visualstudio.com/) installed:
|
||||||
|
|
||||||
|
|
@ -945,7 +945,7 @@ Add this configuration (replace the parent folder path):
|
||||||
"weather": {
|
"weather": {
|
||||||
"command": "node",
|
"command": "node",
|
||||||
"args": [
|
"args": [
|
||||||
"/PATH/TO/PARENT/FOLDER/weather/build/index.js"
|
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather/build/index.js"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -971,17 +971,17 @@ Add this configuration (replace the parent folder path):
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
This tells Claude Desktop:
|
This tells Claude for Desktop:
|
||||||
1. There's an MCP server named "weather"
|
1. There's an MCP server named "weather"
|
||||||
2. Launch it by running `node /PATH/TO/PARENT/FOLDER/weather/build/index.js`
|
2. Launch it by running `node /ABSOLUTE/PATH/TO/PARENT/FOLDER/weather/build/index.js`
|
||||||
|
|
||||||
Save the file, and restart **Claude Desktop**.
|
Save the file, and restart **Claude for Desktop**.
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|
||||||
### Test with commands
|
### Test with commands
|
||||||
|
|
||||||
First, make sure Claude Desktop is picking up the two tools we've exposed in our `weather` server. You can do this by looking for the hammer <img src="/images/claude-desktop-mcp-hammer-icon.svg" style={{display: 'inline', margin: 0, height: '1.3em'}} /> icon:
|
First, make sure Claude for Desktop is picking up the two tools we've exposed in our `weather` server. You can do this by looking for the hammer <img src="/images/claude-desktop-mcp-hammer-icon.svg" style={{display: 'inline', margin: 0, height: '1.3em'}} /> icon:
|
||||||
|
|
||||||
<Frame>
|
<Frame>
|
||||||
<img src="/images/visual-indicator-mcp-tools.png" />
|
<img src="/images/visual-indicator-mcp-tools.png" />
|
||||||
|
|
@ -993,9 +993,9 @@ After clicking on the hammer icon, you should see two tools listed:
|
||||||
<img src="/images/available-mcp-tools.png" />
|
<img src="/images/available-mcp-tools.png" />
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
If your server isn't being picked up by Claude Desktop, proceed to the **Troubleshooting** section for debugging advice.
|
If your server isn't being picked up by Claude for Desktop, proceed to the [Troubleshooting](#troubleshooting) section for debugging advice.
|
||||||
|
|
||||||
You can now test your server by running the following commands in Claude Desktop:
|
You can now test your server by running the following commands in Claude for Desktop:
|
||||||
|
|
||||||
- What's the weather in Sacramento?
|
- What's the weather in Sacramento?
|
||||||
- What are the active weather alerts in Texas?
|
- What are the active weather alerts in Texas?
|
||||||
|
|
@ -1043,11 +1043,11 @@ Fix:
|
||||||
|
|
||||||
This isn't an error - it just means there are no current weather alerts for that state. Try a different state or check during severe weather.
|
This isn't an error - it just means there are no current weather alerts for that state. Try a different state or check during severe weather.
|
||||||
</Accordion>
|
</Accordion>
|
||||||
<Accordion title="Claude Desktop Integration Issues">
|
<Accordion title="Claude for Desktop Integration Issues">
|
||||||
**Server not showing up in Claude**
|
**Server not showing up in Claude**
|
||||||
1. Check your configuration file syntax
|
1. Check your configuration file syntax
|
||||||
2. Make sure the path to your project is correct
|
2. Make sure the path to your project is correct
|
||||||
3. Restart Claude Desktop completely
|
3. Restart Claude for Desktop completely
|
||||||
|
|
||||||
You can also check Claude's logs for errors like so:
|
You can also check Claude's logs for errors like so:
|
||||||
```bash
|
```bash
|
||||||
|
|
@ -1061,7 +1061,7 @@ If Claude attempts to use the tools but they fail:
|
||||||
|
|
||||||
1. Check Claude's logs for errors
|
1. Check Claude's logs for errors
|
||||||
2. Verify your server runs without errors
|
2. Verify your server runs without errors
|
||||||
3. Try restarting Claude Desktop
|
3. Try restarting Claude for Desktop
|
||||||
</Accordion>
|
</Accordion>
|
||||||
</AccordionGroup>
|
</AccordionGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -306,7 +306,7 @@ uv run client.py path/to/build/index.js # node server
|
||||||
```
|
```
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
If you're continuing the weather tutorial from the quickstart, you might have to initialize the server with `uv --directory /PATH/TO/PARENT/weather run weather`
|
If you're continuing the weather tutorial from the quickstart, your command might look something like this: `python client.py .../weather/src/weather/server.py`
|
||||||
</Note>
|
</Note>
|
||||||
|
|
||||||
The client will:
|
The client will:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue