We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dwsy/magic-api-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
---
title: "自定义模块"
date: "2022-01-30T11:09:02.000Z"
permalink: "/pages/senior/module/"
---
# 编写java代码
import org.ssssssss.script.annotation.Comment;
@Component //注入到Spring容器中
@MagicModule("test") // 模块名称
public class TestFunctions {
/**
* 调用打印方法
*/
@Comment("方法名的注释(用于提示)")
public void println(@Comment("参数名的提示(用于提示)")String value) {
System.out.println(value);
}
}
# 脚本中使用
import test; //导入模块
test.println('Custom Module!');
# 全局导入模块 (application.yaml)
# org.ssssssss.magicapi.spring.boot.starter.MagicAPIProperties#autoImportModule
# 覆盖默认配置时候别忘了加上db (如果不需要可忽略)
magic-api:
auto-import-module: db,test
# 使用全局模块
test.println('Custom Module!');