feat(cli): MCP server management CLI + OAuth 2.1 PKCE auth (#497, #690)#2021
Closed
imnotdev25 wants to merge 3 commits into
Closed
feat(cli): MCP server management CLI + OAuth 2.1 PKCE auth (#497, #690)#2021imnotdev25 wants to merge 3 commits into
imnotdev25 wants to merge 3 commits into
Conversation
Implements RFC 7636 PKCE flow for MCP HTTP servers that require OAuth instead of static API keys. Handles server metadata discovery, browser-based authorization, token caching (~/.hermes/mcp-tokens/), and automatic token refresh. Closes #497
Refactors Hermes CLI command execution to address nested subparser quirks and improve fallback behavior. Enhances OAuth flow for MCP servers with better error handling, scope management, and transport support, adding SSE fallback and improved metadata discovery. Updates dependencies for MCP SDK compatibility.
teknium1
added a commit
that referenced
this pull request
Mar 22, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR #2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes #497, #690.
teknium1
added a commit
that referenced
this pull request
Mar 22, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR #2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes #497, #690.
Contributor
|
Merged via PR #2465. Core OAuth module rewritten to use the MCP SDK's built-in OAuthClientProvider (210 lines vs 715). CLI and mcp_tool wiring written fresh against current main. Env var interpolation and argparse registration preserved. Thanks for the solid original implementation — the architecture was right, we just leaned on the SDK for the heavy lifting. |
outsourc-e
pushed a commit
to outsourc-e/hermes-agent
that referenced
this pull request
Mar 26, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR NousResearch#2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes NousResearch#497, NousResearch#690.
angelburgosrosado
pushed a commit
to angelburgosrosado/hermes-agent
that referenced
this pull request
Apr 27, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR NousResearch#2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes NousResearch#497, NousResearch#690.
02356abc
pushed a commit
to 02356abc/hermes-agent
that referenced
this pull request
May 14, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR NousResearch#2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes NousResearch#497, NousResearch#690.
olympus-terminal
pushed a commit
to olympus-terminal/hermes-agent
that referenced
this pull request
May 16, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR NousResearch#2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes NousResearch#497, NousResearch#690.
gweeteve
pushed a commit
to gweeteve/hermes-agent
that referenced
this pull request
Jun 2, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR NousResearch#2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes NousResearch#497, NousResearch#690.
Egavasyug
pushed a commit
to Egavasyug/hermes-agent
that referenced
this pull request
Jun 10, 2026
Add hermes mcp add/remove/list/test/configure CLI for managing MCP
server connections interactively. Discovery-first 'add' flow connects,
discovers tools, and lets users select which to enable via curses checklist.
Add OAuth 2.1 PKCE authentication for MCP HTTP servers (RFC 7636).
Supports browser-based and manual (headless) authorization, token
caching with 0600 permissions, automatic refresh. Zero external deps.
Add ${ENV_VAR} interpolation in MCP server config values, resolved
from os.environ + ~/.hermes/.env at load time.
Core OAuth module from PR NousResearch#2021 by @imnotdev25. CLI and mcp_tool
wiring rewritten against current main. Closes NousResearch#497, NousResearch#690.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
OAuth 2.1 PKCE & Transport Upgrades (tools/mcp_oauth.py, tools/mcp_tool.py) — #497
/.well-known/oauth-protected-resourceorWWW-Authenticateresponse headers (handles external auth providers like Clerk).User-Agent(Hermes-Agent/1.0 (OAuth PKCE Client)) headers into all OAuth HTTP requests. This bypasses Cloudflare403 Forbiddenlimits during dynamic client registration.openid profile email offline_access) to prevent registration rejections from identity providers advertising restricted scopes (e.g.,public_metadata).Authorizationheader to always strictly enforce a capitalizedBearerprefix (resolves401 Unauthorizeddisconnects for servers like Notion that returntoken_type: "bearer").mcp-[your-server]connections to attemptStreamable HTTPwith an automatic fallback mechanism toSSE(Server-Sent Events). Enables compatibility with older v1 MCP endpoints (like alphaxiv).~/.hermes/mcp-tokens/(permissions0600) and automatic token refresh with expiry buffer.MCP CLI (hermes_cli/mcp_config.py & hermes_cli/main.py) — #690
hermes mcp add— discovery-first install: connect → discover tools → interactive selection → save--url(HTTP) and--command(stdio) transports--auth oauthtriggers OAuth PKCE flow during add~/.hermes/.envwith${ENV_VAR}interpolation in configargparsenested subparser bug that previously misroutedhermes mcp addto the chat REPL.anyio's opaqueExceptionGroup/TaskGrouperrors. CLI now elegantly surfaces underlyingHTTPStatusErrormessages (e.g.401 Unauthorized).hermes mcp remove— removes config entry + cleans up OAuth tokenshermes mcp list— table view with transport, tool count, enabled/disabled statushermes mcp test— connection test with latency, masked auth info, and tool listinghermes mcp configure— interactive curses checklist to toggle which tools are enabledEnv var interpolation (tools/mcp_tool.py)
${ENV_VAR}syntax in MCP server config values, resolved fromos.environ+~/.hermes/.envconfig.yamlDocumentation
hermes mcpreferenceHow to test
Files changed (12 files, +2684 −10)
hermes mcphermes mcpreferencePlatform tested