mcp-quickstart-anthropic

An MCP Client and weather MCP Server built with Python following the quickstart guide

GitHub Stars

0

User Rating

Not Rated

Forks

0

Issues

0

Views

2

Favorites

0

README
MCP Client and MCP Server Quickstart

References
Result
Running Weather MCP server using Claude Desktop as MCP Host
  • note: Claude Desktop is an example of MCP Host that can automatically create MCP Clients based on the configuration file.

Running Weather MCP Server using CLI as MCP Host and MCP Client that's created

Learning Notes
Notes
  • MCP Client can developed both on the frontend side or on the backend side. In this example the MCP client are build using the Python backend.
  • It's important to know the different between MCP Host and MCP Client
    • MCP host as 1 to n relationship to MCP Clients
    • MCP client has 1 to 1 relationship their respective MCP Server
Tips & Trics
  • Use this to list mcp server

    ps aux | grep "weather.py" | grep -v grep
    
  • example how to kill server

    kill 79200 79199
    
  • how to open the claude config file

    code ~/Library/Application\ Support/Claude/claude_desktop_config.json
    
  • If you are using virtual environment, make sure to do this

    # Create virtual environment and activate it
    uv venv
    source .venv/bin/activate
    
    # Install dependencies
    uv add "mcp[cli]" httpx
    
  • make sure to install mcp server

    uv run mcp install main.py
    # change main.py to your entry filename
    
  • How to resolve the issue of Claude Desktop kept on showing me error "MCP <serverName>: spawn uv ENOENT" and "Could not connect MCP server <serverName>".

    1. identify uv location

      which uv
      # /Users/shafie/.local/bin/uv
      
    2. open the config file

      code ~/Library/Application\ Support/Claude/claude_desktop_config.json
      
    3. update the "command": "uv" to "command": "/Users/shafie/.local/bin/uv"

      for example, from this

          "weather": {
            "command": "uv",
            "args": [
              "run",
              "--with",
              "mcp[cli]",
              "mcp",
              "run",
              "/Users/shafie/Documents/Github/mcp-server-weather/weather.py"
            ]
          }
      

      to this

          "weather": {
            "command": "/Users/shafie/.local/bin/uv",
            "args": [
              "run",
              "--with",
              "mcp[cli]",
              "mcp",
              "run",
              "/Users/shafie/Documents/Github/mcp-server-weather/weather.py"
            ]
          }
      
    4. Restart Claude Desktop, no more errors, servers are added

      you will see this

  • CLI I used to run the MCP Client and MCP server while inside the repo of the MCP Client.

    uv run client.py ../mcp-server-quickstart/weather.py
    
Author Information
Shafie

To contribute for the progress of mankind

San Francisco

21

Followers

48

Repositories

8

Gists

3

Total Contributions

Top Contributors

Threads