feat: implement MCI session fetching using employee number
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 1m3s
Some checks failed
Deploy to OCIWP / deploy (push) Failing after 1m3s
This commit is contained in:
42
scratch/fetch_mcp_tools.py
Normal file
42
scratch/fetch_mcp_tools.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import requests
|
||||
import json
|
||||
import sseclient
|
||||
import threading
|
||||
import sys
|
||||
|
||||
def main():
|
||||
url = "https://axhubmcp.devjun.net/mcp/custom/cmm"
|
||||
|
||||
# 1. Start SSE connection
|
||||
response = requests.get(url, stream=True, verify=False)
|
||||
client = sseclient.SSEClient(response)
|
||||
|
||||
post_url = None
|
||||
|
||||
# We will read events in a background thread to not block the main thread
|
||||
for event in client.events():
|
||||
if event.event == 'endpoint':
|
||||
# 2. Get POST endpoint
|
||||
post_url = event.data
|
||||
if not post_url.startswith('http'):
|
||||
# Assuming relative URL, construct absolute
|
||||
from urllib.parse import urljoin
|
||||
post_url = urljoin(url, post_url)
|
||||
|
||||
# Send tools/list request
|
||||
payload = {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"method": "tools/list"
|
||||
}
|
||||
requests.post(post_url, json=payload, verify=False)
|
||||
|
||||
elif event.event == 'message':
|
||||
data = json.loads(event.data)
|
||||
if data.get('id') == 1:
|
||||
# 3. Print tools/list response
|
||||
print(json.dumps(data, indent=2, ensure_ascii=False))
|
||||
sys.exit(0)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
40
scratch/print_tools_json.py
Normal file
40
scratch/print_tools_json.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import yaml
|
||||
import json
|
||||
import glob
|
||||
import sys
|
||||
|
||||
def main():
|
||||
tools = []
|
||||
|
||||
# cmm 폴더의 yaml 파일들을 읽습니다.
|
||||
files = glob.glob('dap-was-cus/src/main/resources/tool-definitions/cmm/*.yml')
|
||||
if not files:
|
||||
files = glob.glob('dap-was-sal/src/main/resources/tool-definitions/cmm/*.yml')
|
||||
|
||||
for f in files:
|
||||
with open(f, 'r', encoding='utf-8') as file:
|
||||
data = yaml.safe_load(file)
|
||||
|
||||
# MCP JSON Schema 규격에 맞게 변환
|
||||
tool = {
|
||||
"name": data.get("name"),
|
||||
"description": data.get("description", {}).get("function", "") if isinstance(data.get("description"), dict) else data.get("description", ""),
|
||||
"inputSchema": data.get("parameters_schema", {
|
||||
"type": "object",
|
||||
"properties": {}
|
||||
})
|
||||
}
|
||||
tools.append(tool)
|
||||
|
||||
response = {
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": {
|
||||
"tools": tools
|
||||
}
|
||||
}
|
||||
|
||||
print(json.dumps(response, indent=2, ensure_ascii=False))
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user