Skip to main content
Glama

MCPサーバー

天気および時刻ツールを備えた拡張可能なModel Context Protocol (MCP)サーバーです。学習用に構築されており、Claude Desktopに接続してすぐにチャットを開始できます。

はじめに

1. クローンとインストール

git clone <repo-url> && cd mcp-server
python3 -m venv .venv
source .venv/bin/activate   # macOS / Linux / WSL
pip install -e .

または uv を使用する場合:

git clone <repo-url> && cd mcp-server
uv venv
source .venv/bin/activate
uv pip install -e .

2. Claude Desktopへの接続

セットアップスクリプトを実行して、Claude Desktopの設定ファイルを自動的に書き込みます:

macOS:

python setup_claude_agent.py

これにより、プロジェクトの .venv/bin/python を指す ~/Library/Application Support/Claude/claude_desktop_config.json が書き込まれます。

プロジェクトが標準以外の場所にある場合は、明示的にパスを渡してください:

python setup_claude_agent.py --project-path /path/to/mcp-server

Windows (WSL経由):

python3 setup_claude_agent.py --windows --win-user <YourWindowsUser> --wsl-user <YourWSLUser>

例:

python3 setup_claude_agent.py --windows --win-user Cam --wsl-user cam

これにより、%APPDATA%\Claude\claude_desktop_config.json が書き込まれ、WSL経由でサーバーを起動するようにClaude Desktopが設定されます。

3. Claude Desktopの再起動

Claude Desktopを閉じてから再度開きます。サーバーが接続されていることを確認するには、設定 → 開発者に移動してください。mcp-server と緑色の 実行中 バッジが表示されるはずです。

4. 試してみる

Claudeに以下のように尋ねてみてください:

  • 「今何時?」 — get_current_time ツールを使用します

  • 「カリフォルニア州の気象警報を取得して」 — weather://alerts/CA リソースを使用します

  • 「緯度40.7128、経度-74.0060の天気予報は?」 — 予報リソースを使用します

サーバーを手動で起動する必要はありません。Claude Desktopが自動的に起動します。


Related MCP server: mcp-weather

利用可能なツールとリソース

タイプ

名前

機能

ツール

get_current_time

自動タイムゾーン検出による現在時刻を返します

リソース

weather://alerts/{state}

米国の州の気象警報 (例: CA, NY)

リソース

weather://forecast/{lat}/{lon}

座標に基づいた5期間の天気予報

プロンプト

analyze_weather_prompt

Claudeによる詳細な気象分析をガイドします

プロンプト

timezone_helper_prompt

タイムゾーンの確認、変換、比較を支援します

独自のツールの追加

src/mcp_server/server.py を開き、@mcp.tool() デコレータを使用して関数を追加します:

@mcp.tool()
async def my_tool(param: str) -> str:
    """Description of what this tool does."""
    return f"Result for {param}"

Claude Desktopを再起動して変更を反映させます。

リソースとプロンプトについては、CONTRIBUTING.md を参照してください。

テストの実行

pip install -e ".[dev]"   # or: uv pip install -e ".[dev]"
pytest

プロジェクト構造

src/mcp_server/
├── server.py              # MCP server entry point — register tools here
└── tools/
    ├── weather/           # Weather alerts & forecasts (NWS API)
    ├── time/              # IP-based timezone & current time
    └── conversation/      # Conversation tools

ライセンス

MIT

リソース

Available Tools

4 tools
clear_old_cacheA

Clear expired weather cache entries.

Args: max_age_minutes: Maximum age in minutes before considering expired

Returns: Status message with number of entries removed

ParametersJSON Schema
NameRequiredDescriptionDefault
max_age_minutesNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description indicates a destructive action (clearing cache) and mentions the return value (status with count). However, it lacks details on side effects (e.g., impact on other users, reversibility) or safety considerations beyond 'expired' entries.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with a clear one-liner followed by structured args/returns. It could be even more concise but is well-organized and readable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (single parameter, output schema exists), the description covers its core function and return value adequately. However, it does not elaborate on edge cases or behavior when no entries are expired.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the only parameter, 'max_age_minutes', beyond the schema's type and default, explaining it as 'Maximum age in minutes before considering expired'. This compensates for the 0% schema description coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool action ('Clear expired weather cache entries') with a specific verb and resource, distinguishing it from sibling read tools like get_alerts, get_current_time, and get_forecast.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for cache maintenance but does not explicitly state when to use this tool over alternatives (e.g., after forecast fetches) or provide any usage restrictions or prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_alertsA

Get active weather alerts for a US state.

Provides current weather alerts and warnings for the specified state. Checks cache first (30 min expiry), fetches fresh if needed.

Args: state: Two-letter US state code (e.g. CA, NY)

