Merge pull request #29 from modelcontextprotocol/justin/fixes

Various fixes
This commit is contained in:
Justin Spahr-Summers 2024-11-24 14:24:15 -06:00 • committed by GitHub
commit 5b0e033c48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 92 additions and 90 deletions

View file

@ -169,7 +169,7 @@ const debugWorkflow = {
role: "user", role: "user",
content: { content: {
type: "text", type: "text",
text: "Here's an error I'm seeing:" text: `Here's an error I'm seeing: ${error}`
} }
}, },
{ {
@ -183,7 +183,7 @@ const debugWorkflow = {
role: "user", role: "user",
content: { content: {
type: "text", type: "text",
text: error text: "I've tried restarting the service, but the error persists."
} }
} }
]; ];

View file

@ -285,6 +285,67 @@ Let's build your first MCP server in Python! We'll create a weather server that
</Step> </Step>
</Steps> </Steps>
## Connect to Claude Desktop
<Steps>
<Step title="Update Claude config">
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"weather": {
"command": "uv",
"args": "--directory path/to/your/project run weather-service",
"env": {
"OPENWEATHER_API_KEY": "your-api-key",
}
}
}
}
```
</Step>
<Step title="Restart Claude">
1. Quit Claude completely
2. Start Claude again
3. Look for your weather server in the 🔌 menu
</Step>
</Steps>
## Try it out!
<AccordionGroup>
<Accordion title="Check Current Weather" active>
Ask Claude:
```
What's the current weather in San Francisco? Can you analyze the conditions and tell me if it's a good day for outdoor activities?
```
</Accordion>
<Accordion title="Get a Forecast">
Ask Claude:
```
Can you get me a 5-day forecast for Tokyo and help me plan what clothes to pack for my trip?
```
</Accordion>
<Accordion title="Compare Weather">
Ask Claude:
```
Can you analyze the forecast for both Tokyo and San Francisco and tell me which city would be better for outdoor photography this week?
```
</Accordion>
</AccordionGroup>
## Understanding the code ## Understanding the code
<Tabs> <Tabs>
@ -445,87 +506,6 @@ import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000) uvicorn.run(app, host="0.0.0.0", port=8000)
``` ```
## Troubleshooting
### Installation issues
```bash
# Check Python version
python --version
# Reinstall dependencies
uv sync --reinstall
```
### Type checking
```bash
# Install mypy
uv add --dev pyright
# Run type checker
uv run pyright src
```
## Connect to Claude Desktop
<Steps>
<Step title="Update Claude config">
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"weather": {
"command": "uv",
"args": "--directory path/to/your/project run weather-service",
"env": {
"OPENWEATHER_API_KEY": "your-api-key",
}
}
}
}
```
</Step>
<Step title="Restart Claude">
1. Quit Claude completely
2. Start Claude again
3. Look for your weather server in the 🔌 menu
</Step>
</Steps>
## Try it out!
<AccordionGroup>
<Accordion title="Check Current Weather" active>
Ask Claude:
```
What's the current weather in San Francisco? Can you analyze the conditions and tell me if it's a good day for outdoor activities?
```
</Accordion>
<Accordion title="Get a Forecast">
Ask Claude:
```
Can you get me a 5-day forecast for Tokyo and help me plan what clothes to pack for my trip?
```
</Accordion>
<Accordion title="Compare Weather">
Ask Claude:
```
Can you analyze the forecast for both Tokyo and San Francisco and tell me which city would be better for outdoor photography this week?
```
</Accordion>
</AccordionGroup>
## Advanced features ## Advanced features
<Steps> <Steps>
@ -789,6 +769,28 @@ uv run pyright src
</Step> </Step>
</Steps> </Steps>
## Troubleshooting
### Installation issues
```bash
# Check Python version
python --version
# Reinstall dependencies
uv sync --reinstall
```
### Type checking
```bash
# Install mypy
uv add --dev pyright
# Run type checker
uv run pyright src
```
## Next steps ## Next steps
<CardGroup cols={2}> <CardGroup cols={2}>

View file

@ -15,7 +15,7 @@ Choose the path that best fits your needs:
icon="bolt" icon="bolt"
href="/quickstart" href="/quickstart"
> >
The fastest way to see MCP in action - connect example servers to Claude Desktop The fastest way to see MCP in action&mdash;connect example servers to Claude Desktop
</Card> </Card>
<Card <Card
title="Build your first server (Python)" title="Build your first server (Python)"

View file

@ -160,7 +160,7 @@ brew install node git sqlite3
This tells Claude Desktop: This tells Claude Desktop:
1. There's an MCP server named "sqlite" 1. There's an MCP server named "sqlite"
2. Launch it using the `mcp-server-sqlite` command 2. Launch it by running `uvx mcp-server-sqlite`
3. Connect it to your test database 3. Connect it to your test database
Save the file, and restart **Claude Desktop**. Save the file, and restart **Claude Desktop**.
@ -237,7 +237,7 @@ brew install node git sqlite3
This tells Claude Desktop: This tells Claude Desktop:
1. There's an MCP server named "sqlite" 1. There's an MCP server named "sqlite"
2. Launch it using the `mcp-server-sqlite` command 2. Launch it by running `uvx mcp-server-sqlite`
3. Connect it to your test database 3. Connect it to your test database
Save the file, and restart **Claude Desktop**. Save the file, and restart **Claude Desktop**.
@ -325,8 +325,8 @@ Want to give Claude Desktop more local integration capabilities? Add these serve
Add this to your config to let Claude Desktop read and analyze files: Add this to your config to let Claude Desktop read and analyze files:
```json ```json
"filesystem": { "filesystem": {
"command": "mcp-server-filesystem", "command": "npx",
"args": ["/Users/YOUR_USERNAME/Desktop"] "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/YOUR_USERNAME/Desktop"]
} }
``` ```
</Accordion> </Accordion>
@ -335,8 +335,8 @@ Want to give Claude Desktop more local integration capabilities? Add these serve
Connect Claude Desktop to your PostgreSQL database: Connect Claude Desktop to your PostgreSQL database:
```json ```json
"postgres": { "postgres": {
"command": "mcp-server-postgres", "command": "npx",
"args": ["postgresql://localhost/mydb"] "args": ["-y", "@modelcontextprotocol/server-postgres", "postgresql://localhost/mydb"]
} }
``` ```
</Accordion> </Accordion>