Skip to main content
Glama
Faouzi122

Arsenal Decision Engine

Arsenal Decision Engine ๐Ÿ›ก๏ธ

The Risk-Validation Layer for Autonomous AI Agents (DeFAI)

Arsenal-Quant-Project MCP server

Method and raw results are published โ€” backtest script ยท result data (180 days of Binance ETH/USDC daily closes): ๐Ÿ”ฌ Breakeven Corridor is a deterministic algebraic boundary (where IL = accumulated yield). Any position whose price ratio stays within [lower_be, upper_be] has R_net > 0 by mathematical definition โ€” not a probabilistic model. ๐Ÿ“ This engine measures; it does not forecast. No predictive-accuracy figure is claimed โ€” read the published result files and judge the method for yourself.


Mission

Transform DeFi uncertainty into deterministic, actionable risk metrics for autonomous agents. We do not run stateful trading bots or generate speculative prediction signals; we provide a stateless risk middleware layer that agents query before deploying or maintaining standard constant-product / full-range LP positions.

Built for agents. 100 free calls per IP per day โ€” no wallet, no sign-up, custom parameters included. An L402 payment path is implemented in the gateway but is not operational in production: today, the engine is free to use.


Related MCP server: riskstate-mcp

What This Engine Does

Before an autonomous agent deploys capital or adjusts a standard constant-product / full-range LP position (such as Uniswap V2 or full-range V3), it submits the pool parameters (APY, price ratio, days held) to our API. The engine computes the exact mathematical risk, the net return ($R_{net}$), and the dynamic Breakeven Corridor bounds.

  • No LLMs. No hallucinations. Pure algebraic calculation.

  • Complexity: $\mathcal{O}(1)$ time and memory.

  • Latency: $< 15\text{ms}$ local execution.

Two ways to call it

1. MCP JSON-RPC โ€” the endpoint advertised on the MCP registry

POST https://api.arsenal-quant.com/mcp
{"jsonrpc":"2.0","id":1,"method":"tools/call",
 "params":{"name":"evaluate_pool",
           "arguments":{"apy":0.20,"price_ratio":0.85,"days_held":30}}}

Standard MCP handshake: initialize โ†’ tools/list โ†’ tools/call. Available over streamable HTTP and stdio.

2. REST convenience route โ€” no MCP client required

GET https://api.arsenal-quant.com/mcp/evaluate?apy=0.20&price_ratio=0.85&days_held=30

Both routes run the same calculation and the same quota. Note that /mcp/evaluate is GET-only: a POST to that path returns 405 Allow: GET, because JSON-RPC belongs on /mcp.

Engine Response (JSON Contract)

{
  "impermanent_loss_pct": 0.3292,
  "accumulated_yield_pct": 1.6438,
  "r_net_pct": 1.3146,
  "il_to_yield_ratio": 0.2,
  "risk_level": "LOW",
  "breakeven_corridor": {
    "lower_ratio": 0.6941,
    "upper_ratio": 1.4407,
    "interpretation": "Position remains profitable if price ratio stays within [0.6941, 1.4407]"
  },
  "inputs": {
    "apy": 0.2,
    "price_ratio": 0.85,
    "days_held": 30
  },
  "source": "Arsenal Decision Engine v2.0",
  "oracle_signature": "<HMAC-SHA256 hex โ€” illustrative placeholder, yours will differ>",
  "layer": "FREE"
}

layer reports how the call was served: FREE while inside the free quota, PREMIUM once an L402 payment has been verified. The call shown above is served as FREE.


Access and Pricing

  • Free tier โ€” evaluate_pool: 100 calls per IP per day, custom parameters included. No Lightning wallet is needed. This is the only tier currently in service.

  • Beyond the free quota: the gateway implements the L402 challenge and returns 402 with a WWW-Authenticate header. The payment rail is not operational in production โ€” invoices issued today are not settleable, and no payment is expected or accepted. Treat the paid tier as announced, not available.

  • GET /mcp/audit/latest: 3 free calls per IP per hour; beyond that the route returns 402. That response documents the protocol; it is not a live payment path.


Python Integration Example

import urllib.request
import urllib.error
import json
import re
import os

API_URL = "https://api.arsenal-quant.com/mcp/evaluate?apy=0.20&price_ratio=0.85&days_held=30"
LNBITS_URL = "https://demo.lnbits.com"

# LNbits requires a wallet key with send permission to pay an invoice.
# Use a DEDICATED wallet funded with a small working balance, and never the key
# of a wallet holding significant funds. Keep it in the environment, never in code.
LNBITS_PAYMENT_KEY = os.getenv("LNBITS_PAYMENT_KEY")

def query_risk_oracle():
    req = urllib.request.Request(API_URL, method="GET")
    req.add_header("x-agent-id", "autonomous-lp-bot")

    try:
        with urllib.request.urlopen(req) as resp:
            return json.loads(resp.read().decode('utf-8'))
    except urllib.error.HTTPError as e:
        if e.code == 402:
            auth_header = e.headers.get("WWW-Authenticate")
            macaroon = re.search(r'token="([^"]+)"', auth_header).group(1)
            invoice = re.search(r'invoice="([^"]+)"', auth_header).group(1)

            pay_req = urllib.request.Request(
                f"{LNBITS_URL}/api/v1/payments",
                data=json.dumps({"out": True, "bolt11": invoice}).encode(),
                headers={"X-Api-Key": LNBITS_PAYMENT_KEY, "Content-Type": "application/json"}
            )
            with urllib.request.urlopen(pay_req) as pay_resp:
                preimage = json.loads(pay_resp.read().decode())["preimage"]

            retry_req = urllib.request.Request(API_URL, method="GET")
            retry_req.add_header("Authorization", f"L402 {macaroon}:{preimage}")
            retry_req.add_header("x-agent-id", "autonomous-lp-bot")

            with urllib.request.urlopen(retry_req) as final_resp:
                return json.loads(final_resp.read().decode('utf-8'))
        else:
            raise

if __name__ == "__main__":
    evaluation = query_risk_oracle()
    print(f"Risk Level     : {evaluation['risk_level']}")
    print(f"R_net          : {evaluation['r_net_pct']:+.4f}%")
    print(f"Breakeven      : [{evaluation['breakeven_corridor']['lower_ratio']}, {evaluation['breakeven_corridor']['upper_ratio']}]")

Developer Integration

  • Integration cookbook & MCP guides: COOKBOOK.md

  • MCP auto-discovery card: https://api.arsenal-quant.com/.well-known/mcp/server-card.json

Why per-call pricing is the intended model

This engine does not prevent losses, and it makes no claim about how much money it saves you. What it does is compute โ€” deterministically, in $\mathcal{O}(1)$ โ€” whether a position sits above or below its breakeven boundary. Each response carries an HMAC tag over the result, which lets the engine detect tampering with its own output; it is a symmetric provenance marker, not a proof a third party can verify independently.

The intended model is per-call pricing, so the cost can be budgeted like any other input. That model is not yet in service: today every call is free.

Available Tools

2 tools
evaluate_poolAInspect

Evaluate LP position risk and calculate R_net & breakeven corridor.

ParametersJSON Schema
NameRequiredDescriptionDefault
apyYesAnnual Percentage Yield of the pool (e.g. 0.20 for 20%)
days_heldNoNumber of days the position has been held (default: 30)
price_ratioYesCurrent price ratio compared to entry price (e.g. 0.85 for 15% price drop)

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It does not mention whether the tool is read-only, has side effects, requires specific permissions, or how it handles inputs. The description only states the high-level function, leaving the agent without essential operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that captures the tool's purpose without any redundancy or filler. It is well-structured and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema and no annotations. The description mentions R_net and breakeven corridor but does not define these terms or indicate the output format, leaving potential gaps for an agent to understand what the tool returns.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, with each parameter having a clear description and example. The tool description adds no additional meaning about how parameters are used in the calculation, maintaining the baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool evaluates LP position risk and calculates R_net and breakeven corridor, providing a specific verb and resource. It distinguishes itself from the sibling tool get_latest_audit, which focuses on audits.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for evaluating LP risk, but it provides no explicit guidance on when to use this tool versus alternatives or any exclusions. The context is implied but not overtly stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_latest_auditAInspect

Fetch the latest cost-intelligence and risk mitigation audit signal.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so the description must fully disclose behavior. It only says 'fetch', implying a read operation, but lacks details on authorization, rate limits, or what happens if no audit exists. Insufficient for a tool that may have side effects or constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no redundancy. Every word is essential and the purpose is front-loaded. Highly concise.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description should elaborate on what the returned audit signal contains. It names the content area (cost-intelligence and risk mitigation) but lacks detail on structure or format, leaving the agent with incomplete context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is 100% by default. The baseline for 0 parameters is 4, and the description correctly avoids adding unnecessary parameter details.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clear verb 'fetch' followed by a specific resource: 'the latest cost-intelligence and risk mitigation audit signal'. No sibling tools to distinguish from, so it effectively communicates the tool's purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool, prerequisites, or any context. While there are no sibling tools, the description does not help the agent decide when to invoke it beyond the bare purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.5
    • Addedevaluate_pool
  2. 4 tool updatesv0.1.3
    • Removedcache_manager
    • Removedcircuit_breaker
    • Addedget_latest_audit
    • Removedprotect_capital_from_mev
  3. 3 tool updatesv0.1.1
    • Changedcache_manager2 fields changed
      • addedInput schema / additionalProperties
        Added value: +false
      • addedInput schema / properties / action / description
        Added value: +"ENABLE_SEMANTIC_CACHE activates the cache with a 5-minute TTL. DISABLE_SEMANTIC_CACHE flushes all cached entries and resumes live computation."
    • Changedcircuit_breaker4 fields changed
      • addedInput schema / additionalProperties
        Added value: +false
      • addedInput schema / properties / action / description
        Added value: +"The action to take. TERMINATE_AND_REGROUP kills the process immediately and logs the termination event. MONITOR observes the process without intervention and returns current resource usage statistics."
      • addedInput schema / properties / target_pid / description
        Added value: +"The process identifier (PID) of the agent to target. Obtain this from your process manager or orchestrator. Example: '12345' or 'agent-worker-3'."
      • addedInput schema / properties / target_pid / examples
        Added value: +[
        +  "12345",
        +  "agent-worker-3"
        +]
    • Changedprotect_capital_from_mev7 fields changed
      • addedInput schema / additionalProperties
        Added value: +false
      • changedInput schema / properties / attacker_weth_in / description
        Previous value: -"Estimated flash-loan or capital size of the MEV searcher."New value: +"Estimated capital size of the MEV searcher (front-runner). This is the flash-loan or own-capital the attacker would use to sandwich your swap. If unknown, use 2x to 5x the victim_weth_in as a conservative estimate. Example: If victim_weth_in=10.5, a conservative attacker_weth_in would be 52.5 (5x). Typical range: 1 to 5000 WETH."
      • addedInput schema / properties / attacker_weth_in / examples
        Added value: +[
        +  25,
        +  52.5,
        +  100,
        +  500
        +]
      • addedInput schema / properties / attacker_weth_in / minimum
        Added value: +0.001
      • changedInput schema / properties / victim_weth_in / description
        Previous value: -"Amount of WETH the victim intends to swap."New value: +"Amount of WETH the victim (your agent) intends to swap on Uniswap V2. Must be a positive number representing the exact ETH value. Example: 10.5 means 10.5 WETH (~$26,250 at $2,500/ETH). Typical range: 0.01 to 1000 WETH."
      • addedInput schema / properties / victim_weth_in / examples
        Added value: +[
        +  0.5,
        +  2,
        +  10.5,
        +  50
        +]
      • addedInput schema / properties / victim_weth_in / minimum
        Added value: +0.001
  4. 3 tool updatesv0.1.0
    • First observedcache_manager
    • First observedcircuit_breaker
    • First observedprotect_capital_from_mev

TDQS

B3.4/5.0
Disambiguation5/5

Only one tool exists, so there is no possibility of confusion between tools.

Naming Consistency5/5

With a single tool, naming follows a clear verb_noun pattern (get_latest_audit) and is inherently consistent.

Tool Count1/5

The server name 'Arsenal Decision Engine' suggests a broad set of capabilities, but only one trivial tool is provided, making the count highly inappropriate.

Completeness1/5

The tool surface is limited to a single fetch operation, leaving out any other actions (e.g., list, analyze, update) that would be expected from a decision engine.

Maintenance

ActivityActive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Deterministic risk governance for crypto trading agents. 5-level policy engine with position sizing, leverage limits, and trade blocking. One tool: get_risk_policy. Supports BTC and ETH.
    1
    19
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Evaluates on-chain risk for Pharos agents before executing transactions, providing verdicts (safe/caution/dangerous) and risk-bounded execution plans via Foundry cast reads.
    MIT No Attribution
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to analyze Ethereum wallets, simulate transactions, and draft transfers with deterministic policy and risk scoring, requiring human approval before on-chain execution.
    2
    ISC

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Faouzi122/Arsenal-Quant-Project'

If you have feedback or need assistance with the MCP directory API, please join our Discord server