Skip to content
View in the app

A better way to browse. Learn more.

Kaspersky Support Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SSE connection blocked - Creating an MCP Server issue

Today, I was following the MCP course and set up a local MCP server for testing.

However, I encountered an issue where the MCP server doesn't function properly when Kaspersky is enabled. 
It works fine when I temporarily pause Kaspersky.

I suspect that the SSE Connection might be blocked, but I couldn't find any settings to adjust this. 
Of course, my assumption could be incorrect.

Has anyone else experienced or resolved this issue?

I tested on Windows 11.

To replicate the issue, you can follow these steps:

1) Run the Python code below. 
You can find this code at the provided link. 
https://learn.deeplearning.ai/courses/mcp-build-rich-context-ai-apps-with-anthropic/lesson/dbabg/creating-an-mcp-server

Save the file as mcp_chatbot.py.

2) Execute the following command:
npx @modelcontextprotocol/inspector uv run mcp_chatbot.py


3) Once you see the message "MCP Inspector is up and running at http://127.0.0.1:6274" 
open http://127.0.0.1:6274


4) Click the Connect button.
You should encounter the error: "Connection Error, is your MCP server running?"

5) Error details
 

Quote

Error in /message route: Error: SSE connection not established
    at SSEServerTransport.handlePostMessage (file:///C:/Users/testuser/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js:61:19)
    at file:///C:/Users/testuser/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:262:25
    at Layer.handleRequest (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\lib\layer.js:152:17)
    at next (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\lib\route.js:157:13)
    at Route.dispatch (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\lib\route.js:117:3)
    at handle (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\index.js:435:11)
    at Layer.handleRequest (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\lib\layer.js:152:17)
    at C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\index.js:295:15
    at processParams (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\index.js:582:12)
    at next (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\router\index.js:291:5)
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (node:_http_outgoing:659:11)
    at ServerResponse.header (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\response.js:684:10)
    at ServerResponse.json (C:\Users\testuser\AppData\Local\npm-cache\_npx\5a9d879542beca3a\node_modules\express\lib\response.js:247:10)
    at file:///C:/Users/testuser/AppData/Local/npm-cache/_npx/5a9d879542beca3a/node_modules/@modelcontextprotocol/inspector/server/build/index.js:266:25
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)




Screen shot :  Works and Error version

image.thumb.png.50e2c72521ea52ad384a4f13c7650a49.pngmcp_server_error.thumb.png.3fd5b28adc3e8f74dcd6e66f9f3efcce.png

Python Code

Quote

import arxiv import json import os from typing import List from mcp.server.fastmcp import FastMCP PAPER_DIR = "papers" # Initialize FastMCP server mcp = FastMCP("research") @mcp.tool() def search_papers(topic: str, max_results: int = 5) -> List[str]: """ Search for papers on arXiv based on a topic and store their information. Args: topic: The topic to search for max_results: Maximum number of results to retrieve (default: 5) Returns: List of paper IDs found in the search """ # Use arxiv to find the papers client = arxiv.Client() # Search for the most relevant articles matching the queried topic search = arxiv.Search( query=topic, max_results=max_results, sort_by=arxiv.SortCriterion.Relevance ) papers = client.results(search) # Create directory for this topic path = os.path.join(PAPER_DIR, topic.lower().replace(" ", "_")) os.makedirs(path, exist_ok=True) file_path = os.path.join(path, "papers_info.json") # Try to load existing papers info try: with open(file_path, "r") as json_file: papers_info = json.load(json_file) except (FileNotFoundError, json.JSONDecodeError): papers_info = {} # Process each paper and add to papers_info paper_ids = [] for paper in papers: paper_ids.append(paper.get_short_id()) paper_info = { 'title': paper.title, 'authors': [author.name for author in paper.authors], 'summary': paper.summary, 'pdf_url': paper.pdf_url, 'published': str(paper.published.date()) } papers_info[paper.get_short_id()] = paper_info # Save updated papers_info to json file with open(file_path, "w") as json_file: json.dump(papers_info, json_file, indent=2) print(f"Results are saved in: {file_path}") return paper_ids @mcp.tool() def extract_info(paper_id: str) -> str: """ Search for information about a specific paper across all topic directories. Args: paper_id: The ID of the paper to look for Returns: JSON string with paper information if found, error message if not found """ for item in os.listdir(PAPER_DIR): item_path = os.path.join(PAPER_DIR, item) if os.path.isdir(item_path): file_path = os.path.join(item_path, "papers_info.json") if os.path.isfile(file_path): try: with open(file_path, "r") as json_file: papers_info = json.load(json_file) if paper_id in papers_info: return json.dumps(papers_info[paper_id], indent=2) except (FileNotFoundError, json.JSONDecodeError) as e: print(f"Error reading {file_path}: {str(e)}") continue return f"There's no saved information related to paper {paper_id}." if __name__ == "__main__": mcp.run(transport='stdio')

 

Featured Replies

Welcome to Kaspersky Comminty.

 

Please provide version of K. product installed.

Та же проблема, блокирует работу инспектора (modelcontextprotocol/inspector) при запуске локально на ПК, очень нужно решение!

 

https://github.com/modelcontextprotocol/inspector

 

The same problem blocks the work of the inspector (model context protocol/inspector) when running locally on a PC, we really need a solution!

You both can try to create an Exclusion for Scan Encrypted connections and 127.0.0.1.

 

Go to Intrusion Prevention -> Manage Applications, find the executables / services involved, double click over them -> tab Exclusions, and create an exclusion as shown here:

 

image.thumb.png.d2451533ded3c0e6ba62e168b5f3e8a4.png

 

And Save changes.

1 час назад, harlan4096 сказал:

You both can try to create an Exclusion for Scan Encrypted connections and 127.0.0.1.

 

Go to Intrusion Prevention -> Manage Applications, find the executables / services involved, double click over them -> tab Exclusions, and create an exclusion as shown here:

 

image.thumb.png.d2451533ded3c0e6ba62e168b5f3e8a4.png

 

And Save changes.

Добавил в исключения браузер и другие программы (причем установил «Не проверять весь трафик», а не только шифрованный) – не помогло, все начинает работать только если отключить в Касперском «Веб-антивирус».

I added the browser and other programs to the exceptions (and set "Do not check all traffic", not just encrypted) it did not help, everything starts working only if you disable Kaspersky's "Web Antivirus".

111.png

Then try to add 127.0.0.1, in Safe Surfing (Web Antivirus module) -> Trusted addresses.

Большое спасибо за ваш ответ — он действительно помог!
Я разобрался с настройкой: оказалось, что не нужно добавлять приложения в исключения антивируса. Достаточно было в Kaspersky Internet Security зайти в настройки веб-антивируса и в разделе «Не проверять веб-трафик с доверенных веб-адресов» добавить два URL: http://127.0.0.1/* и http://localhost/*

После этого всё заработало корректно. Ещё раз благодарю за помощь!

 

Thank you so much for your help — your advice worked perfectly!
I figured out the configuration: it turns out that adding applications to the antivirus exclusions wasn’t necessary. Instead, in Kaspersky Internet Security, I simply had to go to the web antivirus settings and under "Do not scan web traffic from trusted web addresses", add the following URLs: http://127.0.0.1/*  http://localhost/*

After doing this, everything started working as expected. Thanks again for your support!

222.png

So, You can now remove the exclusions created via Intrusion Prevention -> Manage Applications.

 

Also, I would migrate Your KIS to Kaspersky Standard, KIS/KTS will eventually get obsolete.

  • 2 weeks later...
  • Author

Sorry for late reply. It works now.  

Thanks a lot guys.

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.