Commit graph inspector/server
Author SHA1 Message Date
cliffhall
0a60c58d4f Bump Inspector version to 0.17.0
- New feature: Connection Type
- Reverts "fix: filter out client_secret when storing OAuth client information"
- Fixes STDIO "Headers is undefined" message when connecting to an SSE server.
2025-09-30 15:41:09 -04:00
Ola Hungerford
801f650faa
Merge branch 'main' into claude/issue-807-20250916-0337 2025-09-17 14:48:01 -07:00
cliffhall
f1e93e0475 * In server/index.ts
- in createCustomFetch function
    - convert finalHeaders to headers object for node-fetch compatibility
    - for SSE streams, convert node stream to response body to web ReadableStream since EventSource polyfill expects web-compatible stream

* In package-lock.json and package.json
  - add node-fetch as a dependency

This fixes #600
2025-09-17 14:45:58 -04:00
claude[bot]
7b338b3ea3 chore: bump version to 0.16.8
Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
2025-09-16 03:39:40 +00:00
cliffhall
51d28cd7b4 When the client sends a request, do not pass on the mcp-session-id header for the Client <-> Proxy connection. This causes a problem for stateless SSE or StreamableHttp connections. 2025-09-15 18:09:44 -04:00
Jeetul Samaiya
f36c649bb9
Merge branch 'main' into main 2025-09-15 19:30:18 +05:30
claude[bot]
1c5f5e4839 chore: bump version to 0.16.7
Co-authored-by: Ola Hungerford <olaservo@users.noreply.github.com>
2025-09-12 14:30:54 +00:00
cliffhall
ca26a4f7a9 Bumped TS SDK in all the packages to ^1.18.0 2025-09-11 16:41:03 -04:00
jeetul.samaiya
cb8c45456b refactor: improve code formatting and readability across multiple files 2025-09-09 13:44:57 +05:30
jeetul.samaiya
c5acc63129 Add support for custom headers and migrate from legacy auth
- Introduced CustomHeaders component for managing custom headers.
- Updated Sidebar to include CustomHeaders component.
- Enhanced useConnection hook to handle custom headers and legacy auth migration.
- Added tests for custom headers functionality.
- Updated package.json and package-lock.json for new dependencies.
2025-09-09 13:44:57 +05:30
cliffhall
2f420c4edf A new updateHeadersInPlace function *mutates* the original header object instead of replacing it. This ensures that transports holding a static reference, like SSEClientTransport, always see the latest headers.
* In `src/server/index.ts`,
  - Added `updateHeadersInPlace` helper function to solve the stale header reference issue in `SSEClientTransport`. It mutates the header object in-place, ensuring the transport sees all updates, while carefully preserving the original `Accept` header required by the transport.
  - in `/mcp GET`, `/mcp POST`, and `/message POST`, use `updateHeadersInPlace` to replace current headers with new headers, retaining the Accept header.
2025-09-06 15:51:43 -04:00
cliffhall
1896f2001e Implement dynamic header injection for proxy transports. Fixes #679
Adds a mechanism to dynamically inject and update HTTP headers for ongoing proxy sessions, resolving an issue where headers introduced after the initial handshake (e.g, Mcp-Protocol-Version) were not being forwarded to the server.

The core problem was that the `transportToServer` instance was created once with a static set of headers. This meant that critical, dynamically added headers like `mcp-protocol-version` and `last-event-id` were being dropped in subsequent requests.

The solution implemented here is to wrap the `fetch` function used by the HTTP-based transports (`StreamableHttp` and `SSE`). This custom wrapper merges the latest headers from the client with the headers of each outgoing request from the proxy, ensuring all headers are preserved for the lifetime of the session.

Changes:

