← Blog
MCPAgentic codingCivic tech

How I Built a Congress MCP Server

Getting structured data out of Congress.gov has always been tedious. Here is how I built an MCP server that makes it conversational.

By Nicholas Wagner ·

Whether you're a civics teacher, a policy researcher, a journalist tracking legislation, or just a curious citizen, getting structured data out of Congress.gov has always been tedious. I built a Model Context Protocol (MCP) server that lets AI tools like ChatGPT, Claude Code, and others pull legislative data directly from the Congress.gov API using natural language. This includes bills, hearing details, committee activity, CRS reports, and more. A full list of available data can be found at https://api.congress.gov/#/.

An example of the MCP server being used to look up my local Representative’s sponsored bills.

Example prompts to try include:

  • "Show me recent Senate hearings on AI regulation."

  • "What CRS reports have been published on immigration in the last few months?"

  • "Who sponsored S. RES. 611?"

If you are not familiar with MCP servers, MCP is a standard for providing instructions to a large language model on how to use a tool like a database or software service. The 'server' part means the tool instructions live at a single URL that any compatible AI model can connect to, rather than being copy-pasted into every conversation. MCP was built to avoid recreating the same boilerplate instructions over and over and instead centralize them at one easy-to-reach place.

Resources used

Here's what I used to build this at a total cost of $135:

First attempt and debugging

I began this server by pasting the URLs to the Congress.gov API and FastMCP GitHub repositories into Claude Code and asking it to make an MCP server. Claude spat out something that seemed to work ok.

Unfortunately, when I first shared the server with a group chat, one of the members realized that asking for hearings would result in Claude.ai getting stuck in an infinite loop. When asked what was wrong, Claude recognized that it was supposed to modify an API parameter but was unable to. Asking Claude Code to fix this issue directly did not work. It took suggesting the Anthropic MCP building skill along with telling it to build better tests that hit the API directly for the issue to go away.

Poor Claude was on the strugglebus :(. In this screenshot, Claude recognized the problem (it needed to modify an API parameter) but couldn't resolve it on its own without the MCP building skill and better test coverage.

Known Limitations

A few things to be aware of if you use this tool:

Client-side filtering constraints. Some useful queries run into upstream limitations in the Congress.gov API. For example, when I asked to find all bills from the current Congress that touched on data centers, I discovered there is no way to filter bill summaries by keyword on the Congress.gov server side. That meant paginating through all results (e.g., 3,356 summaries for the 119th Congress at 250 per page, requiring 14 sequential tool calls), parsing the text of each summary client-side, and accumulating matches across pages. This is slow, expensive on the LLM context window, and burns API quota.

Government codebases move slowly. I could generate a pull request to make changes to the API’s codebase, but government code maintainers will have to decide how they want to accept AI-generated code change suggestions, or if they even want to do that at all.

Always verify the output. Any users should be careful and run their own checks before relying fully on the results. LLMs can misinterpret data, and the API itself can have quirks.

Using the MCP yourself

If you want to try this tool, the URL is https://congress-mcp-an.fastmcp.app/mcp. Don't visit the URL directly in your browser, as it won't do anything useful. Instead, follow the instructions below for your platform. The code for the server is open-source and located at https://github.com/nawagner/congress-mcp.

Claude Code

Paste the below command in your terminal:

claude mcp add --scope local --transport http congress-mcp https://congress-mcp-an.fastmcp.app/mcp

Claude.ai

  1. Navigate to “Connectors” under your settings.

  2. Add a custom connector with the URL above. You do not need to adjust the Advanced settings.

Add a custom connector with these parameters. You do not need to adjust the Advanced settings.

ChatGPT

  1. Enable Developer mode. Note that this disables the ChatGPT memory feature.

  2. Click “Create app.”

  3. Supply the URL and click “Create.”

Enable Developer mode. Note that this disables the ChatGPT memory feature.

Supply these parameters for a new app and click “Create”.

Other Platforms

Gemini unfortunately does not support integrating custom MCP servers at this time. If you use another platform and need help setting things up, feel free to reach out to me on GitHub or LinkedIn.

Acknowledgments

Thank you to Ashley Nagel for inspiring me to try building this. Her complaining about the lack of a free MCP server for the Congress.gov API inspired me to see what was possible.


This post was originally published on Learning Journey, our Substack. Subscribe there for new posts on AI and society.

Stay in the loop

Practical AI tips and events, in your inbox.

One really interesting email, plus a note when a new course opens. Unsubscribe anytime.