Skip to main content
Glama
jim-agent

NEAR DeFi Dashboard

by jim-agent

MCP Server: NEAR DeFi Dashboard

An MCP (Model Context Protocol) server that provides Claude with real-time NEAR DeFi data, enabling intelligent yield recommendations, portfolio analysis, and swap routing.

Features

  • DeFi Yields: Real-time APY data from Ref Finance, Burrow, Meta Pool, and Linear Protocol

  • Staking Comparison: Compare native staking vs liquid staking vs DeFi yields

  • Swap Routing: Find optimal token swap routes on Ref Finance

  • Lending Rates: Current supply/borrow rates on Burrow

  • IL Calculator: Impermanent loss calculator for LP positions

Related MCP server: MoltLlama

Installation

npm install @near-mcp/defi-dashboard

Or run directly:

npx @near-mcp/defi-dashboard

Claude Desktop Configuration

Add to your Claude Desktop config:

{
  "mcpServers": {
    "near-defi": {
      "command": "npx",
      "args": ["@near-mcp/defi-dashboard"]
    }
  }
}

Available Tools

1. get_defi_yields

Get current APY across all major NEAR DeFi protocols.

Example Conversation:

User: What are the best yields on NEAR right now?
Claude: [uses get_defi_yields] 

Here are the top yields on NEAR DeFi:

1. Ref Finance NEAR-USDC LP: 25% APY ($2.5M TVL) - Medium risk
2. Meta Pool stNEAR: 9.5% APY ($15M TVL) - Low risk
3. Linear LiNEAR: 9.2% APY ($12M TVL) - Low risk
4. Burrow Supply USDT: 5.2% APY - Low risk

Input:

{
  "min_apy": 5,
  "max_risk": "medium",
  "type": "all"
}

2. compare_staking_options

Compare different ways to earn yield on NEAR.

Example Conversation:

User: I have 1000 NEAR, what should I do with it?
Claude: [uses compare_staking_options with amount="1000"]

Here's a comparison for your 1000 NEAR over 1 year:

| Option | APY | Return | Risk |
|--------|-----|--------|------|
| Native Staking | 9.8% | 98 NEAR | Low |
| stNEAR | 9.5% | 95 NEAR | Low |
| LP (NEAR-USDC) | 25% | 250 NEAR | Medium |

Recommendation: For 1000+ NEAR, consider splitting: 50% native, 30% liquid, 20% DeFi.

3. find_best_swap_route

Find optimal swap routes on Ref Finance.

Example:

{
  "from_token": "wrap.near",
  "to_token": "usdt.tether-token.near",
  "amount": "100"
}

Output:

{
  "route": "wrap.near → usdt.tether-token.near",
  "expected_output": "450.123456",
  "price_impact": "0.10%",
  "fees": "0.3%"
}

4. get_lending_rates

Get Burrow lending protocol rates.

Example Conversation:

User: What are the lending rates on Burrow?
Claude: [uses get_lending_rates]

Current Burrow rates:
- NEAR: 3.5% supply / 8.2% borrow (45% utilized)
- USDT: 5.2% supply / 12.1% borrow (62% utilized)
- USDC: 4.8% supply / 11.5% borrow (58% utilized)

5. calculate_impermanent_loss

Calculate IL for LP positions.

Example:

{
  "token_a": "NEAR",
  "token_b": "USDC",
  "price_change_pct": 50,
  "initial_value_usd": 1000
}

Output:

{
  "impermanent_loss": "2.02%",
  "value_if_held": "$750.00",
  "value_as_lp": "$734.85",
  "loss_vs_holding": "$15.15"
}

Data Sources

  • Ref Finance: DEX pools, liquidity, swap rates

  • Burrow: Lending/borrowing rates

  • Meta Pool: stNEAR staking stats

  • Linear Protocol: LiNEAR staking stats

Caching

Data is cached for 5 minutes to avoid rate limiting. The cache automatically refreshes on expiry.

Development

npm install
npm run build
npm start

License

MIT

Available Tools

5 tools
calculate_impermanent_lossA

Calculate impermanent loss for liquidity provider positions

