inspector icon indicating copy to clipboard operation
inspector copied to clipboard

Support adding arbitrary headers

Open yuedong111 opened this issue 7 months ago • 9 comments
trafficstars

Why not replace the authorization field with headers? This makes the test more flexible.

yuedong111 avatar Apr 02 '25 07:04 yuedong111

Can you explain our use case ?

pulkitsharma07 avatar Apr 02 '25 11:04 pulkitsharma07

@pulkitsharma07 I agree with @yuedong111 . Instead of a Bearer Token field, a user should be allowed more flexibility in which headers gets included in the http request.

For example, what if the MCP server is not using a Bearer Token for authentication but is rather using an API Key which requires the Ocp-Apim-Subscription-Key header?

A generic text field (or something similar to Postman) would allow for this flexibility. This design would still allow for Bearer tokens by specifying Authorization: Bearer <token>

Here is where the Bearer Header is currently being set. We should make this generic so the user can set any arbitrary header.

ericlabouve-sn avatar Apr 08 '25 01:04 ericlabouve-sn

+1 on this. It could just be an optional section for additional HTTP headers. The existing bearer token input is easier to use and I think it would be nice if it stayed.

anthonychu avatar Apr 10 '25 17:04 anthonychu

+1 on this. I need to pass three custom headers, that are vital for my application working

charlesr1971 avatar Apr 14 '25 10:04 charlesr1971

Image

what about this? we're converting a lot of restful api to mcp servers via an mcp-gateway service. it'll be helpful if inspector could support custom headers instead of forcing jwt auth. if this sounds broadly useful, i'm happy to submit a pr.

iFurySt avatar Apr 17 '25 06:04 iFurySt

@iFurySt Yes. This sounds great!😊

charlesr1971 avatar Apr 17 '25 07:04 charlesr1971

@iFurySt looking forward to your PR 😄

cristipufu avatar Apr 22 '25 10:04 cristipufu

@iFurySt looking forward to this addition, any update on this? 😁

Blackbaud-JamesZhang avatar May 13 '25 22:05 Blackbaud-JamesZhang

@iFurySt +1 on this. I will be helpful to have this feature

anandwilbert avatar May 15 '25 08:05 anandwilbert

+1, I need to send more headers in addition to auth like x-tenant-name etc

ashubham avatar Jun 02 '25 19:06 ashubham

+1

SteffanDefinely avatar Jun 06 '25 10:06 SteffanDefinely

+++++1 this would be MORE flexible for developers who wanna suport customized headers to connect to mcp servers; looking forward to your updates!!!

dahaipeng avatar Jun 13 '25 08:06 dahaipeng

Need for a custom header to pass some user information when initialize the connection.

bozhlab avatar Jun 17 '25 03:06 bozhlab

@iFurySt love your screenshot! Cannot wait to see your PR!

rliuamzn avatar Jun 19 '25 01:06 rliuamzn

I use "Authorization: Token xyz .." It's default in Django REST

+1

domlysi avatar Jun 21 '25 08:06 domlysi

need this as well

itai-gendler avatar Jun 30 '25 08:06 itai-gendler

I use "Authorization: Token xyz .." It's default in Django REST

+1

I think if this is a JWT, it should be:

Authorization: Bearer [JWT]

charlesr1971 avatar Jun 30 '25 08:06 charlesr1971

Using @popomore fork at the moment (associated with PR #549) and it works fine. Please merge this, since the fork is behind by a hundredish commits.

delepster avatar Jul 01 '25 21:07 delepster

+1

fakeroot-lu avatar Jul 25 '25 06:07 fakeroot-lu

+1

mgoldsborough avatar Jul 26 '25 17:07 mgoldsborough

+1

0x28F4 avatar Jul 28 '25 15:07 0x28F4

+1

cosmin-petrescu avatar Aug 13 '25 03:08 cosmin-petrescu

+1

Lukas-Klein avatar Aug 26 '25 07:08 Lukas-Klein

+1

maarcingebala avatar Aug 26 '25 09:08 maarcingebala

+1

JadJabbour avatar Aug 26 '25 10:08 JadJabbour

+1

AyatKhraisat avatar Aug 30 '25 16:08 AyatKhraisat

+1

josephkalayci avatar Sep 01 '25 22:09 josephkalayci

+1

Gabswim avatar Sep 03 '25 17:09 Gabswim

Note: While the PR is pending https://github.com/modelcontextprotocol/inspector/pull/549, you can test the changes by running:

npx github:popomore/inspector

⚠️ This runs code from an unmerged PR. Please review the changes before running to ensure they're safe.

Gabswim avatar Sep 03 '25 17:09 Gabswim

@Gabswim I believe these headers are only sent during the connection request. There are MCPs which expects MCP during the tool call as well. Is there a possibility of sending these headers along with each tool call as well?

palash1611 avatar Sep 04 '25 05:09 palash1611