OpenDiscourse MCP

OpenDiscourse MCP

Enables access to comprehensive U.S. legislative and governmental data from GovInfo.gov and Congress.gov APIs, including bills, Congressional records, Federal Register documents, member information, and committee activities.

Category
访问服务器

README

OpenDiscourse MCP

Model Context Protocol (MCP) servers for accessing bulk data from govinfo.gov and congress.gov APIs with comprehensive AI-powered code review and data ingestion capabilities.

Overview

This project provides MCP servers that enable AI assistants to access comprehensive legislative and governmental data from:

  • GovInfo API: Congressional documents, Federal Register, Code of Federal Regulations, and more
  • Congress.gov API: Bills, members, committees, nominations, and legislative activities
  • Bulk Data Ingestion: Automated downloading and processing of govinfo.gov bulk data
  • AI Code Review: Multi-agent AI crews for comprehensive code analysis

Features

GovInfo Server Tools

  • govinfo_list_collections - List collections updated since a specific date
  • govinfo_get_package - Get detailed package information
  • govinfo_list_granules - List granules within a package
  • govinfo_get_granule - Get detailed granule information
  • govinfo_download_content - Download content (PDF, XML, HTML)

Congress.gov Server Tools

  • congress_get_bill - Get detailed bill information
  • congress_search_bills - Search for bills by text query
  • congress_get_bill_actions - Get legislative actions for a bill
  • congress_get_bill_text - Get full text of a bill
  • congress_search_members - Search for members of Congress
  • congress_get_member - Get detailed member information
  • congress_get_committee_meetings - Get committee meetings
  • congress_get_nominations - Get presidential nominations

Bulk Data Ingestion

  • Comprehensive Download: Automated ingestion of all govinfo.gov bulk data
  • Congress Coverage: 113th to 123rd Congress (2013-2024)
  • Document Types: BILLS, BILLSTATUS, PLAW, STATUTE, FR, CREC
  • Parallel Processing: 50 workers for high-performance downloads
  • XML Validation: Schema-based validation for data integrity
  • Skip-on-Existing: Resumable downloads with intelligent file skipping
  • Progress Monitoring: Real-time progress tracking and comprehensive reporting

AI Code Review Suite

  • Security Review: Vulnerability assessment and security analysis
  • Performance Review: Bottleneck identification and optimization suggestions
  • Quality Review: Code style, testing, architecture, and accessibility analysis
  • Documentation Review: Documentation quality and completeness assessment
  • Multi-Agent: Specialized AI agents for different review aspects
  • Observability: Langfuse integration for monitoring and tracing

Installation

Prerequisites

  1. Node.js and npm (for MCP server)
  2. Python 3.10+ (for setup scripts)
  3. PostgreSQL (for database storage)
  4. Bitwarden CLI (for API key management)

Quick Start

# Clone the repository
git clone https://github.com/cbwinslow/opendiscourse_mcp.git
cd opendiscourse_mcp

# Install Node.js dependencies
npm install

# Install Bitwarden CLI
npm install -g @bitwarden/cli

# Set up database
./scripts/setup_database.sh

# Set up API keys with Bitwarden
python3 scripts/setup_bitwarden.py

# Start MCP server
npm start

Detailed Setup

1. Python Environment

# Verify Python version (requires 3.10+)
python --version

# Using uv (recommended)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Or using pip
python3.10 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

2. Database Setup

# Automated database setup
./scripts/setup_database.sh

# Manual setup (if script fails)
# Start PostgreSQL
brew services start postgresql  # macOS
sudo systemctl start postgresql  # Linux

# Create database and user
sudo -u postgres createdb opendiscourse
sudo -u postgres createuser -s opendiscourse
sudo -u postgres psql -c "ALTER USER opendiscourse PASSWORD 'opendiscourse123';"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE opendiscourse TO opendiscourse;"

3. Bitwarden Setup

# Install Bitwarden CLI
npm install -g @bitwarden/cli

# Test Bitwarden integration
python3 scripts/test_bitwarden.py

# Add API keys to Bitwarden:
# - GovInfo API Key
# - Congress.gov API Key

4. API Key Configuration

# Set environment variables (optional)
export BITWARDEN_EMAIL="your-email@example.com"
export BITWARDEN_PASSWORD="your-master-password"

# Run automated setup
python3 scripts/setup_bitwarden.py

5. MCP Server Deployment

# Install dependencies
uv sync

# Start server
npm start

# Development mode
npm run dev

Bitwarden Item Setup:

Create these items in your Bitwarden vault:

  • GovInfo API Key

    • Name: GovInfo API Key
    • Custom Field: api_key with your GovInfo API key
  • Congress.gov API Key

    • Name: Congress.gov API Key
    • Custom Field: api_key with your Congress.gov API key

Configuration

Required API Keys

  1. GovInfo API Key

  2. Congress.gov API Key

