Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit 98a8a15

Browse files
committed
fix
1 parent 76272d9 commit 98a8a15

1 file changed

Lines changed: 49 additions & 15 deletions

File tree

packages/mcp-use/examples/client/react/react_example.tsx

Lines changed: 49 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ const MCPTools: React.FC = () => {
181181
<p style={{ margin: '0', color: '#155724' }}>
182182
Found {tools.length} tools, {resources.length} resources, {prompts.length} prompts
183183
</p>
184+
<p style={{ margin: '5px 0 0 0', fontSize: '0.9em', color: '#6c757d' }}>
185+
Note: HTTP transport failed (404), successfully connected via SSE fallback
186+
</p>
184187
</div>
185188

186189
<button
@@ -260,10 +263,25 @@ const MCPTools: React.FC = () => {
260263
</div>
261264

262265
{/* Resources List */}
263-
{resources.length > 0 && (
264-
<div style={{ marginTop: '30px' }}>
265-
<h3>Available Resources ({resources.length})</h3>
266-
{resources.map((resource, index) => (
266+
<div style={{ marginTop: '30px' }}>
267+
<h3>Available Resources ({resources.length})</h3>
268+
{resources.length === 0 ? (
269+
<div
270+
style={{
271+
padding: '10px',
272+
backgroundColor: '#fff3cd',
273+
border: '1px solid #ffc107',
274+
borderRadius: '4px',
275+
color: '#856404',
276+
}}
277+
>
278+
<strong>ℹ️ Resources not supported</strong>
279+
<p style={{ margin: '5px 0 0 0', fontSize: '0.9em' }}>
280+
This MCP server does not support the resources/list method.
281+
</p>
282+
</div>
283+
) : (
284+
resources.map((resource, index) => (
267285
<div
268286
key={index}
269287
style={{
@@ -277,15 +295,30 @@ const MCPTools: React.FC = () => {
277295
<strong>{resource.name || resource.uri}</strong>
278296
{resource.description && <p style={{ margin: '5px 0 0 0', fontSize: '0.9em' }}>{resource.description}</p>}
279297
</div>
280-
))}
281-
</div>
282-
)}
298+
))
299+
)}
300+
</div>
283301

284302
{/* Prompts List */}
285-
{prompts.length > 0 && (
286-
<div style={{ marginTop: '30px' }}>
287-
<h3>Available Prompts ({prompts.length})</h3>
288-
{prompts.map((prompt, index) => (
303+
<div style={{ marginTop: '30px' }}>
304+
<h3>Available Prompts ({prompts.length})</h3>
305+
{prompts.length === 0 ? (
306+
<div
307+
style={{
308+
padding: '10px',
309+
backgroundColor: '#fff3cd',
310+
border: '1px solid #ffc107',
311+
borderRadius: '4px',
312+
color: '#856404',
313+
}}
314+
>
315+
<strong>ℹ️ Prompts not supported</strong>
316+
<p style={{ margin: '5px 0 0 0', fontSize: '0.9em' }}>
317+
This MCP server does not support the prompts/list method.
318+
</p>
319+
</div>
320+
) : (
321+
prompts.map((prompt, index) => (
289322
<div
290323
key={index}
291324
style={{
@@ -299,9 +332,9 @@ const MCPTools: React.FC = () => {
299332
<strong>{prompt.name}</strong>
300333
{prompt.description && <p style={{ margin: '5px 0 0 0', fontSize: '0.9em' }}>{prompt.description}</p>}
301334
</div>
302-
))}
303-
</div>
304-
)}
335+
))
336+
)}
337+
</div>
305338

306339
{/* Tool Result Display */}
307340
{toolResult && (
@@ -378,8 +411,9 @@ const ReactExample: React.FC = () => {
378411
<li>✅ Automatic OAuth flow handling with popup support</li>
379412
<li>✅ Fallback manual authentication link if popup is blocked</li>
380413
<li>✅ Auto-reconnect on connection loss</li>
381-
<li>✅ Support for tools, resources, and prompts</li>
414+
<li>✅ Support for tools, resources, and prompts (when supported by server)</li>
382415
<li>✅ HTTP transport with SSE fallback</li>
416+
<li>✅ Graceful handling of unsupported server methods</li>
383417
</ul>
384418
<p>
385419
<strong>Note:</strong> The Linear MCP server requires OAuth authentication. The hook will automatically

0 commit comments

Comments
 (0)