Commit graph

1,612 commits

Author SHA1 Message Date
David Soria Parra
b476ece67e
Update issue templates 2025-09-08 11:50:36 +01:00
Ola Hungerford
9e4bbab776
Merge pull request #787 from cliffhall/dynamic-headers
Implement dynamic header injection for proxy transports.
2025-09-07 22:03:34 -07:00
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
Cliff Hall
ec84e21556
Merge pull request #786 from max-stytch/max/fix-url-serialization
fix: correct authState.authorizationUrl type to URL
2025-09-06 11:16:30 -04:00
Max Gerber
71583caf3b
fix: correct authState.authorizationUrl type to URL 2025-09-05 18:40:48 -07:00
Cliff Hall
7792125a02
Merge pull request #781 from ln-12/clear_history_and_notification_panel
feat: add clear buttons for request history and server notifications
2025-09-04 16:04:43 -04:00
lorenzo.neumann
801ae28ecb feat: add clear buttons for request history and server notifications
fixes #780
2025-09-04 13:37:19 +02:00
Ola Hungerford
377211061b
Merge pull request #777 from cliffhall/bump-version-to-0.16.6 0.16.6
Bump version to 0.16.6
2025-09-03 08:33:17 -07:00
cliffhall
31dd05634e Bump version to 0.16.6 2025-09-03 10:21:29 -04:00
Ola Hungerford
062cea1d55
Merge pull request #774 from cliffhall/auto-level-handling
Auto log-level handling support
2025-09-02 22:02:46 -07: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
Ola Hungerford
e1d311c6e1
Merge pull request #739 from nsheaps/main
fix: correct stdout buffering issues in spawned processes
2025-09-01 09:22:32 -07:00
Cliff Hall
05b279a2e6
Merge pull request #768 from olaservo/cli-header-followups
Add CLI header integration tests and update test scripts
2025-09-01 11:04:42 -04:00
Cliff Hall
d22a8a696a
Merge branch 'main' into cli-header-followups 2025-09-01 10:58:17 -04:00
Ola Hungerford
eaf16a780b
Merge pull request #703 from phuctm97/update-dependencies
`tailwindcss-animate` should be a dev dependency
2025-09-01 07:53:40 -07:00
Cliff Hall
9255ce045a
Merge branch 'main' into update-dependencies 2025-09-01 10:51:22 -04:00
Ola Hungerford
80ab4dcc28
Merge branch 'main' into main 2025-09-01 06:52:44 -07:00
Ola Hungerford
244109402c
Merge pull request #745 from pavan-mellamputi-socure/update-progress-method
Fix a typo in progress notification method name
2025-08-31 20:58:06 -07:00
Ola Hungerford
8971add002
Merge branch 'main' into update-dependencies 2025-08-30 06:59:48 -07:00
olaservo
e27600cbf4 Add CLI header integration tests and update test scripts
- Introduced integration tests for header functionality in a new script `cli-header-tests.js`.
- Updated the `package.json` to include the new test script and modified the existing test command to run all tests.
- Adjusted the main CLI exit behavior to ensure proper termination in CI environments.
- Added `.claude/settings.local.json` to `.gitignore` to prevent local settings from being tracked.
2025-08-28 20:49:11 -07:00
Ola Hungerford
0ef91d2295
Merge pull request #754 from cmgriffing/cmgriffing/fix-cli-truncated-output
Make cli output awaitable to prevent truncating the result
2025-08-28 20:44:42 -07:00
Ola Hungerford
d3fcedc81a
Merge branch 'main' into cmgriffing/fix-cli-truncated-output 2025-08-28 20:40:58 -07:00
Ola Hungerford
5ca3aab124
Merge pull request #716 from philfreo/feature/add-header-support
Add support for --header flags in MCP Inspector CLI
2025-08-28 20:03:10 -07:00
Ola Hungerford
897d9f07bc
Merge branch 'main' into feature/add-header-support 2025-08-28 19:44:09 -07:00
Chris Griffing
f4a176eb7b Merge branch 'main' of github.com:modelcontextprotocol/inspector into cmgriffing/fix-cli-truncated-output 2025-08-28 17:55:02 -07:00
Cliff Hall
ef11c36a9e
Merge pull request #647 from olaservo/parse-tool-arg
Parse tool args from CLI as JsonValue instead of just strings
2025-08-28 14:33:05 -04:00
Ola Hungerford
9da9f01e37
Merge branch 'main' into parse-tool-arg 2025-08-27 20:40:59 -07:00
olaservo
03d48f3787 Add example to Readme of calling a tool with JSON arguments 2025-08-27 20:40:28 -07:00
Ola Hungerford
e5d0f34981
Merge branch 'main' into feature/add-header-support 2025-08-27 20:33:24 -07:00
Ola Hungerford
f94f2d8203
Merge pull request #708 from richardkmichael/fix-630
fix: STDIO and SSE transports need MCP_FULL_PROXY_ADDRESS
2025-08-27 20:17:33 -07:00
Ola Hungerford
7a32c3db92
Merge pull request #697 from Raghuboi/docs/utils-jsdoc
docs: add JSDoc documentation to utility functions
2025-08-27 20:16:25 -07:00
Ola Hungerford
07a43c9266
Merge branch 'main' into update-dependencies 2025-08-27 20:13:37 -07:00
Ola Hungerford
73873e2b77
Merge branch 'main' into docs/utils-jsdoc 2025-08-27 20:13:01 -07:00
Ola Hungerford
161f5d365a
Merge branch 'main' into fix-630 2025-08-27 19:54:07 -07:00
Ola Hungerford
cc6b2656dd
Merge branch 'main' into parse-tool-arg 2025-08-27 19:51:52 -07:00
Chris Griffing
67f35363d8 Make cli output awaitable to prevent truncating the result 2025-08-26 16:14:44 -07:00
Cliff Hall
7fc4e87113
Merge pull request #728 from olaservo/update-cc-action-yaml
Update CC GitHub Action to have same config as servers repo action
2025-08-26 15:24:24 -04:00
olaservo
ddf74d0766 Fix formatting 2025-08-26 10:00:03 -07:00
Ola Hungerford
426a33c2f3
Merge branch 'main' into update-cc-action-yaml 2025-08-26 09:58:44 -07:00
Nathan Heaps
1f197bf906
Merge branch 'main' into main 2025-08-26 11:35:15 -04:00
Ola Hungerford
616d9face4
Merge pull request #746 from cliffhall/docker-readme
Add Docker container startup command to README.md
2025-08-25 21:31:12 -07:00
cliffhall
98becdf5e0 In Dockerfile
- use current-alpine3.22 AS builder
- The node:24-slim has a high vulnerability CVE as yet unfixed which allows running commands on the host as root
2025-08-25 11:41:44 -04:00
cliffhall
6853dcf42d In Dockerfile
- use current-alpine3.22 AS builder
- The node:24-slim has a high vulnerability CVE as yet unfixed which allows running commands on the host as root
2025-08-25 11:31:54 -04:00
cliffhall
c2e117a4a9 Add Docker container startup command to README.md 2025-08-25 10:13:32 -04:00
pavan-mellamputi-socure
8f2e53c273
Fix a typo in progress notification method name
It shoud be `notifications/progress` not `notification/progress` (not singular).

This matches the latest spec.

https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/progress
2025-08-22 18:48:26 -07:00
Nathan Heaps
d758e8be93
Merge branch 'main' into main 2025-08-22 09:55:42 -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
89740ef5d1 Add tests for MCP_PROXY_FULL_ADDRESS SSE endpoint support
Tests verify that proxyFullAddress query parameter is sent for both
STDIO and SSE transports, but not Streamable HTTP, when
MCP_PROXY_FULL_ADDRESS is configured.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-22 00:47:22 -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