@wumx-labs/noxaeapi-mcp 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +240 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1905,8 +1905,230 @@ function registerLeaderboardTools(server) {
|
|
|
1905
1905
|
);
|
|
1906
1906
|
}
|
|
1907
1907
|
|
|
1908
|
-
// src/tools/
|
|
1908
|
+
// src/tools/rankforge.ts
|
|
1909
1909
|
import { z as z10 } from "zod";
|
|
1910
|
+
async function resolveUuid5(client, playerOrUuid) {
|
|
1911
|
+
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(playerOrUuid)) {
|
|
1912
|
+
return playerOrUuid;
|
|
1913
|
+
}
|
|
1914
|
+
try {
|
|
1915
|
+
const res = await client.players.resolve(playerOrUuid);
|
|
1916
|
+
return res.uuid;
|
|
1917
|
+
} catch {
|
|
1918
|
+
return playerOrUuid;
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
function registerRankForgeTools(server) {
|
|
1922
|
+
server.tool(
|
|
1923
|
+
"rankforge_get_player_stats",
|
|
1924
|
+
"Get full RankForge PvP stats for a player: points, current tier, next tier, kills, deaths, K/D ratio, and daily kills. Accepts UUID or player name.",
|
|
1925
|
+
{
|
|
1926
|
+
player: z10.string().describe("Player UUID or player name"),
|
|
1927
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
1928
|
+
},
|
|
1929
|
+
async ({ player, nodeId }) => {
|
|
1930
|
+
const session = getSession();
|
|
1931
|
+
try {
|
|
1932
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
1933
|
+
const uuid = await resolveUuid5(client, player);
|
|
1934
|
+
const stats = await client.rankforge.getPlayerStats(uuid);
|
|
1935
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
1936
|
+
` : "";
|
|
1937
|
+
return {
|
|
1938
|
+
content: [{ type: "text", text: prefix + JSON.stringify(stats, null, 2) }]
|
|
1939
|
+
};
|
|
1940
|
+
} catch (err) {
|
|
1941
|
+
return {
|
|
1942
|
+
isError: true,
|
|
1943
|
+
content: [{ type: "text", text: `Failed to get RankForge stats for '${player}': ${err instanceof Error ? err.message : String(err)}` }]
|
|
1944
|
+
};
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
);
|
|
1948
|
+
server.tool(
|
|
1949
|
+
"rankforge_get_points",
|
|
1950
|
+
"Get current RankForge points for a player. Accepts UUID or player name.",
|
|
1951
|
+
{
|
|
1952
|
+
player: z10.string().describe("Player UUID or player name"),
|
|
1953
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
1954
|
+
},
|
|
1955
|
+
async ({ player, nodeId }) => {
|
|
1956
|
+
const session = getSession();
|
|
1957
|
+
try {
|
|
1958
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
1959
|
+
const uuid = await resolveUuid5(client, player);
|
|
1960
|
+
const result = await client.rankforge.getPoints(uuid);
|
|
1961
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
1962
|
+
` : "";
|
|
1963
|
+
return {
|
|
1964
|
+
content: [{ type: "text", text: prefix + JSON.stringify(result, null, 2) }]
|
|
1965
|
+
};
|
|
1966
|
+
} catch (err) {
|
|
1967
|
+
return {
|
|
1968
|
+
isError: true,
|
|
1969
|
+
content: [{ type: "text", text: `Failed to get points for '${player}': ${err instanceof Error ? err.message : String(err)}` }]
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
);
|
|
1974
|
+
server.tool(
|
|
1975
|
+
"rankforge_set_points",
|
|
1976
|
+
"Set RankForge points for a player to an exact amount. This will override their current points. Accepts UUID or player name.",
|
|
1977
|
+
{
|
|
1978
|
+
player: z10.string().describe("Player UUID or player name"),
|
|
1979
|
+
amount: z10.number().describe("Exact points value to set"),
|
|
1980
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
1981
|
+
},
|
|
1982
|
+
async ({ player, amount, nodeId }) => {
|
|
1983
|
+
const session = getSession();
|
|
1984
|
+
try {
|
|
1985
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
1986
|
+
const uuid = await resolveUuid5(client, player);
|
|
1987
|
+
const result = await client.rankforge.setPoints(uuid, amount);
|
|
1988
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
1989
|
+
` : "";
|
|
1990
|
+
return {
|
|
1991
|
+
content: [{ type: "text", text: prefix + JSON.stringify(result, null, 2) }]
|
|
1992
|
+
};
|
|
1993
|
+
} catch (err) {
|
|
1994
|
+
return {
|
|
1995
|
+
isError: true,
|
|
1996
|
+
content: [{ type: "text", text: `Failed to set points for '${player}': ${err instanceof Error ? err.message : String(err)}` }]
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
);
|
|
2001
|
+
server.tool(
|
|
2002
|
+
"rankforge_add_points",
|
|
2003
|
+
"Add RankForge points to a player. Accepts UUID or player name.",
|
|
2004
|
+
{
|
|
2005
|
+
player: z10.string().describe("Player UUID or player name"),
|
|
2006
|
+
amount: z10.number().describe("Number of points to add"),
|
|
2007
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
2008
|
+
},
|
|
2009
|
+
async ({ player, amount, nodeId }) => {
|
|
2010
|
+
const session = getSession();
|
|
2011
|
+
try {
|
|
2012
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
2013
|
+
const uuid = await resolveUuid5(client, player);
|
|
2014
|
+
const result = await client.rankforge.addPoints(uuid, amount);
|
|
2015
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
2016
|
+
` : "";
|
|
2017
|
+
return {
|
|
2018
|
+
content: [{ type: "text", text: prefix + JSON.stringify(result, null, 2) }]
|
|
2019
|
+
};
|
|
2020
|
+
} catch (err) {
|
|
2021
|
+
return {
|
|
2022
|
+
isError: true,
|
|
2023
|
+
content: [{ type: "text", text: `Failed to add points for '${player}': ${err instanceof Error ? err.message : String(err)}` }]
|
|
2024
|
+
};
|
|
2025
|
+
}
|
|
2026
|
+
}
|
|
2027
|
+
);
|
|
2028
|
+
server.tool(
|
|
2029
|
+
"rankforge_remove_points",
|
|
2030
|
+
"Remove (deduct) RankForge points from a player. Accepts UUID or player name.",
|
|
2031
|
+
{
|
|
2032
|
+
player: z10.string().describe("Player UUID or player name"),
|
|
2033
|
+
amount: z10.number().describe("Number of points to remove"),
|
|
2034
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
2035
|
+
},
|
|
2036
|
+
async ({ player, amount, nodeId }) => {
|
|
2037
|
+
const session = getSession();
|
|
2038
|
+
try {
|
|
2039
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
2040
|
+
const uuid = await resolveUuid5(client, player);
|
|
2041
|
+
const result = await client.rankforge.removePoints(uuid, amount);
|
|
2042
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
2043
|
+
` : "";
|
|
2044
|
+
return {
|
|
2045
|
+
content: [{ type: "text", text: prefix + JSON.stringify(result, null, 2) }]
|
|
2046
|
+
};
|
|
2047
|
+
} catch (err) {
|
|
2048
|
+
return {
|
|
2049
|
+
isError: true,
|
|
2050
|
+
content: [{ type: "text", text: `Failed to remove points for '${player}': ${err instanceof Error ? err.message : String(err)}` }]
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
);
|
|
2055
|
+
server.tool(
|
|
2056
|
+
"rankforge_list_tiers",
|
|
2057
|
+
"List all registered PvP tiers from RankForge (name, minPoints, maxPoints, etc.).",
|
|
2058
|
+
{
|
|
2059
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
2060
|
+
},
|
|
2061
|
+
async ({ nodeId }) => {
|
|
2062
|
+
const session = getSession();
|
|
2063
|
+
try {
|
|
2064
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
2065
|
+
const tiers = await client.rankforge.getTiers();
|
|
2066
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
2067
|
+
` : "";
|
|
2068
|
+
return {
|
|
2069
|
+
content: [{ type: "text", text: prefix + JSON.stringify(tiers, null, 2) }]
|
|
2070
|
+
};
|
|
2071
|
+
} catch (err) {
|
|
2072
|
+
return {
|
|
2073
|
+
isError: true,
|
|
2074
|
+
content: [{ type: "text", text: `Failed to list RankForge tiers: ${err instanceof Error ? err.message : String(err)}` }]
|
|
2075
|
+
};
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
);
|
|
2079
|
+
server.tool(
|
|
2080
|
+
"rankforge_get_top",
|
|
2081
|
+
"Get the top players ranked by RankForge points (PvP leaderboard). Returns rank, UUID, name, points, and tier.",
|
|
2082
|
+
{
|
|
2083
|
+
limit: z10.number().optional().describe("Number of top players to return (default 10, max 100)"),
|
|
2084
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
2085
|
+
},
|
|
2086
|
+
async ({ limit = 10, nodeId }) => {
|
|
2087
|
+
const session = getSession();
|
|
2088
|
+
try {
|
|
2089
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
2090
|
+
const top = await client.rankforge.getTop(limit);
|
|
2091
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
2092
|
+
` : "";
|
|
2093
|
+
return {
|
|
2094
|
+
content: [{ type: "text", text: prefix + JSON.stringify(top, null, 2) }]
|
|
2095
|
+
};
|
|
2096
|
+
} catch (err) {
|
|
2097
|
+
return {
|
|
2098
|
+
isError: true,
|
|
2099
|
+
content: [{ type: "text", text: `Failed to get RankForge top: ${err instanceof Error ? err.message : String(err)}` }]
|
|
2100
|
+
};
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
);
|
|
2104
|
+
server.tool(
|
|
2105
|
+
"rankforge_save",
|
|
2106
|
+
"Trigger an async save of all RankForge player data to disk/database.",
|
|
2107
|
+
{
|
|
2108
|
+
nodeId: z10.string().optional().describe("Target server node ID when connected via Velocity hub")
|
|
2109
|
+
},
|
|
2110
|
+
async ({ nodeId }) => {
|
|
2111
|
+
const session = getSession();
|
|
2112
|
+
try {
|
|
2113
|
+
const { client, effectiveNodeId } = await session.resolveTargetClient(nodeId);
|
|
2114
|
+
const result = await client.rankforge.save();
|
|
2115
|
+
const prefix = effectiveNodeId ? `[Target Node: @${effectiveNodeId}]
|
|
2116
|
+
` : "";
|
|
2117
|
+
return {
|
|
2118
|
+
content: [{ type: "text", text: prefix + JSON.stringify(result, null, 2) }]
|
|
2119
|
+
};
|
|
2120
|
+
} catch (err) {
|
|
2121
|
+
return {
|
|
2122
|
+
isError: true,
|
|
2123
|
+
content: [{ type: "text", text: `Failed to trigger RankForge save: ${err instanceof Error ? err.message : String(err)}` }]
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
);
|
|
2128
|
+
}
|
|
2129
|
+
|
|
2130
|
+
// src/tools/auto-register.ts
|
|
2131
|
+
import { z as z11 } from "zod";
|
|
1910
2132
|
var SKIP_MODULES = /* @__PURE__ */ new Set(["http", "connect"]);
|
|
1911
2133
|
function registerAllSdkModules(server, registeredNames) {
|
|
1912
2134
|
const session = getSession();
|
|
@@ -1934,8 +2156,8 @@ function registerAllSdkModules(server, registeredNames) {
|
|
|
1934
2156
|
toolName,
|
|
1935
2157
|
`NoxAeApi ${modName}.${action}() action. Supports standalone server or Velocity node targeting via nodeId.`,
|
|
1936
2158
|
{
|
|
1937
|
-
args:
|
|
1938
|
-
nodeId:
|
|
2159
|
+
args: z11.array(z11.unknown()).optional().describe(`Arguments array for ${modName}.${action}()`),
|
|
2160
|
+
nodeId: z11.string().optional().describe("Target server node ID (e.g. 'survival', 'lobby') when connected via Velocity hub")
|
|
1939
2161
|
},
|
|
1940
2162
|
async ({ args = [], nodeId }) => {
|
|
1941
2163
|
const currentSession = getSession();
|
|
@@ -2001,8 +2223,8 @@ async function main() {
|
|
|
2001
2223
|
);
|
|
2002
2224
|
}
|
|
2003
2225
|
const server = new McpServer({
|
|
2004
|
-
name: "noxaeapi-mcp",
|
|
2005
|
-
version: "1.0.0"
|
|
2226
|
+
name: true ? "@wumx-labs/noxaeapi-mcp" : "noxaeapi-mcp",
|
|
2227
|
+
version: true ? "1.0.2" : "1.0.1"
|
|
2006
2228
|
});
|
|
2007
2229
|
const registeredNames = /* @__PURE__ */ new Set();
|
|
2008
2230
|
const track = (names) => names.forEach((n) => registeredNames.add(n));
|
|
@@ -2062,6 +2284,17 @@ async function main() {
|
|
|
2062
2284
|
"leaderboards_list",
|
|
2063
2285
|
"leaderboards_get_top"
|
|
2064
2286
|
]);
|
|
2287
|
+
registerRankForgeTools(server);
|
|
2288
|
+
track([
|
|
2289
|
+
"rankforge_get_player_stats",
|
|
2290
|
+
"rankforge_get_points",
|
|
2291
|
+
"rankforge_set_points",
|
|
2292
|
+
"rankforge_add_points",
|
|
2293
|
+
"rankforge_remove_points",
|
|
2294
|
+
"rankforge_list_tiers",
|
|
2295
|
+
"rankforge_get_top",
|
|
2296
|
+
"rankforge_save"
|
|
2297
|
+
]);
|
|
2065
2298
|
registerWorldTools(server);
|
|
2066
2299
|
track([
|
|
2067
2300
|
"worlds_list",
|
|
@@ -2106,6 +2339,8 @@ Follow these operational guidelines to make accurate, reliable decisions:
|
|
|
2106
2339
|
3. LEADERBOARD DECISION TREE:
|
|
2107
2340
|
- For gameplay rankings (kills, deaths, playtime, mcmmo, auraskills): use 'leaderboards_get_top' with IDs like 'player:kills', 'player:deaths', 'player:playtime'.
|
|
2108
2341
|
- Use 'leaderboards_list' to discover valid game stats (it automatically filters internal noise).
|
|
2342
|
+
- For RankForge PvP tier/points rankings: use 'rankforge_get_top' or the generic 'leaderboards_get_top' with id 'rankforge:points' or 'rankforge:kills'.
|
|
2343
|
+
- To inspect or modify a specific player's RankForge points: use 'rankforge_get_player_stats', 'rankforge_set_points', 'rankforge_add_points', 'rankforge_remove_points'.
|
|
2109
2344
|
|
|
2110
2345
|
4. PERFORMANCE & DIAGNOSTICS:
|
|
2111
2346
|
- For lag or TPS inquiries: call 'server_get_status'. TPS: 20.0 is perfect, <18.0 is lagging.
|
package/package.json
CHANGED