mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 02:10:15 +01:00
🔄 fix: Improve MCP Connection Cleanup (#7400)
* chore: linting for mcp related modules * fix: update `isConnected` method to return a Promise and handle connection state asynchronously to properly handle/cleanup disconnected user connections
This commit is contained in:
parent
535e7798b3
commit
fe311df969
4 changed files with 29 additions and 12 deletions
|
|
@ -85,7 +85,10 @@ export const SSEOptionsSchema = BaseOptionsSchema.extend({
|
|||
export const StreamableHTTPOptionsSchema = BaseOptionsSchema.extend({
|
||||
type: z.literal('streamable-http'),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
url: z.string().url().refine(
|
||||
url: z
|
||||
.string()
|
||||
.url()
|
||||
.refine(
|
||||
(val) => {
|
||||
const protocol = new URL(val).protocol;
|
||||
return protocol !== 'ws:' && protocol !== 'wss:';
|
||||
|
|
@ -93,7 +96,7 @@ export const StreamableHTTPOptionsSchema = BaseOptionsSchema.extend({
|
|||
{
|
||||
message: 'Streamable HTTP URL must not start with ws:// or wss://',
|
||||
},
|
||||
),
|
||||
),
|
||||
});
|
||||
|
||||
export const MCPOptionsSchema = z.union([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue