---
title: "MCP Server: CLI Tools Connection Instructions"
description: GovSpend MCP - CLI connection
---

[Skip to content](https://support.govspend.com/mcp-cli#main-content)

English

Show submenu for translations

[![GS Logo-GS platform.png\]](https://support.govspend.com/hs-fs/hubfs/GS%20Logo-GS%20platform.png?height=25&name=GS%20Logo-GS%20platform.png)](https://support.govspend.com/?hsLang=en)

- [Home](https://support.govspend.com/)
- [Email Support](mailto:support@govspend.com)
- [Product Health Status](https://support.govspend.com/product-health-status)
- [What's New](https://support.govspend.com/)
  
  Show submenu for What's New

    - [New User Onboarding](https://support.govspend.com/govspend-onboarding-journey)
    - [Releases & Updates](https://support.govspend.com/releases-updates)
    - [Newsletters](https://support.govspend.com/newsletter-archive)
- [Sales Training Videos](https://app.govspend.com/trainingVideos)

Open main navigation

Close main navigation

- [Home](https://support.govspend.com/)
- [Email Support](mailto:support@govspend.com)
- [Product Health Status](https://support.govspend.com/product-health-status)
- [What's New](https://support.govspend.com/)
  
  Show submenu for What's New

    - [New User Onboarding](https://support.govspend.com/govspend-onboarding-journey)
    - [Releases & Updates](https://support.govspend.com/releases-updates)
    - [Newsletters](https://support.govspend.com/newsletter-archive)
- [Sales Training Videos](https://app.govspend.com/trainingVideos)
- English
  
  Show submenu for translations
- [Log into GovSpend](https://app.govspend.com/)

[Log into GovSpend](https://app.govspend.com/)

 Skip the browsing—search for the fastest, most relevant results.

- There are no suggestions because the search field is empty.

1. [GovSpend Help Center](https://support.govspend.com/?hsLang=en)
2. [AI & Automation](https://support.govspend.com/ai-automation?hsLang=en)
3. [MCP (Model Context Protocol) Server](https://support.govspend.com/ai-automation?hsLang=en#mcp-model-context-protocol-server)

# MCP Server: CLI Tools Connection Instructions

## Connect GovSpend to Claude Code, Codex CLI, or Gemini CLI. All three CLIs use the same MCP server and handle OAuth automatically once you've registered the server. Streamable HTTP is the supported transport on all of them.

#### **Common Requirements**

- A supported CLI: Claude Code, OpenAI Codex, or Gemini CLI
- Each CLI's own authentication (vendor account or API key)
- Your GovSpend API key
- **MCP endpoint:** `https://mcp.govspend.com/mcp`

---

#### **Claude Code**

**Add the server**

Run this from any terminal:

```
claude mcp add --transport http govspend https://mcp.govspend.com/mcp 
```

That's it. Claude Code stores the server in its config and handles OAuth on first use.

**Headless / CI use**

To skip the interactive OAuth flow, pass the API key as a header at registration time:

```
claude mcp add --transport http govspend https://mcp.govspend.com/mcp \   --header "Authorization: Bearer your-api-key-here" 
```

---

#### **OpenAI Codex CLI**

**Option A — CLI command**

```
codex mcp add govspend --url https://mcp.govspend.com/mcp 
```

Then trigger the OAuth flow:

```
codex mcp login govspend 
```

**Option B — Manual config**

Edit `~/.codex/config.toml`:

```
[mcp_servers.govspend] url = "https://mcp.govspend.com/mcp" 
```

For headless or CI use, pass the key via header instead of OAuth:

```
[mcp_servers.govspend] url = "https://mcp.govspend.com/mcp" http_headers = { "Authorization" = "Bearer your-api-key-here" } 
```

> Do not include `experimental_use_rmcp_client = true`. That flag was removed from Codex on December 20, 2025 — remote MCP is now the default. Older guides still reference it; those guides are outdated.

---

#### **Gemini CLI**

> **Consumer-tier note:** Free, Google AI Pro, and Ultra consumer tiers stopped serving Gemini CLI on June 18, 2026 — Google is migrating those users to Antigravity CLI. Paid Gemini API keys and Code Assist Standard/Enterprise continue to work as before.

**Option A — CLI command**

```
gemini mcp add --transport http govspend https://mcp.govspend.com/mcp 
```

This writes to `~/.gemini/settings.json` by default. Use `--scope project` to write to `.gemini/settings.json` in the current directory instead.

**Option B — Manual config**

Edit `~/.gemini/settings.json`:

```
{   "mcpServers": {     "govspend": {       "url": "https://mcp.govspend.com/mcp"     }   } } 
```

> Use `url`, not `httpUrl`. The `httpUrl` field and the `npx mcp-remote` shim were both retired in late 2025 — a single `url` field with auto-detection replaced them.

---

#### **Verifying the Connection (Any CLI)**

**Step 1:** Launch your CLI (`claude`, `codex`, or `gemini`) from a terminal.

**Step 2:** Inside the session, type:

```
/mcp 
```

`govspend` should appear in the list. It may show as "not connected" until the first tool call — this is expected for OAuth servers.

**Step 3:** Trigger OAuth with a real question:

*What are the top 10 vendors selling cybersecurity services to Texas state agencies in the last 12 months?*

Your browser opens, you sign in with your GovSpend API key, and the token is cached for future sessions.

---

#### **Troubleshooting**

**Before anything else, confirm the server is up:** `curl https://mcp.govspend.com/health`

**`/mcp` shows govspend as "not connected"**

- Trigger a real GovSpend question first — HTTP MCP servers don't connect until the first call.
- Re-check the URL: no trailing slash, no `http://`, must include `/mcp`.
- Run with your CLI's debug flag (`--debug` on Gemini, etc.) for verbose logs.

**OAuth window doesn't open or hangs**

- Pop-up blockers, sandboxed terminals, or remote SSH sessions can block the browser launch.
- Manually open the URL your CLI prints if auto-launch fails.
- Verify your GovSpend API key is valid and your subscription includes MCP access.

**Token expired or auth keeps re-prompting** Delete the CLI's stored token and re-authenticate:

- **Claude Code:** `claude mcp logout govspend`
- **Codex:** `codex mcp logout govspend`
- **Gemini:** `rm ~/.gemini/mcp-oauth-tokens.json`

**Tools call but return empty results**

- The MCP respects your GovSpend entitlements — confirm your account has access to the data you're requesting.
- Try narrowing your query. Broad questions sometimes return empty when more specific ones succeed.

**Need to remove or re-add the server**

| CLI | Remove command |
| --- | --- |
| Claude Code | `claude mcp remove govspend` |
| Codex | `codex mcp remove govspend` |
| Gemini | `gemini mcp remove govspend` |

Then re-run the add command for your CLI.

 

- [Getting Started](https://support.govspend.com/getting-started?hsLang=en#main-content)

    - [New User Onboarding](https://support.govspend.com/getting-started?hsLang=en#new-user-onboarding)
- [Free Trial Guides](https://support.govspend.com/free-trial-guides?hsLang=en)
- [The Lab](https://support.govspend.com/the-lab?hsLang=en#main-content)

    - [\[Concept & Design\] Potential Upcoming Features](https://support.govspend.com/the-lab?hsLang=en#concept-design-potential-upcoming-features)
    - [\[Beta\] AI Search](https://support.govspend.com/the-lab?hsLang=en#beta-ai-search)
    - [\[Beta\] GovSpend Slack App](https://support.govspend.com/the-lab?hsLang=en#beta-govspend-slack-app)
- [Searching & Filtering](https://support.govspend.com/searching-filtering?hsLang=en#main-content)

    - [General Search](https://support.govspend.com/searching-filtering?hsLang=en#general-search)
    - [Module-Specific Search](https://support.govspend.com/searching-filtering?hsLang=en#module-specific-search)
    - [Workflow Tips](https://support.govspend.com/searching-filtering?hsLang=en#workflow-tips)
- [AI & Automation](https://support.govspend.com/ai-automation?hsLang=en#main-content)

    - [AI Access Points](https://support.govspend.com/ai-automation?hsLang=en#ai-access-points)
    - [Opportunities Module](https://support.govspend.com/ai-automation?hsLang=en#opportunities-module)
    - [MCP (Model Context Protocol) Server](https://support.govspend.com/ai-automation?hsLang=en#mcp-model-context-protocol-server)
    - [AI Prompts & Chat](https://support.govspend.com/ai-automation?hsLang=en#ai-prompts-chat)
    - [AI Notebook](https://support.govspend.com/ai-automation?hsLang=en#ai-notebook)
- [Integrations & Add-Ons](https://support.govspend.com/integrations-add-ons?hsLang=en#main-content)

    - [\[CRM Integration\] Introduction](https://support.govspend.com/integrations-add-ons?hsLang=en#crm-integration-introduction)
    - [\[CRM Integration\] Setup: Tech Onboarding](https://support.govspend.com/integrations-add-ons?hsLang=en#crm-integration-setup-tech-onboarding)
    - [\[CRM Integration\] Quick Start Guide](https://support.govspend.com/integrations-add-ons?hsLang=en#crm-integration-quick-start-guide)
    - [\[CRM Integration\] Additional Features](https://support.govspend.com/integrations-add-ons?hsLang=en#crm-integration-additional-features)
    - [Other Integrations](https://support.govspend.com/integrations-add-ons?hsLang=en#other-integrations)
    - [Add-Ons](https://support.govspend.com/integrations-add-ons?hsLang=en#add-ons)
- [Training Webinars](https://support.govspend.com/training-webinars?hsLang=en#main-content)

    - [Platform Training](https://support.govspend.com/training-webinars?hsLang=en#platform-training)
    - [Platform Strategy](https://support.govspend.com/training-webinars?hsLang=en#platform-strategy)
    - [Webinar Series | Beyond the Bid: Industry Insights That Win](https://support.govspend.com/training-webinars?hsLang=en#webinar-series-beyond-the-bid-industry-insights-that-win)
- [Report Templates](https://support.govspend.com/report-templates?hsLang=en)
- [Releases & Updates](https://support.govspend.com/releases-updates?hsLang=en#main-content)

    - [2026 Product Enhancements](https://support.govspend.com/releases-updates?hsLang=en#2026-product-enhancements)
    - [2025 Product Enhancements](https://support.govspend.com/releases-updates?hsLang=en#2025-product-enhancements)
    - [2024 Product Enhancements](https://support.govspend.com/releases-updates?hsLang=en#2024-product-enhancements)
    - [2023 Product Enhancements](https://support.govspend.com/releases-updates?hsLang=en#2023-product-enhancements)
    - [Newsletters](https://support.govspend.com/releases-updates?hsLang=en#newsletters)
- [Data Overviews](https://support.govspend.com/data-overviews?hsLang=en#main-content)

    - [Document Repository](https://support.govspend.com/data-overviews?hsLang=en#document-repository)
- [Quotes & RFQs](https://support.govspend.com/quotes-rfqs?hsLang=en#main-content)

    - [For Companies](https://support.govspend.com/quotes-rfqs?hsLang=en#for-companies)
    - [For Agencies](https://support.govspend.com/quotes-rfqs?hsLang=en#for-agencies)
- [Technical Support](https://support.govspend.com/technical-support?hsLang=en)
- [Agency Launchpad](https://support.govspend.com/agency-launchpad?hsLang=en)
- [GovSpend Federal](https://support.govspend.com/govspend-federal?hsLang=en#main-content)

    - [Introduction](https://support.govspend.com/govspend-federal?hsLang=en#introduction)
    - [Search Modules](https://support.govspend.com/govspend-federal?hsLang=en#search-modules)
    - [Opportunities](https://support.govspend.com/govspend-federal?hsLang=en#opportunities)

[![Chill listening crop-3](https://support.govspend.com/hs-fs/hubfs/GS%20Logo-GS%20platform.png?width=109&height=24&name=GS%20Logo-GS%20platform.png "Chill listening crop-3")](https://support.govspend.com?hsLang=en)

[Privacy](https://govspend.com/privacy/) | [Terms](https://govspend.com/terms/)

<https://www.linkedin.com/company/24993760/> <https://www.facebook.com/GovSpend.us/> <https://twitter.com/govspend_> <https://www.instagram.com/govspend_>

Copyright © 2025 GovSpend