mitchallen/mcp-101
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.
๐ค๏ธ 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 JavaScriptnpm run dev
- Run development server with tsxnpm start
- Start the compiled applicationnpm run watch
- Run with file watching for auto-restartnpm test
- Run the test suite
Makefile Commands
Run make help
to see all available commands:
Development
make dev
- Start development server with hot reloadmake watch
- Run in watch modemake build
- Build the projectmake test
- Run testsmake typecheck
- Run TypeScript type checking
Maintenance
make clean
- Clean build artifactsmake clean-deps
- Clean node_modulesmake reset
- Full reset (clean + reinstall + rebuild)make verify
- Full verification pipeline
Utilities
make outdated
- Check for outdated packagesmake update
- Update dependenciesmake 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
- Claude Desktop installed on your Mac
- Built MCP server: Run
make build
to compile your server
Configuration Steps
-
Build your server:
make build
-
Locate Claude Desktop config:
On a Mac,
- Claude > Settings > Developer > Edit Config
- 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
-
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
-
Alternative: Using npm global install:
# Install globally (after building) npm install -g . # Then use in config: { "mcpServers": { "weather-server": { "command": "weather-server" } } }
Testing Steps
-
Restart Claude Desktop completely:
# Quit Claude Desktop completely # Then relaunch from Applications
-
Verify server connection:
- Open Claude Desktop
- Look for MCP server indicators in the interface
- Check for any error messages
-
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
-
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
-
Permission issues:
# Make sure the file is executable chmod +x dist/index.js
-
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
-
Claude Desktop logs:
# Check Console app for Claude Desktop logs # Or check system logs: log show --predicate 'process == "Claude Desktop"' --last 1h
-
Your server logs:
- Add console.log statements to your
src/index.ts
- Rebuild with
make build
- Restart Claude Desktop
- Add console.log statements to your
Development Workflow with Claude Desktop
- Make changes to your server code
- Rebuild:
make build
- Restart Claude Desktop to reload the server
- Test the changes in Claude Desktop
- 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
- Start Development:
make dev
- Make Changes: Edit files in
src/
- Test Changes:
make test
- Type Check:
make typecheck
- Build:
make build
- 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
- Build Errors: Run
make clean
thenmake build
- Dependency Issues: Run
make reset
to clean and reinstall - 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
- Fork the repository
- Create a feature branch:
git checkout -b feature-name
- Make your changes
- Run verification:
make verify
- Commit your changes:
git commit -am 'Add feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request
๐ License
This project is licensed under the ISC License.
๐ Links
๐ง Support
For issues and questions:
- Check existing issues in the repository
- Create a new issue with detailed information
- Include steps to reproduce any bugs
Built with โค๏ธ using TypeScript and the Model Context Protocol