# Connect Google ADK to SAM.gov data

To use SAM.gov data in Google ADK, add McpToolset(connection_params=StreamableHTTPConnectionParams(url="https://samgovapi.io/api/mcp", headers={"Authorization": "Bearer <key>"})) to your LlmAgent's tools. ADK lists the samgovapi tools when the agent starts and the model calls them during the run.

ADK agents get MCP tools through McpToolset. A tool_filter keeps the agent to a few tools, which helps smaller models choose the right one.

- Connects with: MCP
- MCP server: https://samgovapi.io/api/mcp
- REST base: https://samgovapi.io/api/v1
- Auth: Authorization: Bearer <key>, kept in SAMGOVAPI_API_KEY
- Tested: google-adk 2.14.1: McpToolset.get_tools returned every tool (2026-11-13)

## Get a key

Free key at https://samgovapi.io/sign-up, or have the agent call start_signup and approve the link it shows you. Read SAMGOVAPI_API_KEY with os.environ in the agent module.

## Set up Google ADK

1. Install

Terminal:

```bash
pip install google-adk
```

2. Define the agent: Put this in your agent module and run it with adk web or adk run.

agent.py:

```python
import os
from google.adk.agents import LlmAgent
from google.adk.tools.mcp_tool import McpToolset
from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams

root_agent = LlmAgent(
    model="gemini-flash-latest",
    name="samgov_agent",
    instruction="Answer federal contracting questions with the samgovapi tools. Quote meta.as_of.",
    tools=[McpToolset(
        connection_params=StreamableHTTPConnectionParams(
            url="https://samgovapi.io/api/mcp",
            headers={"Authorization": f"Bearer {os.environ['SAMGOVAPI_API_KEY']}"},
        ),
        tool_filter=["registration_status", "exclusion_check", "search_opportunities", "recompetes"],
    )],
)
```

3. Run it: adk web opens the dev UI where the tools are listed.

Terminal:

```bash
adk web
```

## Finish account setup once

Data tools unlock after the account answers its onboarding questions: ask the agent to set up your samgovapi account (get_onboarding_questions, then answer_onboarding). Free.

## Check that it works

Ask: "Is UEI ZXBCU6K5KL99 registered in SAM.gov, and when does its registration expire?"

Expected tool call:

```json
{"name":"registration_status","arguments":{"id":"ZXBCU6K5KL99","user_request":"check a registration and its expiry"}}
```

## Things to know

- The model name is an example.

## Troubleshooting

- No tools in adk web: Check the agent module imports cleanly and the environment variable is set where adk runs.
- INVALID_API_KEY: The header was sent with an empty key.
- ONBOARDING_REQUIRED: Answer the onboarding questions once for the account.

## Questions

### Does ADK for TypeScript work too?

Yes, MCPToolset with type StreamableHTTPConnectionParams and transportOptions.requestInit.headers.

## Official documentation

- ADK: MCP tools: https://google.github.io/adk-docs/tools-custom/mcp-tools/

Checked 2026-11-13. All guides: https://samgovapi.io/agents.md

Independent. Not affiliated with, endorsed by or sponsored by GSA, SAM.gov or any U.S. government agency. Registering in SAM.gov is free at sam.gov.