ParametersJSON Schema
NameRequiredDescriptionDefault
token_aYesFirst token in LP pair
token_bYesSecond token in LP pair
price_change_pctYesPercentage price change of token_a relative to token_b (e.g., 50 for 50% increase)
initial_value_usdNoInitial position value in USD (optional)

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, so the description must carry the full burden of behavioral disclosure. 'Calculate' implies a non-mutating operation, but the description does not state output format, assumptions, limitations, or whether it returns a percentage, dollar amount, or both.

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 concise, front-loaded sentence with no redundant or filler content. Every word contributes to identifying the tool's purpose.

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 description plus fully documented schema is adequate for basic invocation, but the lack of any output schema or annotation coverage leaves ambiguity about the return value and any calculation assumptions. More context about what the result represents would improve completeness.

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 description coverage is 100%, so the baseline is 3. The description adds no parameter-level meaning beyond what the schema already provides, but the schema is sufficiently self-documenting.

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 states a specific verb ('Calculate'), a clear resource ('impermanent loss'), and scopes it to 'liquidity provider positions.' This is distinct from the sibling tools, which cover yields, staking, swaps, and lending rates.

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 phrase 'for liquidity provider positions' implies when the tool is relevant, but it does not explicitly explain when to choose this tool over alternatives, state exclusions, or provide context such as pool types or required market conditions.

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

compare_staking_optionsB

Compare native staking vs liquid staking (stNEAR, LiNEAR) vs DeFi yields for a given NEAR amount

ParametersJSON Schema
NameRequiredDescriptionDefault
amountYesAmount of NEAR to stake/invest
time_horizonNoInvestment time horizon (default: 1year)

TDQS

B3.3/5.0
Behavior2/5

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

There are no annotations, so the description must carry the full burden of behavioral disclosure. It only says 'compare,' which does not reveal whether the tool uses live market data, applies assumptions, computes projected returns, or has side effects. Important behavioral details are absent for a tool that likely aggregates external yield information.

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, tightly worded sentence with no filler. It front-loads the core comparison action and includes concrete examples, making it efficient and easy to parse.

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?

With no output schema and no annotations, the description should clarify what the comparison returns or how results are presented. It adequately covers inputs and comparison targets, but leaves return format, data sources, and assumptions unstated, which is a notable gap for a comparison tool.

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 description coverage is 100%, so the schema already documents 'amount' and 'time_horizon' with their meaning and enum values. The description adds little beyond contextualizing the amount as NEAR for staking/investment, which is already present in the schema.

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

Purpose4/5

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

The description clearly states a specific verb ('Compare') and resource (staking vs liquid staking vs DeFi yields) for a given amount, naming examples like stNEAR and LiNEAR. It is distinct enough from siblings like get_defi_yields because it emphasizes a comparison across categories, though it does not explicitly name sibling alternatives.

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 the tool is for comparing staking and yield options, and the 'given NEAR amount' hint provides some context. However, it does not explicitly state when to use this tool versus get_defi_yields or get_lending_rates, nor does it mention any exclusions.

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

find_best_swap_routeA

Find the optimal swap route on Ref Finance for token exchange

ParametersJSON Schema
NameRequiredDescriptionDefault
amountYesAmount to swap (in token decimals)
to_tokenYesToken to swap to
from_tokenYesToken to swap from (e.g., "wrap.near", "usdt.tether-token.near")

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. The verb 'find' suggests a read-only route lookup rather than an execution, which is helpful, but the description does not disclose whether the tool executes swaps, what data it queries, or what 'optimal' is based on. These gaps matter without annotations to clarify safety behavior.

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 concise sentence with no filler. It front-loads the core action ('Find the optimal swap route') and adds the platform and purpose, making it easy to parse quickly.

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?

For a simple three-parameter tool, the description is enough to understand the basic operation and invoke it. However, there is no output schema and no mention of the return shape, route structure, or meaning of 'optimal,' so an agent may still be uncertain about what the tool actually 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 description coverage is 100%, so the schema already documents the three required parameters adequately. The tool description adds no additional parameter-level detail, such as amount formatting or token address conventions, so it provides no value beyond the schema.

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

Purpose4/5

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

The description uses a specific verb ('find') and resource ('optimal swap route on Ref Finance') with a clear purpose ('token exchange'). It is easily distinguished from the sibling tools, which focus on yields, staking, lending, and impermanent loss. However, it does not define what 'optimal' means, so the precision is slightly limited.

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 intended use is implied by 'for token exchange' — the tool should be used when an agent needs a swap route on Ref Finance. It does not explicitly state when not to use it or name alternative tools, leaving some room for interpretation.

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

get_defi_yieldsA

Get current APY/APR yields across all major NEAR DeFi protocols (Ref Finance, Burrow, Meta Pool, Linear)

