@@ -20,6 +20,16 @@ export class PageIndexMcpClient {
2020 this . apiKey = apiKey ;
2121 }
2222
23+ /**
24+ * Get client identification headers
25+ */
26+ private getClientHeaders ( ) : Record < string , string > {
27+ return {
28+ 'X-Client-Type' : __CLIENT_TYPE__ ,
29+ 'X-Client-Version' : __VERSION__ ,
30+ } ;
31+ }
32+
2333 /**
2434 * Connect to the remote PageIndex MCP server
2535 */
@@ -43,8 +53,12 @@ export class PageIndexMcpClient {
4353
4454 // Try StreamableHTTP first, fallback to SSE for compatibility
4555 try {
46- // Use simplified authenticated fetch
47- const authenticatedFetch = createAuthenticatedFetch ( this . apiKey ) ;
56+ // Use simplified authenticated fetch with client headers
57+ const clientHeaders = this . getClientHeaders ( ) ;
58+ const authenticatedFetch = createAuthenticatedFetch (
59+ this . apiKey ,
60+ clientHeaders ,
61+ ) ;
4862
4963 this . transport = new StreamableHTTPClientTransport (
5064 streamableHttpUrl ,
@@ -61,7 +75,11 @@ export class PageIndexMcpClient {
6175 } catch ( _error ) {
6276 try {
6377 // For SSE transport, we need to pass authenticated fetch as well
64- const authenticatedFetch = createAuthenticatedFetch ( this . apiKey ) ;
78+ const clientHeaders = this . getClientHeaders ( ) ;
79+ const authenticatedFetch = createAuthenticatedFetch (
80+ this . apiKey ,
81+ clientHeaders ,
82+ ) ;
6583 this . transport = new SSEClientTransport ( sseUrl , {
6684 fetch : authenticatedFetch ,
6785 } ) ;
0 commit comments