mcp-101

mitchallen/mcp-101

3.1

If you are the rightful owner of mcp-101 and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MCP Weather Server is a Model Context Protocol server implementation for weather data services, built with TypeScript, providing standardized access to weather information.

MCP Weather Server

A Model Context Protocol (MCP) server implementation for weather data services built with TypeScript.

NOTE: This demo returns mock weather data and not real data. To return live data is an exercise for the reader.

Ko-fi Buy Me A Coffee

๐ŸŒค๏ธ Overview

This project implements a weather server using the Model Context Protocol (MCP) SDK, providing standardized access to weather information through a well-defined interface.

๐Ÿ“‹ Prerequisites

  • Node.js (v18 or higher)
  • npm (v8 or higher)
  • TypeScript knowledge for development

๐Ÿš€ Quick Start

Installation

# Clone the repository
git clone <your-repo-url>
cd mcp-101

# Install dependencies
npm install
# or using Makefile
make install

Development

# Start development server with hot reload
npm run dev
# or
make dev

# Run in watch mode
npm run watch
# or
make watch

Production

# Build the project
npm run build
# or
make build

# Start the server
npm start
# or
make start

# Build and start in one command
make start-prod

๐Ÿ“ฆ Available Scripts

NPM Scripts

  • npm run build - Compile TypeScript to JavaScript
  • npm run dev - Run development server with tsx
  • npm start - Start the compiled application
  • npm run watch - Run with file watching for auto-restart
  • npm test - Run the test suite

Makefile Commands

Run make help to see all available commands:

Development
  • make dev - Start development server with hot reload
  • make watch - Run in watch mode
  • make build - Build the project
  • make test - Run tests
  • make typecheck - Run TypeScript type checking
Maintenance
  • make clean - Clean build artifacts
  • make clean-deps - Clean node_modules
  • make reset - Full reset (clean + reinstall + rebuild)
  • make verify - Full verification pipeline
Utilities
  • make outdated - Check for outdated packages
  • make update - Update dependencies
  • make package - Create distributable package

๐Ÿ—๏ธ Project Structure

mcp-101/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ index.ts          # Main server entry point
โ”‚   โ””โ”€โ”€ test.ts           # Test suite
โ”œโ”€โ”€ dist/                 # Compiled JavaScript output
โ”œโ”€โ”€ node_modules/         # Dependencies
โ”œโ”€โ”€ package.json          # Project configuration
โ”œโ”€โ”€ tsconfig.json         # TypeScript configuration
โ”œโ”€โ”€ Makefile             # Build and development commands
โ”œโ”€โ”€ .gitignore           # Git ignore rules
โ””โ”€โ”€ README.md            # Project documentation

๐Ÿ”ง Configuration

TypeScript Configuration

The project uses TypeScript with ES modules. Configuration is in tsconfig.json.

Package Configuration

  • Type: ES Module ("type": "module")
  • Main Entry: dist/index.js
  • Binary: weather-server command available after global install

๐Ÿงช Testing

# Run tests
npm test
# or
make test

# Run tests in watch mode
make test-watch

๐Ÿ–ฅ๏ธ Testing with Claude Desktop (Mac)

Prerequisites

  1. Claude Desktop installed on your Mac
  2. Built MCP server: Run make build to compile your server

Configuration Steps

  1. Build your server:

    make build
    
  2. Locate Claude Desktop config:

On a Mac,

  • Claude > Settings > Developer > Edit Config
  1. Create or edit the config file:

In the Finder file window, right click to edit this file in your preferred editor:

claude_desktop_config.json
  1. Add your MCP server configuration:

    {
      "mcpServers": {
        "weather-server": {
          "command": "node",
          "args": ["/absolute/path/to/your/mcp-101/dist/index.js"],
          "env": {
            "NODE_ENV": "production"
          }
        }
      }
    }
    

    Important: Replace /absolute/path/to/your/mcp-101/ with your actual project path:

    # Get your current path
    pwd
    # Example result: /Users/username/projects/mcp/mcp-101
    
  2. Alternative: Using npm global install:

    # Install globally (after building)
    npm install -g .
    
    # Then use in config:
    {
      "mcpServers": {
        "weather-server": {
          "command": "weather-server"
        }
      }
    }
    

