fix: the mcp server disable status

This commit is contained in:
Novice
2025-06-26 13:54:18 +08:00
parent ef35e9febb
commit ecc4ad0770
2 changed files with 4 additions and 1 deletions

View File

@ -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")

View File

@ -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)