Skip to main content
Glama
LegiScan MCP Server

LegiScan MCP Server

by sh-patterson

LegiScan MCPサーバー

CI License: MIT Node TypeScript

ターミナルエージェントがLegiScan APIに構造化されたアクセスを行い、全米50州および連邦議会の立法データを取得できるようにするModel Context Protocol (MCP) サーバーです。

エージェント(Codex、Claude Code、Claude Desktopなど)に法案の履歴、提案者の背景、投票記録を迅速に収集させるようなリサーチワークフローのために構築されています。

特徴

  • 立法リサーチワークフローに最適化された10種類の効率的なMCPツール

  • 複数ステップのリサーチワークフローを単一のMCPツール呼び出しに集約する複合ツール

  • 法案やロールコール(点呼投票)の繰り返し検索に対するリクエストごとのバッチ処理とキャッシュ

  • すべてのAPIレスポンスに対する完全なTypeScript型定義

  • 法案番号の正規化(AB 858、AB858、AB-858形式に対応)

  • 州コード、議員名クエリ、大規模な法案バッチに対する入力検証ガードレール

Related MCP server: civic-awareness-mcp

インストール

npmから(推奨)

npm install -g legiscan-mcp-server

ソースから

git clone https://github.com/sh-patterson/legiscan-mcp.git
cd legiscan-mcp
npm install
npm run build

セットアップ

1. LegiScan APIキーの取得

  1. LegiScanで無料アカウントを作成します

  2. https://legiscan.com/legiscan でAPIアクセスを登録します

  3. APIキーをコピーします

2. MCP対応エージェントへの追加

ターミナルエージェントが使用するMCPホストにこのサーバーを追加してください。

Claude Desktopの設定パス:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

その他のMCPクライアント(Codex CLI、Claude Codeなど)の場合は、そのクライアントのMCP設定ファイルに同じ mcpServers.legiscan エントリを追加してください。

npxの使用(推奨)

{
  "mcpServers": {
    "legiscan": {
      "command": "npx",
      "args": ["-y", "legiscan-mcp-server"],
      "env": {
        "LEGISCAN_API_KEY": "your_api_key_here"
      }
    }
  }
}

ローカルインストールの使用

{
  "mcpServers": {
    "legiscan": {
      "command": "node",
      "args": ["/path/to/legiscan-mcp-server/dist/index.js"],
      "env": {
        "LEGISCAN_API_KEY": "your_api_key_here"
      }
    }
  }
}

利用可能なツール

複合ツール(高レベルリサーチ)

ツール

説明

legiscan_find_legislator

名前から議員の people_id を検索します。部分一致をサポートしています。

legiscan_get_legislator_votes

1回の呼び出しで、複数の法案に対する議員の投票状況を取得します。

legiscan_get_primary_authored

議員が主提案者である法案のみを取得します(共同提案者は除外)。

法案

ツール

説明

legiscan_get_bill

詳細な法案情報(提案者、履歴、投票、テキスト)を取得します

legiscan_find_bill_by_number

番号で法案を検索します(AB 858、AB858、AB-858、A.B. 858に対応)。正確な法案検索に最適です。

legiscan_get_roll_call

個々の議員の投票を含む投票詳細を取得します

人物

ツール

説明

legiscan_get_person

サードパーティID(VoteSmart、OpenSecretsなど)を含む議員情報を取得します

legiscan_get_session_people

会期中に活動している全議員を取得します

検索

ツール

説明

legiscan_search

法案の全文検索を行います。AB858のような法案番号のバリエーションも受け付けますが、完全一致には legiscan_find_bill_by_number を使用してください。

会期

ツール

説明

legiscan_get_session_list

州ごとの利用可能な会期を一覧表示します

リサーチャーワークフロー(ターミナルエージェント)

1. スコープを絞ったリクエストから開始

エージェントに目標、州、期間、出力形式を伝えます。

プロンプト例:

Use the LegiScan MCP tools to find major California housing bills in the current session.
Return: bill number, title, latest action date, top sponsors, and whether there was a close roll-call vote (margin <= 5).

2. ツールシーケンスに従うようエージェントに指示

