Lawmesh MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Lawmesh MCP Server
A comprehensive Model Context Protocol (MCP) server providing AI agents with powerful tools to access U.S. legislative data through the OpenStates API v3.
Live Deployment
Public MCP Server: https://pk-dev-Lawmesh.hf.space/mcp
The server is deployed on Hugging Face Spaces and ready for immediate use with any MCP-compatible client.
Related MCP server: LegiScan MCP Server
Available Tools
Lawmesh provides four comprehensive tools for querying U.S. legislative information:
1. list_jurisdictions
Retrieve all available U.S. jurisdictions (states, territories, federal districts) with optional filtering.
Parameters:
classification(optional): Filter by type ("state", "municipality", "country")include(optional): Additional data ("organizations", "legislative_sessions", "latest_runs")page,per_page: Pagination support
2. get_jurisdiction
Get detailed metadata for a specific jurisdiction.
Parameters:
jurisdiction(required): State abbreviation, full name, or OpenStates IDinclude(optional): Additional data to include
3. get_people
Search for legislators, governors, and government officials.
Parameters:
jurisdiction,name,id: Filter criteria (at least one required)org_classification: Role filter ("upper", "lower", "executive")district: District filterinclude: Additional biographical dataPagination support
4. get_bills
Search legislative bills, resolutions, and documents.
Parameters:
jurisdiction,session,chamber: Basic filtersidentifier: Specific bill numbersclassification: Bill type ("bill", "resolution")subject,sponsor: Content and sponsor filtersq: Full-text searchupdated_since,created_since,action_since: Date filtersinclude: Additional data (votes, actions, documents, etc.)sort: Sort optionsPagination support
Architecture
Lawmesh is built using:
FastMCP: Modern MCP server framework
Streamable HTTP Transport: Optimized for web deployment
OpenStates API v3: Authoritative source for U.S. legislative data
Async Architecture: High-performance concurrent request handling
┌─────────────────┐ HTTP/MCP ┌─────────────────┐ HTTPS/API ┌─────────────────┐
│ MCP Client │ <-------------> │ Lawmesh Server │ <-------------> │ OpenStates API │
│ (Claude, etc.) │ │ (FastMCP) │ │ (v3) │
└─────────────────┘ └─────────────────┘ └─────────────────┘Quick Start with MCP Client
Example: Python MCP Client
import asyncio
from mcp import create_client_session
from mcp.client.transports.http import create_http_transport
async def main():
# Connect to the deployed Lawmesh server
transport = create_http_transport("https://pk-dev-Lawmesh.hf.space/mcp")
async with create_client_session(transport) as session:
# List available tools
tools = await session.list_tools()
print("Available tools:", [tool.name for tool in tools.tools])
# Example: Get California jurisdictions
result = await session.call_tool("list_jurisdictions", {
"classification": "state",
"per_page": 10
})
print("Jurisdictions:", result.content)
# Example: Search for bills about education in California
bills = await session.call_tool("get_bills", {
"jurisdiction": "ca",
"subject": "education",
"per_page": 5
})
print("Education bills:", bills.content)
if __name__ == "__main__":
asyncio.run(main())Example: Using with Claude Desktop
Add to your Claude Desktop MCP configuration:
{
"mcpServers": {
"lawmesh": {
"url": "https://pk-dev-Lawmesh.hf.space/mcp"
}
}
}Local Development Setup
Prerequisites
Python 3.13+
OpenStates API Key: Get one at OpenStates.org
Environment Setup
Installation
Clone the repository:
git clone <repository-url>
cd LawmeshInstall dependencies:
# Using pip
pip install -r requirements.txt
# Or using uv (recommended)
uv syncEnvironment Configuration: Create a
.envfile:
# .env
OPENSTATES_API_KEY=your_openstates_api_key_hereRun the server:
# Development mode
python app.py
# Or with uvicorn
uvicorn app:app --host 0.0.0.0 --port 7860 --reloadThe server will be available at: http://localhost:7860/mcp
Local Testing
Test your local server with MCP Inspector:
npx @modelcontextprotocol/inspector http://localhost:7860/mcpDocker Deployment
Using the included Dockerfile:
# Build the image
docker build -t lawmesh-mcp .
# Run with environment variable
docker run -p 7860:7860 -e OPENSTATES_API_KEY=your_key_here lawmesh-mcpDocker Compose:
# docker-compose.yml
version: '3.8'
services:
lawmesh:
build: .
ports:
- "7860:7860"
environment:
- OPENSTATES_API_KEY=${OPENSTATES_API_KEY}
env_file:
- .envDependencies
Core dependencies from pyproject.toml:
fastmcp>=2.12.3: MCP server framework
httpx>=0.28.1: Async HTTP client for API calls
uvicorn>=0.36.0: ASGI server
python-dotenv>=1.1.1: Environment variable management
mcp[cli]>=1.14.1: MCP protocol support
Security & Configuration
Environment Variables
Variable | Required | Description |
| Yes | Your OpenStates API key |
| No | Server port (default: 7860) |
| No | Server host (default: 0.0.0.0) |
API Key Security
Never commit API keys to version control
Use environment variables or secure secret management
For Hugging Face Spaces: Configure as Repository Secrets
Use Cases
Political Research: Track legislation and voting patterns
Government Transparency: Access public legislative records
Civic Engagement: Build tools for citizen participation
Academic Research: Study U.S. political processes
News & Media: Automated legislative monitoring
Legal Research: Access bill text and legislative history
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Submit a pull request
License
This project is open source. Please check the LICENSE file for details.
Support
Issues: Report bugs and feature requests via GitHub Issues
Documentation: OpenStates API v3 docs at docs.openstates.org
MCP Protocol: Learn more at modelcontextprotocol.io
Built with ❤️ using FastMCP and OpenStates API
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Federal and 50-state legislative data for AI: bills, text, votes, members, and committees.
U.S. civic data for AI agents: reps, votes, bills, finance, lobbying, cited gov sources. 47 tools.
Search bills and speaker-attributed hearing transcripts across all 50 US state legislatures.
Search bills, legislators, committees, and events across all 50 US states, DC, and 5 US territories.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables 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.1MIT
- AlicenseAqualityCmaintenanceProvides access to legislative data from all 50 US states through the LegiScan API, enabling comprehensive search and retrieval of bills, votes, legislators, and legislative session information.1010 npm12MIT
- AlicenseNot gradedqualityBmaintenanceAccess U.S. state legislative data including bills, legislators, and votes across all 50 states via the OpenStates API.556 npmMIT
- AlicenseAqualityDmaintenanceEnables AI assistants to access Washington State Legislature data for bill tracking, committee meetings, legislator lookup, and legislative document retrieval via conversational interfaces.91MIT