Testing Steps

  1. Restart Claude Desktop completely:

    # Quit Claude Desktop completely
    # Then relaunch from Applications
    
  2. Verify server connection:

    • Open Claude Desktop
    • Look for MCP server indicators in the interface
    • Check for any error messages
  3. Test weather functionality:

    • Ask Claude about weather in various locations
    • Try different weather-related queries
    • Verify the responses come from your MCP server

Troubleshooting Claude Desktop Integration

Common Issues
  1. Server not connecting:

    # Check if your server runs standalone
    node dist/index.js
    
    # Verify the path in config is correct
    ls -la /absolute/path/to/your/mcp-101/dist/index.js
    
  2. Permission issues:

    # Make sure the file is executable
    chmod +x dist/index.js
    
  3. Configuration file issues:

    # Validate JSON syntax
    cat ~/Library/Application\ Support/Claude/claude_desktop_config.json | python3 -m json.tool
    
Debug Configuration

For debugging, you can add logging to your config:

{
  "mcpServers": {
    "weather-server": {
      "command": "node",
      "args": ["/absolute/path/to/your/mcp-101/dist/index.js"],
      "env": {
        "NODE_ENV": "development",
        "DEBUG": "mcp:*"
      }
    }
  }
}
Viewing Logs
  1. Claude Desktop logs:

    # Check Console app for Claude Desktop logs
    # Or check system logs:
    log show --predicate 'process == "Claude Desktop"' --last 1h
    
  2. Your server logs:

    • Add console.log statements to your src/index.ts
    • Rebuild with make build
    • Restart Claude Desktop

Development Workflow with Claude Desktop

  1. Make changes to your server code
  2. Rebuild: make build
  3. Restart Claude Desktop to reload the server
  4. Test the changes in Claude Desktop
  5. Repeat as needed

Quick Setup Script

Create a setup script for easier testing:

# create setup-claude.sh
#!/bin/bash
echo "Building MCP server..."
make build

echo "Current project path:"
pwd

echo ""
echo "Add this to your Claude Desktop config:"
echo "~/Library/Application Support/Claude/claude_desktop_config.json"
echo ""
echo "{"
echo "  \"mcpServers\": {"
echo "    \"weather-server\": {"
echo "      \"command\": \"node\","
echo "      \"args\": [\"$(pwd)/dist/index.js\"]"
echo "    }"
echo "  }"
echo "}"
echo ""
echo "Then restart Claude Desktop to test!"
# Make it executable and run
chmod +x setup-claude.sh
./setup-claude.sh

๐Ÿ› ๏ธ Development Workflow

  1. Start Development: make dev
  2. Make Changes: Edit files in src/
  3. Test Changes: make test
  4. Type Check: make typecheck
  5. Build: make build
  6. Verify: make verify (runs full pipeline)

๐Ÿ“š Model Context Protocol (MCP)

This server implements the Model Context Protocol, which provides:

  • Standardized communication between AI models and external systems
  • Resource discovery and access patterns
  • Tool invocation capabilities
  • Structured data exchange

Learn more about MCP at the official documentation.

๐ŸŒ Weather Server Features

This implementation provides weather-related functionality through the MCP interface, including:

  • Weather data retrieval
  • Location-based queries
  • Standardized response formats

๐Ÿ”ง Adding Features

Linting & Formatting (Optional)

To add code quality tools:

# Install ESLint
npm install --save-dev eslint @typescript-eslint/parser @typescript-eslint/eslint-plugin

# Install Prettier
npm install --save-dev prettier

# Then use
make lint    # Lint code
make format  # Format code

๐Ÿ“ฆ Building for Production

# Create production build
make build

# Create distributable package
make package

# Full verification before deployment
make verify

๐Ÿ” Troubleshooting

Common Issues

  1. Build Errors: Run make clean then make build
  2. Dependency Issues: Run make reset to clean and reinstall
  3. Type Errors: Run make typecheck to see detailed type issues

Debugging

# Check project status
make git-status

# View what would be cleaned
make git-clean

# Check for outdated dependencies
make outdated

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Run verification: make verify
  5. Commit your changes: git commit -am 'Add feature'
  6. Push to the branch: git push origin feature-name
  7. Submit a pull request

๐Ÿ“ License

This project is licensed under the ISC License.

๐Ÿ”— Links

๐Ÿ“ง Support

For issues and questions:

  1. Check existing issues in the repository
  2. Create a new issue with detailed information
  3. Include steps to reproduce any bugs

Built with โค๏ธ using TypeScript and the Model Context Protocol