高品質な結果を得るために、エージェントに以下の順序で実行するよう指示してください:

  1. legiscan_get_session_list で適切な会期を特定する。

  2. legiscan_search または legiscan_find_bill_by_number で対象の法案を見つける。

  3. legiscan_get_bill で提案者/履歴/投票の参照情報を取得する。

  4. legiscan_get_roll_call で個別の投票詳細を取得する。

  5. legiscan_get_person は議員の補足情報が必要な場合のみ使用する。

legiscan_find_legislator から開始する場合は、返された session.session_id または同じ state を後続の提案ワークフローに渡し続け、結果が意図した議会と期間内に収まるようにしてください。

3. アナリストワークフローのための複合ツールの再利用

これらはツール呼び出しの回数を減らし、エージェントへの指示を簡素化します:

  • legiscan_find_legislator: 名前クエリから people_id を取得します。

  • legiscan_get_primary_authored: 主提案法案と共同提案法案を分離します。

  • legiscan_get_legislator_votes: 1回のリクエストで多数の法案にわたる投票位置を取得します。

プロンプトテンプレート

A) 特定の議員に対する反対調査

Use LegiScan MCP for Texas.
1) Find legislator "Jane Smith".
2) List all primary-authored bills in the current session.
3) For these bills, summarize topic area and latest status.
4) Then check votes on SB 12, HB 301, and SB 455, and show how the legislator voted.

B) 特定の課題領域に関する法案追跡ブリーフ

Use LegiScan MCP to track "climate resilience" bills in New York.
Focus on current session only.
Return top 15 bills by relevance with bill number, title, last action, sponsor party, and any recorded roll calls.

C) スコアカード作成支援ワークフロー

For California session 2172, resolve bill numbers AB 858, SB 525, SB 616, SB 399.
For each bill, fetch details and any roll calls.
Then report vote positions for people_id values 21719, 23214, and 25359.
Output as a table suitable for CSV export.

ワークフローの簡素化

複合ツールは、一般的なワークフローにおけるエージェントとツール間の往復回数を劇的に削減します:

ワークフロー

手動MCPステップ

複合ツール使用時

1人の議員の10法案に対する投票を取得

議員検索 → 法案検索/解決 → 各法案の調査 → 各ロールコールの調査

bill_ids があれば1回のツール呼び出し

150の提案法案から主提案法案をフィルタリング

提案リスト → 各法案の取得 → 提案者の調査

1回のツール呼び出し(state または session_id でスコープ指定可能)

名前による議員検索

会期発見 → 会期中の人物検索 → 手動マッチング

1回のツール呼び出し

リサーチのヒント

  • 州コードは2文字の文字列として検証され、自動的に大文字に変換されます(ca → CA)。ZZ のような無効なコードはローカル検証は通過しますが、LegiScanからAPIエラーが返されます。

  • 結果の曖昧さを減らすため、プロンプトでは常に州と会期を指定してください。

  • 追跡可能性を監査できるように、エージェントに中間出力で bill_id、roll_call_id、people_id を表示するよう依頼してください。

  • 議員検索では、少なくとも名と姓を提供してください(名前の入力は2文字以上である必要があります)。

  • legiscan_get_primary_authored は利用可能なすべての会期を返す可能性がありますが、state または session_id を渡すことで、結果を意図した議会と期間に合わせることができます。

  • legiscan_get_legislator_votes はリクエストごとに最大100個の bill_ids を受け付けます。大規模なジョブはチャンクに分割してください。

  • legiscan_search は AB858 のようなコンパクトな法案番号クエリを、標準的なスペース形式を使用して再試行します。正確な法案解決には legiscan_find_bill_by_number を優先してください。

  • 下流工程での分析を予定している場合は、最終出力をテーブルやCSV形式で出力するよう依頼してください。

開発

npm run build        # Compile TypeScript
npm run typecheck    # Type-check src + tests
npm test             # Run deterministic unit tests (no API key)
npm run test:e2e     # Run real-world workflow tests (skips cleanly without API key)
npm run test:live    # Run live API integration tests (requires API key)
npm run test:coverage # Run unit tests with coverage
npm run lint         # Check for lint errors
npm run format       # Format code with Prettier

テストモード

  • npm test / npm run test:unit: モック化されたネットワーク呼び出しを使用した高速な決定論的テスト。

  • npm run test:e2e: 実際の立法分析タスクに基づくリサーチワークフローテスト。LEGISCAN_API_KEY が利用できない場合はスキップされます。

  • npm run test:live: 実際のLegiScan API統合テスト。LEGISCAN_API_KEY が必要です。

