mirror of
https://github.com/langgenius/dify.git
synced 2026-05-03 17:08:03 +08:00
fix: the mcp server disable status
This commit is contained in:
@ -2,6 +2,7 @@ from flask_restful import Resource, reqparse
|
||||
from pydantic import ValidationError
|
||||
from werkzeug.exceptions import NotFound
|
||||
|
||||
from controllers.console.app.mcp_server import AppMCPServerStatus
|
||||
from controllers.mcp import api
|
||||
from controllers.web.error import (
|
||||
AppUnavailableError,
|
||||
@ -33,6 +34,8 @@ class MCPAppApi(Resource):
|
||||
server = db.session.query(AppMCPServer).filter(AppMCPServer.server_code == server_code).first()
|
||||
if not server:
|
||||
raise NotFound("Server Not Found")
|
||||
if server.status != AppMCPServerStatus.ACTIVE:
|
||||
raise NotFound("Server is not active")
|
||||
app = db.session.query(App).filter(App.id == server.app_id).first()
|
||||
if not app:
|
||||
raise NotFound("App Not Found")
|
||||
|
||||
@ -322,7 +322,7 @@ class StreamableHTTPTransport:
|
||||
jsonrpc_error = JSONRPCError(
|
||||
jsonrpc="2.0",
|
||||
id=request_id,
|
||||
error=ErrorData(code=32600, message="Session terminated"),
|
||||
error=ErrorData(code=32600, message="Session terminated by server"),
|
||||
)
|
||||
session_message = SessionMessage(JSONRPCMessage(jsonrpc_error))
|
||||
server_to_client_queue.put(session_message)
|
||||
|
||||
Reference in New Issue
Block a user