In `src/index.ts`:
  - Added `sessionHeaderHolders`, a `Map` to store the most recent set of headers for each active session ID.
  - Added `createCustomFetch`, a new helper function that creates a `fetch` wrapper. This wrapper merges the session headers from `sessionHeaderHolders` with the request-specific headers from the SDK (like `Content-Type`)
  - In `createTransport`, use `createCustomFetch` for both the `StreamableHTTPClientTransport` and `SSEClientTransport`. This injects the dynamic header logic into the transport layer.
  - In `/mcp`, `/sse`, `/message` route handlers, added logic to update the `sessionHeaderHolders` map with the latest headers from every incoming client request.
  - Added cleanup logic to the `onsessionclosed` callback and the `/mcp` DELETE handler to remove session data from `sessionHeaderHolders`.
  - In `getHttpHeaders`, more robust handling of `string[]` and `undefined` values from `req.headers`, satisfying the `"strict": true` TypeScript configuration.
2025-09-06 14:05:24 -04:00
cliffhall
31dd05634e Bump version to 0.16.6 2025-09-03 10:21:29 -04:00
cliffhall
6db41c19d5 * In all package.json and package-lock.json,
- set TS SDK to 1.17.5, which has the automatic log level handling
* In useConnection.ts
  - push the logging/setLevel message onto the message history stack so it is clear in the Inspector that it has been sent.
2025-09-02 16:17:04 -04:00
Richard Michael
61db7918af Align similar /sse and /stdio handlers: formatting and move log statement 2025-08-22 00:47:40 -07:00
Richard Michael
3628abca9e Use MCP_PROXY_FULL_ADDRESS for SSE transport backed endpoints
The STDIO and SSE transports use SSE between the client and the proxy
server.  SSE requires the client to initiate the MCP conversation
(event-stream) at the endpoint provided by the server.  The endpoint
provided by the server must obey where the client sees the server,
rather than being assumed to be server-root `/message`.

The Streamable HTTP endpoint does not need the full proxy address
because the response is an event-stream directly, and does not use SSE.
2025-08-21 23:11:08 -07:00
Ola Hungerford
f22aa1f5e2
Merge pull request #741 from cliffhall/stderr-handling
Handling of stderr on STDIO servers
2025-08-21 19:10:19 -07:00
cliffhall
4cf7aeb9ed proper levels for server shutdown messages 2025-08-21 19:08:51 -04:00
cliffhall
fb0b56505a Trim message before sending to client 2025-08-21 18:55:58 -04:00
cliffhall
c54215252e Trim message before sending to client 2025-08-21 18:40:19 -04:00
cliffhall
f472327ea0 Trim message before sending to client 2025-08-21 18:12:38 -04:00
cliffhall
ec99372d92 * Remove handling of out-of-spec 'notification/stderr' messages. It's not a thing. See https://github.com/modelcontextprotocol/servers/pull/2469
* Inspect the stderr output of STDIO servers and attempt to assign an appropriate RFC 5424 Syslog Protocol level before sending a leveled logging message to the client
2025-08-21 18:04:07 -04:00
cliffhall
9dbd5cc85b * Remove handling of out-of-spec 'notification/stderr' messages. It's not a thing. See https://github.com/modelcontextprotocol/servers/pull/2469
* Inspect the stderr output of STDIO servers and attempt to assign an appropriate RFC 5424 Syslog Protocol level before sending a leveled logging message to the client
2025-08-21 18:01:29 -04:00
Ola Hungerford
0e30df8801
Merge branch 'main' into fix-704-trim-command-whitespace 2025-08-19 21:12:41 -07:00
cliffhall
2f93d70364 bump version to 0.16.5 2025-08-18 11:37:41 -04:00
cliffhall
28c0bf176a Update Typescript SDK version to latest 2025-08-18 11:13:49 -04:00
Ola Hungerford
44b4417951
Merge branch 'main' into reverse-env-order-for-cli-stdio 2025-08-18 06:57:16 -07:00
Richard Michael
9a1540c79a Trim whitespace from command query parameter 2025-08-14 14:25:51 -07:00
olaservo
b6af0c7f67 bump @modelcontextprotocol/sdk version to ^1.17.2 in all package.json files 2025-08-13 11:06:13 -07:00
olaservo
ca913eb06f Bump to 0.16.4 2025-08-12 20:16:06 -07:00
Ola Hungerford
62926b61ff
Merge branch 'main' into bump-version 2025-08-08 18:35:10 -07:00
olaservo
b89b10beac Bump version 2025-08-08 15:46:58 -07:00
Felix Weinberger
7ea47c0caa
Fix transport type propagation from CLI to web client
- Add --transport and --server-url support to client/bin/start.js
- Pass transport configuration through server to client via /config endpoint
- Update client App.tsx to use defaultTransport and defaultServerUrl from server
- Ensure SSE and HTTP transport configs work properly from CLI
2025-08-05 19:38:44 +01:00
Richard Michael
d019376c1d Update zod 2025-07-29 17:40:35 -07:00
Richard Michael
cd8b600ae3 Update @types/cors 2025-07-29 17:40:35 -07:00
Richard Michael
98a3ee0ef3 Update @types/express 2025-07-29 17:40:35 -07:00
Felix Weinberger
939a7dab58
chore: update ts-sdk to 0.17.0 and bump version to 0.16.2 2025-07-25 15:57:43 +01:00
Felix Weinberger
c7b90a1af9
Fix command-line argument passing to pre-fill UI
When running the inspector with command-line arguments (e.g.,
`npx @modelcontextprotocol/inspector node build/index.js arg1 arg2`),
the command and arguments were not being properly passed through to
the UI for pre-filling.