API制限

  • 無料の公開APIキーには 月間30,000クエリ の制限があります

  • 複合ツールはリクエストをバッチ処理(最大10並列)し、不要な重複を避けるために単一リクエスト内で繰り返し検索をキャッシュします

  • 複合ツールはMCPワークフローの摩擦を軽減しますが、LegiScan APIの使用量は調査する法案やロールコールの数に応じて増加します

Docker

コンテナイメージをローカルでビルドします:

docker build -t legiscan-mcp .

実行時にAPIキーを指定して実行します:

docker run --rm -i \
  -e LEGISCAN_API_KEY=your-api-key-here \
  legiscan-mcp

リリース

GlamaチェックはGitHubリリースを想定しています。次のリポジトリ変更をマージした後、GitHubから、または以下を使用して v1.0.0 などのタグを作成して公開してください:

git tag v1.0.0
git push origin v1.0.0

Docker

コンテナイメージをローカルでビルドします:

docker build -t legiscan-mcp .

実行時にAPIキーを指定して実行します:

docker run --rm -i \
  -e LEGISCAN_API_KEY=your-api-key-here \
  legiscan-mcp

リリース

GlamaチェックはGitHubリリースを想定しています。変更をプッシュした後、v1.0.0 などのタグを作成して公開してください。

ライセンス

MIT - 詳細は LICENSE を参照してください。

Available Tools

10 tools
legiscan_find_bill_by_numberA

Find a bill by its number within a state's current session or specific session. Handles format variations (AB 858, AB858, AB-858). Returns bill summary if found, null if not.

Inputs: bill_number (required), state, session_id.

legiscan_find_legislatorA

Find a legislator's people_id by searching their name. Useful as a first step before other queries. Supports partial name matching.

Inputs: name (required), state (required), session_id.

legiscan_get_billA

Get detailed bill information including sponsors, full history, votes, texts, amendments, and supplements. This is the primary tool for bill research.

Inputs: bill_id (required).

legiscan_get_legislator_votesA

Get how a legislator voted on specific bills. Use find_legislator first to get people_id from a name. Returns vote positions (Yea/Nay/NV/Absent) for each bill with roll call details.

Inputs: bill_ids (required), people_id (required), chamber.

legiscan_get_personA

Get legislator information including party, role, district, and third-party IDs (VoteSmart, OpenSecrets, Ballotpedia, FollowTheMoney).

Inputs: people_id (required).

legiscan_get_primary_authoredA

Get only bills where a legislator is the PRIMARY author, not co-sponsor. Use find_legislator first to get people_id from a name. Filters out co-sponsored bills automatically.

Inputs: people_id (required), state, session_id.

legiscan_get_roll_callA

Get roll call vote details including individual legislator votes. Get roll_call_id by calling get_bill first.

Inputs: roll_call_id (required).

legiscan_get_session_listA

Get list of available legislative sessions. Returns sessions with session_id, years, and state info. Use session_id for subsequent bill lookups.

Inputs: state.

legiscan_get_session_peopleA

Get all legislators active in a legislative session. Returns list of people with their roles, parties, and districts.

Inputs: session_id (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action (bills, legislators, sessions, votes, search) with clear boundaries. Even related tools like get_legislator_votes and get_roll_call serve different purposes (individual legislator vs. specific roll call).

    Naming Consistency5/5

    All tool names follow a consistent 'legiscan_verb_noun' pattern using lowercase with underscores. Verbs are limited to 'find', 'get', and 'search', making the set predictable.

    Tool Count5/5

    10 tools is well-scoped for a legislative tracking server. Each tool addresses a core need without unnecessary duplication or omission.

    Completeness5/5

    The tool surface covers the primary lifecycle for legislative data: discovering sessions, searching bills, retrieving details, and accessing legislator info and votes. No obvious gaps for a read-only MCP server.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides tools to search and retrieve US federal and state legislative data, including bills, votes, campaign contributions, and legislator information, with provenance tracking.
      8
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Access U.S. state legislative data including bills, legislators, and votes across all 50 states via the OpenStates API.
      129 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables querying legislative data from the LegiScan API, including bills and votes, via natural language through an MCP gateway.
      260 npm
      MIT