Optional Configuration

  • MCP_LOG_LEVEL - Logging level (default: info)
  • GOVINFO_RATE_LIMIT - GovInfo rate limit requests/hour (default: 1000)
  • CONGRESS_RATE_LIMIT - Congress.gov rate limit requests/hour (default: 4000)

Usage

Bulk Data Ingestion

The project includes comprehensive bulk data ingestion capabilities for govinfo.gov:

# Run comprehensive ingestion for all available data
python3 scripts/run_comprehensive_ingestion.py

# Run specific congress and document type
python3 -m scripts.ingest_all_govinfo --congress 118 --doc-types BILLS --workers 50

# Run with validation enabled
python3 -m scripts.ingest_all_govinfo --congress 118 --doc-types STATUTE --validate-xml --workers 50

Ingestion Features:

  • Congress Coverage: 113th-123rd Congress (2013-2024)
  • Document Types: BILLS, BILLSTATUS, PLAW, STATUTE, FR, CREC
  • Parallel Downloads: 50 concurrent workers
  • XML Validation: Schema-based validation with XSD files
  • Resume Capability: Skip-on-existing functionality
  • Progress Tracking: Real-time monitoring and JSON results

Configuration:

# Use enums for type-safe configuration
from scripts.ingestion.enums import DocumentType, CongressSession

# Available document types
DocumentType.BILLS.value  # "BILLS"
DocumentType.STATUTE.value  # "STATUTE"

# Available congress sessions
CongressSession.get_available_sessions()  # [113, 114, ..., 123]

AI Code Review

The project includes specialized AI crews for comprehensive code review:

# Run all review types (via GitHub Actions)
# Or manually trigger specific reviews:

# Security review
python3 scripts/security_review_crew.py

# Performance review
python3 scripts/performance_review_crew.py

# Quality review (style, testing, architecture, dependencies, accessibility)
python3 scripts/quality_review_crew.py

# Documentation review
python3 scripts/documentation_review_crew.py

# Original comprehensive review
python3 scripts/code_review_crew.py

AI Review Features:

  • Security Analysis: Vulnerability assessment, security best practices
  • Performance Optimization: Bottleneck identification, efficiency improvements
  • Quality Assessment: Code style, testing coverage, architecture review
  • Documentation Review: API docs, README, inline comments
  • Multi-Agent: Specialized AI agents for different review aspects
  • Observability: Langfuse integration for monitoring and tracing

GitHub Actions Integration:

  • Automatic PR reviews
  • Configurable review types (security, performance, quality, documentation)
  • Python 3.10 enforcement
  • Comprehensive reporting

As MCP Server

# Start MCP server
npm start

# Or in development mode with auto-restart
npm run dev

Integration with Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "opendiscourse": {
      "command": "node",
      "args": ["/path/to/opendiscourse_mcp/src/index.js"],
      "env": {
        "GOVINFO_API_KEY": "your_govinfo_key",
        "CONGRESS_API_KEY": "your_congress_key"
      }
    }
  }
}

API Key Management

The project includes automated API key management through Bitwarden:

# Test Bitwarden integration
python3 scripts/test_bitwarden.py

# Set up API keys from Bitwarden
python3 scripts/setup_bitwarden.py

Features:

  • 🔍 Automatic API key discovery from Bitwarden vault
  • 🔓 Secure vault unlocking
  • 📝 Environment file updates
  • 🗄️ Database storage with encryption
  • 🔐 Security masking in console output

Integration with Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "opendiscourse": {
      "command": "node",
      "args": ["/path/to/opendiscourse_mcp/src/index.js"],
      "env": {
        "GOVINFO_API_KEY": "your_govinfo_key",
        "CONGRESS_API_KEY": "your_congress_key"
      }
    }
  }
}

API Coverage

GovInfo Collections

  • BILLS - Congressional bills (all versions)
  • CREC - Congressional Record
  • FR - Federal Register
  • CFR - Code of Federal Regulations
  • USCOURTS - U.S. Courts opinions
  • CHRG - Committee reports and prints

Congress.gov Data

  • Bills and amendments (93rd Congress to present)
  • Member information and voting records
  • Committee data and meetings
  • Presidential nominations
  • Roll call votes
  • Legislative text and summaries

Rate Limits

  • GovInfo API: Follows api.data.gov limits (configurable, default 1000/hour)
  • Congress.gov API: 5,000 requests/hour (configurable, default 4000/hour)

Both clients implement automatic rate limiting with delays between requests.

Development

# Run tests
npm test

# Lint code
npm run lint

# Full build process
npm run build

Documentation

Comprehensive documentation is available in the /docs folder:

  • docs/README.md - Complete reference guide
  • docs/govinfo-api-summary.md - GovInfo API quick reference
  • docs/congress-api-summary.md - Congress.gov API quick reference
  • Downloaded official API repositories and samples

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run npm run build
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Support

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选