ParametersJSON Schema
NameRequiredDescriptionDefault
stateYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses caching behavior (30 min expiry and refresh). Since no annotations are provided, this transparency helps the agent understand potential staleness. No destructive side effects are mentioned, which is appropriate for a read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (4 sentences) with clear structure: purpose, elaboration, caching behavior, and parameter details. Every sentence adds value without repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (1 parameter) and presence of output schema, the description covers all essential aspects: purpose, caching, and parameter format. It is complete enough for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description carries the full burden. It provides useful context: 'Two-letter US state code' with examples (CA, NY), which adds meaning beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Get active weather alerts for a US state', specifying the action and resource. It distinguishes from siblings like get_forecast or clear_old_cache by focusing on alerts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide explicit when-to-use or when-not-to-use guidance compared to siblings. However, the purpose is clear enough that an agent would know to use it for alerts, not forecasts or cache operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_current_timeA

Get the current time based on the user's IP address.

This tool determines the user's timezone from their IP address using geolocation and returns the current local time in that timezone.

Args: ip_address: Optional IP address to determine timezone. If not provided or empty string, attempts to detect automatically or defaults to UTC.

Returns: Formatted string with current time, timezone, day, and ISO timestamp

ParametersJSON Schema
NameRequiredDescriptionDefault
ip_addressNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully discloses behavior: it determines timezone via IP geolocation, handles missing IP by auto-detection or UTC fallback, and returns a formatted string with time, timezone, day, and ISO timestamp. No contradictions exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (two short paragraphs), front-loaded with the purpose, and uses a clear docstring structure. Every sentence contributes value, with no redundancy or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (one optional parameter, no nested objects, output schema present), the description is complete. It explains input behavior and the output format (formatted string with time, timezone, day, ISO timestamp) without needing to detail the output schema further.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has only one parameter (ip_address) with no description, giving 0% schema coverage. The description adds full semantics: 'Optional IP address to determine timezone. If not provided or empty string, attempts to detect automatically or defaults to UTC.' This is essential context beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get the current time based on the user's IP address.' The verb 'get' and resource 'current time' are specific, and the method (IP-based geolocation) differentiates it from unrelated sibling tools like clear_old_cache and get_alerts.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains the use case (getting current time for a location) and the optional IP parameter. It does not explicitly state when not to use it or mention alternatives, but sibling tools are in different domains, so no confusion arises. The guidance is clear enough for an agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_forecastA

Get weather forecast for geographic coordinates.

Provides a 5-day forecast for the specified location. Checks cache first (60 min expiry), fetches fresh if needed.

Args: latitude: Latitude of the location (-90 to 90) longitude: Longitude of the location (-180 to 180)

ParametersJSON Schema
NameRequiredDescriptionDefault
latitudeYes
longitudeYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses caching behavior (60 min expiry) and refreshing logic, adding value beyond missing annotations. However, it omits details on error handling, data format, or side effects, leaving gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with three sentences and bullet points, front-loading the core purpose. Every sentence contributes value without redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple 2-parameter tool with an output schema, the description covers purpose, params with ranges, and caching. It is mostly complete but could mention behavior for invalid coordinates or when cache is not used.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds essential meaning by specifying valid ranges for latitude (-90 to 90) and longitude (-180 to 180). This compensates well for the schema gap.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves a weather forecast for given geographic coordinates, using specific verbs and resource. It distinguishes well from sibling tools like 'clear_old_cache' and 'get_alerts' which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for obtaining a 5-day forecast with caching, but does not explicitly state when to use or when alternatives are better. No guidance on exclusions or prerequisites is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.0
    • First observedclear_old_cache
    • First observedget_alerts
    • First observedget_current_time
    • First observedget_forecast

TDQS

A4.1/5.0

Scored across 4 tools

Disambiguation5/5

Each tool targets a distinct function: cache management, alerts, current time, and forecast. No overlap or ambiguity.

Naming Consistency5/5

All names follow a consistent verb_noun snake_case pattern (clear_old_cache, get_alerts, get_current_time, get_forecast).

Tool Count4/5

With 4 tools, the set is slightly sparse but well-scoped for a combined weather/time server. Each tool serves a clear purpose.

Completeness3/5

Missing current weather conditions and location-based time input; only alerts and forecast for weather, time only via IP. Notable gaps exist.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol (MCP) server built with the mcp-framework to provide weather-related tools and data to AI clients. It enables integration of weather capabilities and custom tools into the MCP ecosystem for use with platforms like Claude Desktop.
    7 npm
    -
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server that provides weather and time tools, enabling users to get current time, weather alerts, and forecasts through natural language with Claude Desktop.
    4
    MIT