Repository navigation
Expand file tree
/
Copy pathverify.py
More file actions
44 lines (40 loc) · 1.38 KB
/
Copy pathverify.py
File metadata and controls
44 lines (40 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import json
from pathlib import Path
BASE = Path('/home/master/framework360-mcp-server')
errors = []
info = []
endpoints_path = BASE / 'endpoints.json'
if not endpoints_path.exists():
errors.append('missing endpoints.json')
else:
try:
spec = json.loads(endpoints_path.read_text(encoding='utf-8'))
except Exception as e:
errors.append(f'endpoints.json parse error: {e}')
spec = {}
info.append(f'endpoints.json loaded with {len(spec.get("endpoints", []))} endpoints')
for ep in spec.get('endpoints', []):
if not ep.get('path'):
errors.append('empty endpoint path')
if not ep.get('method'):
errors.append(f'missing method for {ep.get("path")}')
src_path = BASE / 'src' / 'index.mjs'
if not src_path.exists():
errors.append('missing src/index.mjs')
else:
src = src_path.read_text(encoding='utf-8')
required = ['CallToolRequestSchema', 'ListToolsRequestSchema', 'StdioServerTransport', 'loadEndpointSpec', 'buildHeaders']
for token in required:
contains = token in src
info.append(f'src/index.mjs contains {token}: {contains}')
if not contains:
errors.append(f'src/index.mjs missing {token}')
print('INFO')
for line in info:
print(f'- {line}')
if errors:
print('\nERRORS')
for line in errors:
print(f'- {line}')
raise SystemExit(1)
print('\nVERIFY PASSED')