Yaizu Smart City MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Yaizu Smart City MCP Server search for evacuation shelters near the city center"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
焼津市スマートシティ MCP サーバー
焼津市のオープンデータを活用した Model Context Protocol (MCP) サーバー。Claude Desktop / Claude Code から焼津市スマートシティAPIへのアクセスを提供します。
機能一覧
ツール (8個)
ツール名 | 説明 |
| APIカタログから最新ドキュメントをスクレイピング |
| エンティティタイプに対するAPI実行コマンドを生成 |
| 保存済みAPIドキュメントをキーワード検索 |
| 特定APIの詳細情報を取得 |
| FIWARE NGSIv2 APIからエンティティデータを取得 |
| 主要エンドポイント例を表示 |
| 保存済みAPIドキュメント一覧を表示 |
| (非推奨) 汎用エンドポイント実行 |
リソース (4個)
URI | 説明 |
| 全APIドキュメントのサマリー |
| 防災関連APIの一覧 |
| 焼津市・スマートシティの基本情報 |
| サーバーステータスとデータ状態 |
プロンプト (1個)
プロンプト名 | 説明 |
| 防災APIの分析手順ガイド |
クイックスタート
必要要件
Python 3.13 以上
uv 0.8.13 以上
セットアップ
git clone https://github.com/moma1992/smartcity-mcp.git
cd smartcity-mcp
# 依存関係のインストール
uv sync
# 環境変数の設定
cp .env.example .env
# .env ファイルを編集してAPIキーを設定Claude Desktop 設定
設定ファイルを開きます:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
以下の設定を追加:
{
"mcpServers": {
"yaizu-smartcity": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/smartcity-mcp",
"run",
"python",
"-m",
"yaizu_mcp.server"
]
}
}
}開発・デバッグ
# MCP Inspector で開発サーバー起動
uv run mcp dev yaizu_mcp/server.py
# 直接実行(STDIOモード)
uv run python yaizu_mcp/server.py
# テスト実行
uv run python tests/test_mcp_integration.pyデプロイ方式
1. STDIO (Claude Desktop / Claude Code)
ローカル環境で直接実行。Claude DesktopまたはClaude CodeとJSON-RPC over STDIOで通信します。
2. Docker Streamable HTTP (exaBase / コンテナ環境)
Streamable HTTP トランスポートで HTTP サーバーとして起動します
(旧 SSE は 2026-05-19 に廃止、mcp >= 1.27 / fastmcp >= 3.3 推奨)。
# ビルドと起動
docker compose -f deploy/docker/docker-compose.yml up -d
# ログ確認
docker compose -f deploy/docker/docker-compose.yml logs -fエンドポイント:
MCP:
POST http://localhost:8080/mcp
ACR (Azure Container Registry) へのプッシュ:
# ビルド
docker build -t yaizu-mcp -f deploy/docker/Dockerfile .
# タグ付け & プッシュ
docker tag yaizu-mcp <registry>.azurecr.io/yaizu-mcp:latest
docker push <registry>.azurecr.io/yaizu-mcp:latest3. Databricks Apps (Streamable HTTP)
Databricks Apps として Streamable HTTP トランスポートでデプロイします。
リポジトリルートに app.py, app.yaml, requirements.txt を配置しているため、Git Sync でそのまま利用可能です。
前提条件
Azure Databricks ワークスペース
Databricks CLI のインストールと認証設定
# Databricks CLI インストール
brew tap databricks/tap
brew install databricks
# 認証設定
databricks auth login --host <workspace-url>シークレット設定
環境変数は Databricks Secret Scope (yaizu-demo) で管理します:
# シークレットの設定
databricks secrets put-secret yaizu-demo yaizu-api-key
databricks secrets put-secret yaizu-demo yaizu-api-email
databricks secrets put-secret yaizu-demo yaizu-api-passwordapp.yaml の resources セクションでシークレットスコープを参照するため、クレデンシャルのハードコードは不要です。
デプロイ手順
# ワークスペースへファイルをアップロード
databricks workspace import /Workspace/Users/<email>/mcp-yaizu-demo/app.py \
--file app.py --format AUTO --overwrite
databricks workspace import /Workspace/Users/<email>/mcp-yaizu-demo/app.yaml \
--file app.yaml --format AUTO --overwrite
databricks workspace import /Workspace/Users/<email>/mcp-yaizu-demo/requirements.txt \
--file requirements.txt --format AUTO --overwrite
databricks workspace import-dir yaizu_mcp \
/Workspace/Users/<email>/mcp-yaizu-demo/yaizu_mcp --overwrite
# アプリのデプロイ
databricks apps deploy mcp-yaizu-demo \
--source-code-path /Workspace/Users/<email>/mcp-yaizu-demo主要コマンド
databricks apps list # アプリ一覧
databricks apps get mcp-yaizu-demo # 状態確認
databricks apps start mcp-yaizu-demo # 開始
databricks apps stop mcp-yaizu-demo # 停止
databricks apps logs mcp-yaizu-demo # ログ確認プロジェクト構成
smartcity-mcp/ ← Databricks Apps source-code-path
├── app.py - Databricks Apps エントリーポイント
├── app.yaml - Databricks Apps 設定(シークレット参照)
├── requirements.txt - pip依存関係
├── yaizu_mcp/ # MCPサーバー本体
│ ├── server.py # サーバー実装 (FastMCP)
│ └── scraper.py # APIカタログスクレイパー
├── deploy/
│ └── docker/ # Docker / exaBase用
│ ├── Dockerfile
│ ├── docker-compose.yml
│ └── docker-entrypoint.py
├── scripts/ # データ処理スクリプト
├── tests/ # テスト
├── data/ # API仕様・ドキュメント
│ ├── api_specs/ # 48個のJSON API仕様書
│ ├── documentation/ # PDFドキュメント
│ └── openapi/ # OpenAPI仕様書 (YAML)
├── docs/ # ドキュメント
├── config.yaml # API設定
├── pyproject.toml # プロジェクト設定
├── uv.lock # 依存関係ロック
├── .env.example # 環境変数テンプレート
├── CLAUDE.md # Claude Code 開発ガイド
└── README.mdAPI 仕様
焼津市 FIWARE NGSIv2 API
エンドポイント:
https://api.smartcity-yaizu.jp/v2/entities認証: APIキー (
apikeyヘッダー)プロトコル: FIWARE NGSIv2
対応エンティティ
カテゴリ | エンティティタイプ |
防災 | Aed, EvacuationShelter, DisasterMail, WeatherAlert, WeatherForecast |
防災施設 | TsunamiEvacuationBuilding, DisasterPreventionWarehouse, FirePreventionWaterTank |
リスク | FloodRiskAreaMaxScale, LandslideVigilanceArea, DebrisFlowVigilanceArea |
医療 | FirstAidStation, ReliefHospital, HospitalAndClinic |
環境 | PrecipitationGauge, StreamGauge, DrinkingWaterTank |
監視 | CameraInformation |
観光 | Event, EventDetail, SightseeingMapStore, TouristAttraction |
公共施設 | PublicFacility |
交通 | RestrictedTrafficAreaInformation, UnderpassInformation |
技術スタック
フレームワーク: FastMCP (MCP Python SDK)
非同期処理: asyncio / aiohttp
HTTPクライアント: aiohttp, httpx
PDF処理: PyMuPDF, PyPDF2
環境管理: python-dotenv
パッケージ管理: uv
トラブルシューティング
エラー | 対処法 |
"No API key found" |
|
"Server disconnected" | Claude Desktop設定のパスを確認 |
"Module not found" |
|
Docker接続エラー |
|
Databricks認証エラー |
|
関連情報
ライセンス
MIT License
Available Tools
8 toolsexecute_api_endpointA
【非推奨】汎用エンドポイント実行ツール(互換性のために保持) 新しいコードでは execute_yaizu_api() を使用してください。
Args: endpoint_url: APIエンドポイントのURL method: HTTPメソッド(GET, POST, PUT, DELETE) params: クエリパラメータまたはJSONボディ(JSON文字列形式)
Returns: str: APIレスポンス
Inputs: endpoint_url (required), method, params. Returns: result
execute_yaizu_apiB
焼津市のFIWARE NGSIv2 APIからエンティティデータを取得します。 APIカタログの情報を基に適切なエンドポイント設定を自動で行います。
Args: entity_type: エンティティタイプ(例: Aed, EvacuationShelter, DisasterMail) params: 追加のクエリパラメータ(JSON文字列形式) limit: 取得件数制限(1-1000、デフォルト10)
Returns: str: APIレスポンス
Inputs: entity_type (required), params, limit. Returns: result
generate_api_commandB
指定したエンティティタイプに対するAPI実行コマンドを生成します。 APIカタログの情報を基に適切なパラメータを提案します。
Args: entity_type: エンティティタイプ(例: Aed, EvacuationShelter)
Returns: str: 使用可能なAPIコマンド例
Inputs: entity_type (required). Returns: result
get_api_detailsC
特定のAPIの詳細情報を取得します。
Args: api_name: API名またはファイル名(拡張子なし)
Returns: str: API詳細情報
Inputs: api_name (required). Returns: result
get_sample_endpointsB
焼津市スマートシティAPIの主要なエンドポイント例を提供します。
Returns: str: エンドポイント例の一覧
Inputs: no named parameters. Returns: result
list_saved_apisB
保存済みのAPIドキュメント一覧を表示します。
Returns: str: ドキュメント一覧
Inputs: no named parameters. Returns: result
scrape_api_docsB
焼津市APIカタログから最新のAPIドキュメントをスクレイピングして保存します。 認証情報は.envファイルから自動的に読み込まれます。
Returns: str: スクレイピング結果のサマリー
Inputs: no named parameters. Returns: result
search_api_docsC
保存済みのAPIドキュメントから特定のキーワードでAPIを検索します。
Args: keyword: 検索キーワード(API名、説明、カテゴリで検索)
Returns: str: 検索結果
Inputs: keyword (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
There is moderate overlap between tools like execute_api_endpoint and execute_yaizu_api, which both execute API calls but with different approaches, potentially causing confusion. However, other tools like scrape_api_docs and search_api_docs have distinct purposes, and descriptions help clarify the differences. Some tools, such as get_api_details and list_saved_apis, serve related but separate functions, reducing ambiguity.
Most tools follow a consistent verb_noun pattern (e.g., execute_api_endpoint, generate_api_command, get_api_details), which is predictable and readable. There is a minor deviation with execute_yaizu_api, which uses a specific name instead of a generic verb, but it still fits the overall style. The naming is largely uniform, aiding in tool identification.
With 8 tools, the count is well-scoped for a smart city API server, covering execution, documentation management, and information retrieval without being overwhelming. Each tool appears to serve a specific purpose in the domain, such as scraping, searching, and executing APIs, making the set appropriately sized for the server's functionality.
The tool set provides good coverage for interacting with Yaizu's FIWARE NGSIv2 API, including execution, documentation scraping, searching, and listing. Minor gaps exist, such as the lack of tools for updating or deleting entities, which might limit full CRUD operations, but core workflows like data retrieval and documentation management are well-supported, allowing agents to work effectively.
Maintenance
Related MCP Connectors
Japan data tools for AI agents: calendar (rokuyo), address, name splitting, corporate number lookup
Japan POI tools for AI agents: 2.94M facilities, station catchments, chains, grants and signals
17+ Japan MCP tools (weather/calendar v2/local-pack/enrich). x402 on Base, wallet-free trial.
Free web search, 130M+ business records, local search, weather and travel data for AI agents.