Changes:
- cli.ts now passes command and args to start.js
- start.js uses --command for the command and --args for arguments
- Server parses the new --command parameter
- /config endpoint returns correct values for UI pre-filling

This ensures the UI correctly displays the command and arguments
passed on the command line instead of showing old localStorage values.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-24 13:06:36 +01:00
Cliff Hall
5c15e50caa
Merge branch 'main' into patch-1 2025-07-11 14:58:06 -04:00
cliffhall
acd166263e Bump version to 0.16.1 2025-07-10 16:08:47 -04:00
olaservo
f8aac1758c chore: bump version to 0.16.0 2025-07-08 07:45:31 -07:00
Kent C. Dodds
7d5f7968d1
Rename MCP_PROXY_TOKEN to MCP_PROXY_AUTH_TOKEN (#1)
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2025-07-07 15:21:27 -06:00
Cliff Hall
f3f06efa7e
Merge branch 'main' into con-refused 2025-07-03 11:30:12 -04:00
Manabu McCloskey
5868c6bad6 print explicit 404 message
Signed-off-by: Manabu McCloskey <manabu.mccloskey@gmail.com>
2025-07-03 14:48:46 +00:00
Felix Weinberger
042e7a2aa7
refactor: move browser auto-open logic to client process
Simplifies the startup flow by consolidating browser opening
in the client script rather than the start script for prod.

We were duplicating a lot of logging, making it easy for
logs to go out of sync - this is a proposal to consolidate:

- server only logs info about itself
- client only logs info about itself

To reduce the number of places we print connection information
to the user.
2025-06-27 15:01:34 +01:00
Felix Weinberger
9fcfd89326
fix: pass proxy port via URL params when non-default
- Update client to read MCP_PROXY_PORT from URL parameters
- Update server to include port in displayed URL when non-default
- Update start scripts to pass SERVER_PORT to client
- Use DEFAULT_MCP_PROXY_LISTEN_PORT constant instead of magic numbers

This fixes the issue where the client couldn't connect to the proxy
when SERVER_PORT was set to a non-default value.
2025-06-26 10:52:49 +01:00
Cliff Hall
b28a10eae5
Merge branch 'main' into fweinberger/client-localhost 2025-06-25 17:57:55 -04:00
olaservo
d49a5f65c1 Bump sdk 2025-06-25 07:22:34 -07:00
olaservo
2ca82b5be6 Bump version to 0.15.0 2025-06-25 07:19:44 -07:00
Felix Weinberger
d0673ba9e1
refactor: Use specific SERVER_PORT and CLIENT_PORT env vars
Per PR feedback from cliffhall:
- Changed PORT to SERVER_PORT in server/src/index.ts
- Changed PORT to CLIENT_PORT in client/bin/client.js
- Added parseInt() for CLIENT_PORT consistency
- Updated start.js to pass correct env var names

This improves clarity by using specific environment variables for
server and client ports instead of the generic PORT variable.
2025-06-24 10:43:13 +01:00