Skip to content

Commit 17836bd

Browse files
Simplify cross-reference checking method (#52)
* no need to check for number of servers * ensure we have enough flagged names
1 parent ed8d4d8 commit 17836bd

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/mcp_scan/MCPScanner.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,17 @@ async def scan_path(self, path: str, inspect_only: bool = False) -> ScanPathResu
199199
async def check_cross_references(self, path_result: ScanPathResult) -> CrossRefResult:
200200
logger.info("Checking cross references for path: %s", path_result.path)
201201
cross_ref_result = CrossRefResult(found=False)
202-
if sum(len(server.entities) for server in path_result.servers) < 2:
203-
logger.debug("Not enough entities to check cross references")
204-
return cross_ref_result
205-
if len(path_result.servers) < 2:
206-
logger.debug("Not enough servers to check cross references")
207-
return cross_ref_result
208202
for server in path_result.servers:
209203
other_servers = [s for s in path_result.servers if s != server]
210204
other_server_names = [s.name for s in other_servers]
211205
other_entity_names = [e.name for s in other_servers for e in s.entities]
212206
flagged_names = set(map(str.lower, other_server_names + other_entity_names))
213207
logger.debug("Found %d potential cross-reference names", len(flagged_names))
208+
209+
if len(flagged_names) < 1:
210+
logger.debug("No flagged names found, skipping cross-reference check")
211+
continue
212+
214213
for entity in server.entities:
215214
tokens = (entity.description or "").lower().split()
216215
for token in tokens:

0 commit comments

Comments
 (0)