ParametersJSON Schema
NameRequiredDescriptionDefault
typeNoType of yield to fetch (default: all)
min_apyNoMinimum APY to filter results (default: 0)
max_riskNoMaximum risk level to include

TDQS

A3.6/5.0
Behavior3/5

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

No annotations are provided, so the description carries the behavioral disclosure burden. 'Get current APy/APR yields' clearly indicates a read-only data fetch with no state changes, and naming the major protocols sets scope. It does not discuss data freshness, caching, sorting, or response structure, which would add context, but it does not mislead about side effects.

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 focused sentcence with the core action and resource front-loaded, followed by concrete protocol examples in parentheses. Every word earns its place and there is no redundant or filler content.

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

Completeness4/5

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

For a simple read-only yield-lookup tool with zero required parameters and fully documented optional filters, the description plus schema is largely sufficient. It lacks explicit sibling differentiation and an output-shape note, but the phrase 'current APy/APR yields' conveys the kind of data returned well enough for this complexity.

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 description coverage is 100%, and the schema already documents all three optional parameters, their enums, and defaults. The description adds protocol-level context but no extra meaning about type, min_apy, or max_risk beyond what the schema provides, so the baseline of 3 is appropriate.

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

Purpose4/5

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

The description uses a specific verb ('Get') and names the resource ('current APY/APR yields') across major NEAR DeFi protocols, clearly identifying a broad yield-lookup operation. It distinguishes from swap and impermanent-loss tools, though it does not explicitly separate itself from the similar get_lending_rates sibling.

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 the tool is for a broad current-yield snapshot across multiple protocols, and the schema's optional filters refine that use case. It gives no explicit when-to-use or when-not-to-use guidance, and never mentions alternatives like get_lending_rates or compare_staking_options, so routing among siblings is left to inference.

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

get_lending_ratesA

Get current borrow and supply rates on Burrow lending protocol

ParametersJSON Schema
NameRequiredDescriptionDefault
assetNoSpecific asset to query (optional, returns all if not specified)

TDQS

A3.6/5.0
Behavior3/5

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

No annotations are provided, so the description carries the behavioral disclosure burden. 'Get current' implies a read-only retrieval with no side effects, but the description does not explicitly confirm read-only behavior, authentication needs, or whether rates are live vs. cached. This is a modest gap for a getter tool.

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, front-loaded sentence with no filler. Every word contributes meaning, specifying both what is retrieved and the protocol context.

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

Completeness4/5

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

For a tool with one optional, fully documented parameter and a simple read operation, the description plus schema is sufficient for correct invocation. The absence of an output schema means return format is unknown, but the description does not need to enumerate return values; overall it is complete for the tool's simplicity.

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?

The input schema has 100% description coverage, with the asset parameter clearly explained as optional and returning all assets if not specified. The tool description itself adds no parameter-level detail, but the schema already handles this, so the baseline of 3 applies.

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

Purpose4/5

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

The description uses a clear verb ('Get') and identifies a specific resource ('current borrow and supply rates on Burrow lending protocol'). It is distinguishable from sibling tools by naming Burrow and the specific rate types, though it does not explicitly contrast with get_defi_yields.

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?

Usage context is implied: use this when you need current Burrow borrow or supply rates. However, it does not explicitly state when not to use it or mention alternatives like get_defi_yields for broader DeFi yield comparisons.

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.

  1. 5 tool updatesv1.0.0
    • First observedcalculate_impermanent_loss
    • First observedcompare_staking_options
    • First observedfind_best_swap_route
    • First observedget_defi_yields
    • First observedget_lending_rates

TDQS

A3.6/5.0

Scored across 5 tools

Disambiguation4/5

Each tool targets a distinct DeFi operation (yields, staking comparison, swaps, lending rates, IL). However, get_defi_yields and get_lending_rates both return yield-type information, which could cause minor confusion.

Naming Consistency4/5

The naming follows a consistent get_/compare_/find_/calculate_ verb pattern, mostly noun_phrases with clear intent. The slight mix of 'get' vs 'compare/find/calculate' is minor and still predictable.

Tool Count5/5

5 tools is well-scoped for a NEAR DeFi dashboard covering yields, staking, swaps, lending, and LP risk. No redundant tools and the count feels right for the purpose.

Completeness3/5

The tools cover key DeFi decision-making areas, but lack obvious operations like portfolio tracking, historical yields, or transaction execution. Some overlap exists between yields and lending rates, but the core dashboard needs are mostly addressed.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers