chore: Remove obsolete python scripts
This commit is contained in:
@@ -1,46 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
apps = {
|
|
||||||
"axhub-gateway": {
|
|
||||||
"pkg": "io.shinhanlife.axhub.biz.mcp.gateway",
|
|
||||||
"cls": "AxHubGatewayApplication",
|
|
||||||
"path": "axhub-gateway/src/main/java/io/shinhanlife/axhub/biz/mcp/gateway/AxHubGatewayApplication.java"
|
|
||||||
},
|
|
||||||
"axhub-tool-sms": {
|
|
||||||
"pkg": "io.shinhanlife.axhub.biz.mcp.tool.sms",
|
|
||||||
"cls": "AxHubToolSmsApplication",
|
|
||||||
"path": "axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/AxHubToolSmsApplication.java"
|
|
||||||
},
|
|
||||||
"axhub-tool-email": {
|
|
||||||
"pkg": "io.shinhanlife.axhub.biz.mcp.tool.email",
|
|
||||||
"cls": "AxHubToolEmailApplication",
|
|
||||||
"path": "axhub-tool-email/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/email/AxHubToolEmailApplication.java"
|
|
||||||
},
|
|
||||||
"axhub-tool-other": {
|
|
||||||
"pkg": "io.shinhanlife.axhub.biz.mcp.tool.other",
|
|
||||||
"cls": "AxHubToolOtherApplication",
|
|
||||||
"path": "axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/other/AxHubToolOtherApplication.java"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for module, info in apps.items():
|
|
||||||
dir_path = os.path.dirname(info["path"])
|
|
||||||
os.makedirs(dir_path, exist_ok=True)
|
|
||||||
content = f"""package {info['pkg']};
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cache.annotation.EnableCaching;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableCaching
|
|
||||||
public class {info['cls']} {{
|
|
||||||
public static void main(String[] args) {{
|
|
||||||
SpringApplication.run({info['cls']}.class, args);
|
|
||||||
}}
|
|
||||||
}}
|
|
||||||
"""
|
|
||||||
with open(info["path"], "w", encoding="utf-8") as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
print("Application classes recreated.")
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
modules = {
|
|
||||||
"axhub-gateway": 8081,
|
|
||||||
"axhub-tool-sms": 8082,
|
|
||||||
"axhub-tool-email": 8083,
|
|
||||||
"axhub-tool-other": 8084
|
|
||||||
}
|
|
||||||
|
|
||||||
# 1. Create Dockerfiles
|
|
||||||
dockerfile_template = """FROM eclipse-temurin:21-jdk-alpine
|
|
||||||
WORKDIR /app
|
|
||||||
COPY build/libs/{module}-0.0.1-SNAPSHOT.jar app.jar
|
|
||||||
ENTRYPOINT ["java", "-jar", "app.jar"]
|
|
||||||
"""
|
|
||||||
|
|
||||||
for module in modules:
|
|
||||||
with open(f"{module}/Dockerfile", "w") as f:
|
|
||||||
f.write(dockerfile_template.format(module=module))
|
|
||||||
|
|
||||||
# 2. Create application.properties for tool modules
|
|
||||||
for module, port in modules.items():
|
|
||||||
if module == "axhub-gateway":
|
|
||||||
continue
|
|
||||||
|
|
||||||
res_dir = f"{module}/src/main/resources"
|
|
||||||
os.makedirs(res_dir, exist_ok=True)
|
|
||||||
with open(f"{res_dir}/application.properties", "w") as f:
|
|
||||||
f.write(f"server.port={port}\n")
|
|
||||||
f.write("spring.application.name=" + module + "\n")
|
|
||||||
|
|
||||||
# 3. Create docker-compose.yml
|
|
||||||
compose_content = """version: '3.8'
|
|
||||||
|
|
||||||
services:
|
|
||||||
redis:
|
|
||||||
image: redis:latest
|
|
||||||
ports:
|
|
||||||
- "6379:6379"
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "redis-cli", "ping"]
|
|
||||||
interval: 5s
|
|
||||||
timeout: 3s
|
|
||||||
retries: 5
|
|
||||||
|
|
||||||
gateway:
|
|
||||||
build:
|
|
||||||
context: ./axhub-gateway
|
|
||||||
ports:
|
|
||||||
- "8081:8081"
|
|
||||||
depends_on:
|
|
||||||
redis:
|
|
||||||
condition: service_healthy
|
|
||||||
environment:
|
|
||||||
- SPRING_REDIS_HOST=redis
|
|
||||||
- SPRING_REDIS_PORT=6379
|
|
||||||
|
|
||||||
tool-sms:
|
|
||||||
build:
|
|
||||||
context: ./axhub-tool-sms
|
|
||||||
ports:
|
|
||||||
- "8082:8082"
|
|
||||||
depends_on:
|
|
||||||
- redis
|
|
||||||
|
|
||||||
tool-email:
|
|
||||||
build:
|
|
||||||
context: ./axhub-tool-email
|
|
||||||
ports:
|
|
||||||
- "8083:8083"
|
|
||||||
depends_on:
|
|
||||||
- redis
|
|
||||||
|
|
||||||
tool-other:
|
|
||||||
build:
|
|
||||||
context: ./axhub-tool-other
|
|
||||||
ports:
|
|
||||||
- "8084:8084"
|
|
||||||
depends_on:
|
|
||||||
- redis
|
|
||||||
"""
|
|
||||||
|
|
||||||
with open("docker-compose.yml", "w") as f:
|
|
||||||
f.write(compose_content)
|
|
||||||
|
|
||||||
print("Docker configurations generated.")
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
import os
|
|
||||||
import re
|
|
||||||
|
|
||||||
files = [
|
|
||||||
"axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/AxHubToolSmsApplication.java",
|
|
||||||
"axhub-tool-email/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/email/AxHubToolEmailApplication.java",
|
|
||||||
"axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/other/AxHubToolOtherApplication.java"
|
|
||||||
]
|
|
||||||
|
|
||||||
for file_path in files:
|
|
||||||
with open(file_path, "r", encoding="utf-8") as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
# Replace the basePackages
|
|
||||||
content = content.replace(
|
|
||||||
'{"io.shinhanlife.axhub.biz.mcp.tool", "io.shinhanlife.axhub.common.mcp", "io.shinhanlife.axhub.common.config"}',
|
|
||||||
'{"io.shinhanlife.axhub.biz.mcp.tool", "io.shinhanlife.axhub.biz.mcp.adapter", "io.shinhanlife.axhub.common.mcp", "io.shinhanlife.axhub.common.config"}'
|
|
||||||
)
|
|
||||||
|
|
||||||
with open(file_path, "w", encoding="utf-8") as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
print(f"Fixed {file_path}")
|
|
||||||
18
fix_build.py
18
fix_build.py
@@ -1,18 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
lombok_deps = """
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.32'
|
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.32'
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
modules = ["axhub-common", "axhub-gateway", "axhub-tool-core", "axhub-tool-sms", "axhub-tool-email", "axhub-tool-other"]
|
|
||||||
|
|
||||||
for m in modules:
|
|
||||||
build_gradle_path = os.path.join(m, "build.gradle")
|
|
||||||
if os.path.exists(build_gradle_path):
|
|
||||||
with open(build_gradle_path, "a", encoding="utf-8") as f:
|
|
||||||
f.write(lombok_deps)
|
|
||||||
|
|
||||||
print("Lombok added to all modules.")
|
|
||||||
22
fix_scans.py
22
fix_scans.py
@@ -1,22 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
files_to_fix = {
|
|
||||||
"axhub-gateway/src/main/java/io/shinhanlife/axhub/biz/mcp/gateway/AxHubGatewayApplication.java": '{"io.shinhanlife.axhub.biz.mcp.gateway", "io.shinhanlife.axhub.common.mcp", "io.shinhanlife.axhub.common.config"}',
|
|
||||||
"axhub-tool-sms/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/sms/AxHubToolSmsApplication.java": '{"io.shinhanlife.axhub.biz.mcp.tool", "io.shinhanlife.axhub.common.mcp", "io.shinhanlife.axhub.common.config"}',
|
|
||||||
"axhub-tool-email/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/email/AxHubToolEmailApplication.java": '{"io.shinhanlife.axhub.biz.mcp.tool", "io.shinhanlife.axhub.common.mcp", "io.shinhanlife.axhub.common.config"}',
|
|
||||||
"axhub-tool-other/src/main/java/io/shinhanlife/axhub/biz/mcp/tool/other/AxHubToolOtherApplication.java": '{"io.shinhanlife.axhub.biz.mcp.tool", "io.shinhanlife.axhub.common.mcp", "io.shinhanlife.axhub.common.config"}',
|
|
||||||
}
|
|
||||||
|
|
||||||
for filepath, packages in files_to_fix.items():
|
|
||||||
with open(filepath, 'r', encoding='utf-8') as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
# regex replace the content in the string
|
|
||||||
import re
|
|
||||||
content = re.sub(r'scanBasePackages = \{.*?\}', f'scanBasePackages = {packages}', content)
|
|
||||||
content = re.sub(r'basePackages = \{.*?\}', f'basePackages = {packages}', content)
|
|
||||||
|
|
||||||
with open(filepath, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(content)
|
|
||||||
|
|
||||||
print("Fixed component scans")
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
root_build_gradle = """plugins {
|
|
||||||
id 'java'
|
|
||||||
id 'org.springframework.boot' version '4.0.5' apply false
|
|
||||||
id 'io.spring.dependency-management' version '1.1.6' apply false
|
|
||||||
}
|
|
||||||
|
|
||||||
allprojects {
|
|
||||||
group = 'io.shinhanlife'
|
|
||||||
version = '0.0.1-SNAPSHOT'
|
|
||||||
}
|
|
||||||
|
|
||||||
subprojects {
|
|
||||||
apply plugin: 'java'
|
|
||||||
apply plugin: 'io.spring.dependency-management'
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = '21'
|
|
||||||
}
|
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencyManagement {
|
|
||||||
imports {
|
|
||||||
mavenBom org.springframework.boot.gradle.plugin.SpringBootPlugin.BOM_COORDINATES
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.32'
|
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.32'
|
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
|
||||||
options.compilerArgs << '-parameters'
|
|
||||||
options.compilerArgs << '-Amapstruct.defaultComponentModel=spring'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
|
|
||||||
with open("build.gradle", "w", encoding="utf-8") as f:
|
|
||||||
f.write(root_build_gradle)
|
|
||||||
|
|
||||||
# axhub-common
|
|
||||||
common_build_gradle = """dependencies {
|
|
||||||
implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.1'
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
with open("axhub-common/build.gradle", "w", encoding="utf-8") as f:
|
|
||||||
f.write(common_build_gradle)
|
|
||||||
|
|
||||||
# axhub-tool-core
|
|
||||||
core_build_gradle = """dependencies {
|
|
||||||
api project(':axhub-common')
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
|
||||||
|
|
||||||
// Resilience4j
|
|
||||||
implementation 'io.github.resilience4j:resilience4j-spring-boot3:2.2.0'
|
|
||||||
implementation 'io.github.resilience4j:resilience4j-core:2.2.0'
|
|
||||||
implementation 'io.github.resilience4j:resilience4j-circuitbreaker:2.2.0'
|
|
||||||
implementation 'io.github.resilience4j:resilience4j-ratelimiter'
|
|
||||||
implementation 'io.github.resilience4j:resilience4j-retry:2.2.0'
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-aop:3.3.0'
|
|
||||||
|
|
||||||
// MCP required
|
|
||||||
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.17.1'
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
with open("axhub-tool-core/build.gradle", "w", encoding="utf-8") as f:
|
|
||||||
f.write(core_build_gradle)
|
|
||||||
|
|
||||||
# gateway
|
|
||||||
gateway_build_gradle = """plugins {
|
|
||||||
id 'org.springframework.boot'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(':axhub-common')
|
|
||||||
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-web'
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
|
|
||||||
|
|
||||||
// MyBatis & DB
|
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-jdbc'
|
|
||||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3'
|
|
||||||
runtimeOnly 'com.h2database:h2'
|
|
||||||
implementation 'p6spy:p6spy:3.9.1'
|
|
||||||
|
|
||||||
// MapStruct
|
|
||||||
implementation "org.mapstruct:mapstruct:1.5.5.Final"
|
|
||||||
annotationProcessor "org.projectlombok:lombok-mapstruct-binding:0.2.0"
|
|
||||||
annotationProcessor "org.mapstruct:mapstruct-processor:1.5.5.Final"
|
|
||||||
|
|
||||||
implementation 'com.networknt:json-schema-validator:1.4.0'
|
|
||||||
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0'
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
with open("axhub-gateway/build.gradle", "w", encoding="utf-8") as f:
|
|
||||||
f.write(gateway_build_gradle)
|
|
||||||
|
|
||||||
# tool-sms, email, other
|
|
||||||
for tool in ["axhub-tool-sms", "axhub-tool-email", "axhub-tool-other"]:
|
|
||||||
tool_build_gradle = """plugins {
|
|
||||||
id 'org.springframework.boot'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation project(':axhub-tool-core')
|
|
||||||
}
|
|
||||||
"""
|
|
||||||
with open(f"{tool}/build.gradle", "w", encoding="utf-8") as f:
|
|
||||||
f.write(tool_build_gradle)
|
|
||||||
|
|
||||||
print("Gradle files generated.")
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
import os
|
|
||||||
import shutil
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
|
|
||||||
def create_module_structure(base_dir, module_name):
|
|
||||||
os.makedirs(os.path.join(base_dir, module_name, "src", "main", "java"), exist_ok=True)
|
|
||||||
os.makedirs(os.path.join(base_dir, module_name, "src", "main", "resources"), exist_ok=True)
|
|
||||||
|
|
||||||
def move_file_to_module(src_path, dest_module, dest_package):
|
|
||||||
if not os.path.exists(src_path):
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_dir = os.path.join(dest_module, "src", "main", "java", *dest_package.split("."))
|
|
||||||
os.makedirs(dest_dir, exist_ok=True)
|
|
||||||
|
|
||||||
file_name = os.path.basename(src_path)
|
|
||||||
dest_path = os.path.join(dest_dir, file_name)
|
|
||||||
shutil.move(src_path, dest_path)
|
|
||||||
|
|
||||||
def move_dir_to_module(src_dir, dest_module, dest_package):
|
|
||||||
if not os.path.exists(src_dir):
|
|
||||||
return
|
|
||||||
|
|
||||||
dest_dir = os.path.join(dest_module, "src", "main", "java", *dest_package.split("."))
|
|
||||||
os.makedirs(dest_dir, exist_ok=True)
|
|
||||||
|
|
||||||
for item in os.listdir(src_dir):
|
|
||||||
s = os.path.join(src_dir, item)
|
|
||||||
d = os.path.join(dest_dir, item)
|
|
||||||
if os.path.isdir(s):
|
|
||||||
shutil.copytree(s, d, dirs_exist_ok=True)
|
|
||||||
shutil.rmtree(s)
|
|
||||||
else:
|
|
||||||
shutil.move(s, d)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
print("Starting MSA Migration...")
|
|
||||||
|
|
||||||
modules = ["axhub-common", "axhub-gateway", "axhub-tool-core", "axhub-tool-sms", "axhub-tool-email", "axhub-tool-other"]
|
|
||||||
for m in modules:
|
|
||||||
create_module_structure(".", m)
|
|
||||||
|
|
||||||
base_pkg = "io.shinhanlife.axhub"
|
|
||||||
biz_pkg = f"{base_pkg}.biz.mcp"
|
|
||||||
src_base = os.path.join("src", "main", "java", "io", "shinhanlife", "axhub")
|
|
||||||
src_biz = os.path.join(src_base, "biz", "mcp")
|
|
||||||
|
|
||||||
move_dir_to_module(os.path.join(src_base, "common"), "axhub-common", f"{base_pkg}.common")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "adapter", "dto", "JsonRpcRequest.java"), "axhub-common", f"{biz_pkg}.adapter.dto")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "adapter", "dto", "JsonRpcResponse.java"), "axhub-common", f"{biz_pkg}.adapter.dto")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "adapter", "dto", "ErrorDetail.java"), "axhub-common", f"{biz_pkg}.adapter.dto")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "adapter", "dto", "Params.java"), "axhub-common", f"{biz_pkg}.adapter.dto")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "gateway", "dto", "ToolMetadata.java"), "axhub-common", f"{biz_pkg}.gateway.dto")
|
|
||||||
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "gateway", "controller"), "axhub-gateway", f"{biz_pkg}.gateway.controller")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "gateway", "service"), "axhub-gateway", f"{biz_pkg}.gateway.service")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "gateway", "config"), "axhub-gateway", f"{biz_pkg}.gateway.config")
|
|
||||||
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "adapter", "connector"), "axhub-tool-core", f"{biz_pkg}.adapter.connector")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "adapter", "sender"), "axhub-tool-core", f"{biz_pkg}.adapter.sender")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "adapter", "aop"), "axhub-tool-core", f"{biz_pkg}.adapter.aop")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "adapter", "util"), "axhub-tool-core", f"{biz_pkg}.adapter.util")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "adapter", "test"), "axhub-tool-core", f"{biz_pkg}.adapter.test")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "tool", "annotation"), "axhub-tool-core", f"{biz_pkg}.tool.annotation")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "tool", "service", "AbstractMcpToolService.java"), "axhub-tool-core", f"{biz_pkg}.tool.service")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "tool", "controller"), "axhub-tool-core", f"{biz_pkg}.tool.controller")
|
|
||||||
|
|
||||||
move_file_to_module(os.path.join(src_biz, "tool", "service", "SmsSendService.java"), "axhub-tool-sms", f"{biz_pkg}.tool.service")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "tool", "dto", "SmsSendReq.java"), "axhub-tool-sms", f"{biz_pkg}.tool.dto")
|
|
||||||
|
|
||||||
move_file_to_module(os.path.join(src_biz, "tool", "service", "EmailSendService.java"), "axhub-tool-email", f"{biz_pkg}.tool.service")
|
|
||||||
move_file_to_module(os.path.join(src_biz, "tool", "dto", "EmailSendReq.java"), "axhub-tool-email", f"{biz_pkg}.tool.dto")
|
|
||||||
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "tool", "service"), "axhub-tool-other", f"{biz_pkg}.tool.service")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "tool", "dto"), "axhub-tool-other", f"{biz_pkg}.tool.dto")
|
|
||||||
move_dir_to_module(os.path.join(src_biz, "tool", "util"), "axhub-tool-other", f"{biz_pkg}.tool.util")
|
|
||||||
|
|
||||||
move_file_to_module(os.path.join(src_base, "AxHubAdminApplication.java"), "axhub-gateway", base_pkg)
|
|
||||||
|
|
||||||
print("Migration complete.")
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import urllib.request
|
|
||||||
import urllib.parse
|
|
||||||
import json
|
|
||||||
|
|
||||||
tools = [
|
|
||||||
{
|
|
||||||
"toolName": "grade",
|
|
||||||
"description": "고객등급 조회",
|
|
||||||
"podUrl": "http://tool-other:8084",
|
|
||||||
"domainGroup": "biz_support",
|
|
||||||
"integrationType": "TCP",
|
|
||||||
"mciServiceId": "CRM_001",
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"reqId": { "type": "string" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"actionPrompts": {
|
|
||||||
"grade": "이 고객의 VIP 등급을 조회해줘."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"toolName": "detail",
|
|
||||||
"description": "고객상세 정보 조회",
|
|
||||||
"podUrl": "http://tool-other:8084",
|
|
||||||
"domainGroup": "biz_support",
|
|
||||||
"integrationType": "TCP",
|
|
||||||
"mciServiceId": "CRM_002",
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"reqId": { "type": "string" }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"actionPrompts": {
|
|
||||||
"detail": "이 고객의 상세 기본정보(주소, 연락처 등)를 알려줘."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
url = 'http://localhost:8081/mcp/api/v1/registry/register'
|
|
||||||
headers = {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-API-KEY': 'SHINHAN_MCP_TEST_KEY_9999'
|
|
||||||
}
|
|
||||||
|
|
||||||
for tool in tools:
|
|
||||||
data = json.dumps(tool).encode('utf-8')
|
|
||||||
req = urllib.request.Request(url, data=data, headers=headers, method='POST')
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(req) as response:
|
|
||||||
print(f"Registered {tool['toolName']}: {response.read().decode('utf-8')}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error registering {tool['toolName']}: {e}")
|
|
||||||
27
test_call.py
27
test_call.py
@@ -1,27 +0,0 @@
|
|||||||
import urllib.request
|
|
||||||
import json
|
|
||||||
|
|
||||||
payload = {
|
|
||||||
"jsonrpc": "2.0",
|
|
||||||
"method": "tools/call",
|
|
||||||
"params": {
|
|
||||||
"name": "grade",
|
|
||||||
"arguments": { "cust_id": "C001" }
|
|
||||||
},
|
|
||||||
"id": 1
|
|
||||||
}
|
|
||||||
|
|
||||||
url = 'http://localhost:8081/mcp/api/v1/tools/call'
|
|
||||||
headers = {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-API-KEY': 'SHINHAN_MCP_TEST_KEY_9999'
|
|
||||||
}
|
|
||||||
|
|
||||||
data = json.dumps(payload).encode('utf-8')
|
|
||||||
req = urllib.request.Request(url, data=data, headers=headers, method='POST')
|
|
||||||
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(req) as response:
|
|
||||||
print(f"Response: {response.read().decode('utf-8')}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error: {e}")
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
import urllib.request
|
|
||||||
import json
|
|
||||||
|
|
||||||
payload = {
|
|
||||||
"jsonrpc": "2.0",
|
|
||||||
"method": "tools/call",
|
|
||||||
"params": {
|
|
||||||
"name": "detail",
|
|
||||||
"arguments": { "cust_id": "C001" }
|
|
||||||
},
|
|
||||||
"id": 1
|
|
||||||
}
|
|
||||||
|
|
||||||
url = 'http://localhost:8081/mcp/api/v1/tools/call'
|
|
||||||
headers = {
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
'X-API-KEY': 'SHINHAN_MCP_TEST_KEY_9999'
|
|
||||||
}
|
|
||||||
|
|
||||||
data = json.dumps(payload).encode('utf-8')
|
|
||||||
req = urllib.request.Request(url, data=data, headers=headers, method='POST')
|
|
||||||
|
|
||||||
try:
|
|
||||||
with urllib.request.urlopen(req) as response:
|
|
||||||
print(f"Response: {response.read().decode('utf-8')}")
|
|
||||||
except Exception as e:
|
|
||||||
print(f"Error: {e}")
|
|
||||||
Reference in New Issue
Block a user