Commit Graph

247 Commits

Author SHA1 Message Date
Peter Steinberger
a02dda1b44
fix: handle auth status codes from error metadata (#94) (thanks @KentonYu) 2026-03-28 19:20:55 +00:00
yukaibo.me
049f3b7d6b
fix: detect auth errors from error.code property (StreamableHTTPError/SseError)
MCP SDK's StreamableHTTPError/SseError store the HTTP status code in
error.code, but the message text may not contain the numeric status.
analyzeConnectionError now reads error.code (100-599) before falling
back to message-text parsing, so OAuth promotion triggers correctly
for 401 responses on Streamable HTTP transport.
2026-03-28 19:17:48 +00:00
Peter Steinberger
74dd794645 fix: stabilize generated config schema + oauthScope coverage (#43) (thanks @aryasaatvik) 2026-03-03 01:07:35 +00:00
Peter Steinberger
7270f1f7b9 fix: finalize jsonc config support coverage (#42) (thanks @aryasaatvik) 2026-03-03 00:26:13 +00:00
Peter Steinberger
83db4fb1ec fix: add oauth retry regression coverage (#48) (thanks @caseyg) 2026-03-03 00:02:21 +00:00
Casey Gollan
e1fdd99b23 Discover OAuth scopes from protected resource metadata
Instead of hardcoding scope 'mcp:tools' during dynamic client
registration, fetch /.well-known/oauth-protected-resource from the
server to discover its supported scopes. This fixes InvalidScopeError
when connecting to servers like Todoist that only accept their own
scopes (e.g. 'data:read_write').

Also includes the fix from #38: remove the ad-hoc source restriction
in maybeEnableOAuth() so config-file servers can be promoted to OAuth.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-03 00:02:21 +00:00
Casey Gollan
67785b95eb Fix 405 misclassified as auth error in error-classifier
HTTP 405 (Method Not Allowed) was included in AUTH_STATUSES, causing it
to be treated as an authentication error. This leads to premature OAuth
session cleanup when StreamableHTTP returns 405, leaving the SSE
fallback without credentials. Remove 405 from AUTH_STATUSES so transport
errors are classified correctly.

Fixes #47

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-03-03 00:02:21 +00:00
Peter Steinberger
af2f60eecf refactor: streamline call parsing/output pipeline 2026-03-02 22:58:07 +00:00
Peter Steinberger
7ff297ef2e fix: make image handling opt-in and preserve output contracts (#61) (thanks @daniella-11ways) 2026-03-02 22:38:01 +00:00
Peter Steinberger
cb179c903d fix: align --raw-strings and --no-coerce semantics (#59) (thanks @nobrainer-tech) 2026-03-02 21:37:25 +00:00
nobrainer-tech
079b217f63 Add --raw-strings flag to prevent numeric string coercion
Values like phone numbers, PINs, or codes with leading zeros (e.g. 000123)
are auto-coerced to numbers by default. The --raw-strings flag (or --no-coerce
alias) preserves them as strings.

Note: Cannot use --raw as the flag name because it conflicts with the
existing --raw output format shortcut in output-format.ts.

Fixes: numeric strings being silently converted to numbers
2026-03-02 21:35:45 +00:00
Peter Steinberger
30abe3d9a5 fix: stabilize oauth wait/redirect deferred lifecycle (#70) (thanks @monotykamary) 2026-03-02 20:02:11 +00:00
Peter Steinberger
cb06392738 fix: harden raw output inspect depth and add regression coverage (#91) (thanks @Blankdlh) 2026-03-02 19:17:29 +00:00
Blankdlh
9746dab9d2 fix: collect all JSON entries from MCP content arrays instead of only the first
Previously json() in createCallResult returned early on the first
parseable JSON entry. When an MCP server returned multiple results
in the content array, only the first item was ever surfaced.

Now all parseable entries are collected. A single item still returns
as a single object (backward compatible); multiple items return as
an array.

Also increased inspect depth in printRaw from 2 to null to prevent
truncation of deeply nested list results.
2026-03-02 19:17:29 +00:00
Peter Steinberger
98c300b3dc fix: harden oauth headless flow + add scope override/tests (#72) (thanks @mgonto) 2026-03-02 18:32:55 +00:00
Peter Steinberger
d55b813c4f fix: preserve config imports defaults 2025-12-30 01:25:04 +01:00
Peter Steinberger
9b216b9820 test(windows): run pnpm via cmd.exe 2025-12-29 23:38:06 +01:00
Peter Steinberger
3f654d1ae9 test(windows): use pnpm.cmd in integration builds 2025-12-29 23:30:07 +01:00
Peter Steinberger
522276c599 test: rename bun cli e2e 2025-12-29 23:22:00 +01:00
Peter Steinberger
4a6f25478f test(oauth): isolate callback state persistence 2025-12-29 23:16:14 +01:00
Peter Steinberger
08128fe3b6 test: avoid generate-cli timeouts under coverage 2025-12-29 23:14:28 +01:00
Peter Steinberger
ea85104bb0 style: format ban cli test 2025-12-29 23:12:34 +01:00
Peter Steinberger
78d7631d3f test: add ban CLI end-to-end 2025-12-29 23:11:07 +01:00
Peter Steinberger
53eedf8f29 test: increase generate-cli integration timeout 2025-12-29 23:06:53 +01:00
Peter Steinberger
91386bbc67 feat(generate-cli): filter tools in generated CLIs
Co-authored-by: Zack Leman <6403966+zackleman@users.noreply.github.com>
2025-12-29 21:23:46 +01:00
Peter Steinberger
ecfbaee7f9 fix: coerce array option items 2025-12-29 20:47:04 +01:00
Peter Steinberger
d1cf5572f9 chore: release 0.7.2 2025-12-29 20:35:43 +01:00
Peter Steinberger
6a16e80ce1 Daemon restart on config changes 2025-12-08 21:09:57 +00:00
Peter Steinberger
699a184d9c Release 0.7.0 2025-12-06 04:38:58 +01:00
Peter Steinberger
872c9a953e fix(oauth): enforce state and custom callbacks 2025-12-06 02:49:52 +01:00
Peter Steinberger
38c6f99bce chore: store oauth vault in credentials.json 2025-12-06 02:24:45 +01:00
Peter Steinberger
85b0a3e3d5 test(oauth): cover vault + migration 2025-12-06 02:17:14 +01:00
Peter Steinberger
4afb948228
fix(ci): keep raw output untruncated (#23) 2025-12-06 00:46:04 +00:00
Kenn Costales
4a07ceedf3
fix(cli): prevent silent string truncation to 10k characters in raw output (#22)
* fix(cli): prevent string truncation in raw output

Node's util.inspect() has a default maxStringLength of 10000 characters,
causing large MCP responses to be truncated with '... N more characters'.

See: https://nodejs.org/api/util.html#utilinspectobject-options

This affects --output raw and the default output format when it falls
back to printRaw().

Fix: set maxStringLength: null to disable string truncation while
preserving depth: 2 for readable nested object summaries.

Verify (before fix shows 10000, after fix shows 15000):
  node -e "console.log('x count:', (require('util').inspect({t:'x'.repeat(15000)}, {depth:2}).match(/x/g)||[]).length)"
  node -e "console.log('x count:', (require('util').inspect({t:'x'.repeat(15000)}, {depth:2, maxStringLength:null}).match(/x/g)||[]).length)"

* test(cli): ensure raw output not truncated

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-12-06 00:32:57 +00:00
Peter Steinberger
c7353ab013 chore: fix lint and tests 2025-12-03 17:20:09 +00:00
Peter Steinberger
260fc2993b Fix daemon implicit config handling and docs 2025-11-28 07:33:44 +01:00
Peter Steinberger
f02a59bc89 Add regression tests for ENOENT fix when no config exists
Tests cover the scenario where mcporter is run in a completely empty
environment (no config files anywhere - not in project dir, home dir,
or env vars). Before the fix, this would crash with ENOENT.

Unit tests:
- resolveConfigPath returns explicit=false when no config exists anywhere

E2E tests:
- list command succeeds with empty environment
- list --json outputs valid JSON with empty servers array
- config list succeeds
- config doctor succeeds and shows version banner
2025-11-28 05:30:30 +00:00
Peter Steinberger
69926e91cd Add hidden aliases and README artwork 2025-11-26 00:32:36 +01:00
Peter Steinberger
dd8ca32903 Add help shortcut regression test 2025-11-25 22:37:16 +01:00
Peter Steinberger
4108a84d88 Handle help tokens for call/auth/list 2025-11-25 22:33:09 +01:00
Peter Steinberger
d0cdf3a0c5 feat(list): use cached oauth for non-interactive list 2025-11-25 17:22:37 +01:00
Peter Steinberger
fefe54e1b2 chore: bump sdk to 1.22.0 and adapt inline stdio test 2025-11-22 09:45:31 +01:00
Peter Steinberger
b8687aec1d test: strengthen claude import coverage 2025-11-22 01:59:49 +01:00
Peter Steinberger
54fdc85607 fix: allow claude mcp root fallback 2025-11-22 01:58:41 +01:00
Colin Mason
25d0217374 fix: prevent .claude/settings.json metadata from being parsed as MCP servers
The resolveContainerDescriptor function was applying root fallback to all
claude-code config files, causing non-MCP fields like statusLine, tipsHistory,
and cachedStatsigGates to be incorrectly detected as MCP server definitions.

This change makes root fallback path-aware for claude-code imports:
- .claude.json (legacy format): root fallback enabled
- .claude/settings.json: root fallback disabled, requires proper containers
- .claude/settings.local.json: root fallback disabled
- .claude/mcp.json: root fallback disabled

Fixes issue where statusLine appears as offline server in mcporter list output.

Tests added to verify metadata fields are ignored while proper mcpServers
containers and legacy .claude.json format continue to work correctly.
2025-11-22 01:56:55 +01:00
Peter Steinberger
d85834b13d Release 0.6.2 2025-11-18 10:13:34 +01:00
Peter Steinberger
6aadeb0c79 fix(generate-cli): restore stdio fallback 2025-11-18 05:32:45 +00:00
Peter Steinberger
02d27423a8 test(windows): add stdio fixtures 2025-11-18 05:32:45 +00:00
Peter Steinberger
51b3ae1303 fix(generate-cli): stabilize http command inference 2025-11-18 05:32:45 +00:00
Peter Steinberger
b1e7d35cfc test(stdio): stabilize filesystem/memory e2e 2025-11-18 05:32:45 +00:00