@noelclaw/mcp 2.2.0 → 2.2.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/llm.js CHANGED
@@ -3,11 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callLLM = callLLM;
4
4
  const ANTHROPIC_URL = "https://api.anthropic.com/v1/messages";
5
5
  const BANKR_URL = "https://llm.bankr.bot/v1/chat/completions";
6
+ const CONVEX_SITE = process.env.NOELCLAW_CONVEX_URL ?? "https://api.noelclaw.com";
6
7
  /**
7
8
  * Call the best available LLM.
8
- * Priority: ANTHROPIC_API_KEY → BANKR_API_KEY → throws
9
- * Claude Desktop automatically injects ANTHROPIC_API_KEY, so users
10
- * pay for their own AI usage without the server owner absorbing the cost.
9
+ * Priority: ANTHROPIC_API_KEY → BANKR_API_KEY → Convex backend (owner pays)
11
10
  */
12
11
  async function callLLM(systemPrompt, userPrompt, maxTokens = 1024, history = [], timeoutMs = 60000) {
13
12
  const anthropicKey = process.env.ANTHROPIC_API_KEY;
@@ -16,8 +15,25 @@ async function callLLM(systemPrompt, userPrompt, maxTokens = 1024, history = [],
16
15
  return callAnthropic(anthropicKey, systemPrompt, userPrompt, maxTokens, history, timeoutMs);
17
16
  if (bankrKey)
18
17
  return callBankr(bankrKey, systemPrompt, userPrompt, maxTokens, history, timeoutMs);
19
- throw new Error("No LLM API key available. Claude Desktop users: make sure ANTHROPIC_API_KEY is in your MCP config. " +
20
- "Standalone users: set BANKR_API_KEY.");
18
+ // Fallback: route through Convex backend owner covers cost
19
+ return callViaConvex(systemPrompt, userPrompt, history, timeoutMs);
20
+ }
21
+ async function callViaConvex(systemPrompt, userPrompt, history, timeoutMs) {
22
+ const fullQuestion = systemPrompt
23
+ ? `[System: ${systemPrompt}]\n\n${userPrompt}`
24
+ : userPrompt;
25
+ const res = await fetch(`${CONVEX_SITE}/mcp/chat`, {
26
+ method: "POST",
27
+ headers: { "Content-Type": "application/json" },
28
+ body: JSON.stringify({ question: fullQuestion, messages: history }),
29
+ signal: AbortSignal.timeout(timeoutMs),
30
+ });
31
+ if (!res.ok) {
32
+ const body = await res.text().catch(() => "");
33
+ throw new Error(`LLM error ${res.status}: ${body.slice(0, 200)}`);
34
+ }
35
+ const data = await res.json();
36
+ return data.answer ?? "";
21
37
  }
22
38
  async function callAnthropic(apiKey, systemPrompt, userPrompt, maxTokens, history, timeoutMs) {
23
39
  const messages = [...history, { role: "user", content: userPrompt }];
@@ -7,7 +7,7 @@ const MOONWELL_API = "https://api.moonwell.fi/v1/markets";
7
7
  exports.BASE_TOOLS = [
8
8
  {
9
9
  name: "base_query_vaults",
10
- description: "List Morpho yield vaults on Base sorted by APY. Shows vault name, asset, current APY, and total deposits. Use this to find the best yield opportunities on Base.",
10
+ description: "Find the best yield/earning opportunities on Base chain using Morpho vaults. Use this when the user asks about yield farming, APY, best rates to earn, where to put USDC, or passive income on Base.",
11
11
  inputSchema: {
12
12
  type: "object",
13
13
  properties: {
@@ -25,7 +25,7 @@ exports.BASE_TOOLS = [
25
25
  },
26
26
  {
27
27
  name: "base_list_markets",
28
- description: "List Moonwell lending/borrowing markets on Base. Shows supply APY, borrow APY, total liquidity, and utilization rate for each asset.",
28
+ description: "Get lending and borrowing rates on Base chain via Moonwell. Use this when the user asks about borrow rates, lending rates, interest rates, supply APY, or how much they can earn/pay lending on Base.",
29
29
  inputSchema: {
30
30
  type: "object",
31
31
  properties: {
@@ -61,7 +61,7 @@ exports.BASE_TOOLS = [
61
61
  },
62
62
  {
63
63
  name: "base_chain_stats",
64
- description: "Get real-time Base chain stats: ETH price, gas price in gwei, and latest block info.",
64
+ description: "Get real-time Base chain stats: current ETH price in USD, gas price in gwei, and latest block number. Use this when the user asks about gas fees, ETH price, Base network status, or current block.",
65
65
  inputSchema: {
66
66
  type: "object",
67
67
  properties: {},
@@ -8,7 +8,7 @@ const llm_js_1 = require("../llm.js");
8
8
  exports.INSIGHT_TOOLS = [
9
9
  {
10
10
  name: "ask_noel",
11
- description: "Ask Noel AI for DeFi analysis, trade ideas, market outlook, and crypto research. Noel has live market context.",
11
+ description: "Ask Noel AI for opinions, analysis, trade ideas, and market outlook. Use this for subjective questions like 'is now a good time to buy', 'what do you think about ETH', 'give me your analysis'. Do NOT use for factual data like gas price or live prices — use base_chain_stats or get_market_data for those.",
12
12
  inputSchema: {
13
13
  type: "object",
14
14
  properties: {
@@ -8,8 +8,8 @@ const CONVEX_SITE = process.env.NOELCLAW_CONVEX_URL ?? "https://api.noelclaw.com
8
8
  exports.MIROSHARK_TOOLS = [
9
9
  {
10
10
  name: "miroshark_simulate",
11
- description: "Run a MiroShark multi-agent simulation. Describe any scenario in plain English market crashes, policy changes, social events and get back a running simulation with AI agents acting as market participants, analysts, and social actors. " +
12
- "Handles the full setup automatically (knowledge graph, agent profiles). Returns a simulation_id to poll with miroshark_status.",
11
+ description: "Simulate any scenario using MiroShark multi-agent AI. Use this when the user asks to simulate, model, or explore 'what happens if' market crashes, regulations, social events, macro changes. " +
12
+ "AI agents act as traders, analysts, journalists, and social actors. Returns a simulation_id to track progress.",
13
13
  inputSchema: {
14
14
  type: "object",
15
15
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noelclaw/mcp",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Noelclaw as an MCP skill — persistent memory, multi-agent coordination, scenario simulation, DeFi execution, and Sentinel-gated playbooks.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {