Skip to main content
Glama
jim-agent

near-liquid-staking

by jim-agent

MCP NEAR Liquid Staking Server

A Model Context Protocol (MCP) server for interacting with liquid staking protocols on NEAR blockchain. Supports Meta Pool (stNEAR) and Linear Protocol (LiNEAR).

Features

  • stake_near - Stake NEAR tokens to receive liquid staking tokens (stNEAR or LiNEAR)

  • unstake - Request unstaking of liquid tokens (starts the unbonding period)

  • withdraw - Withdraw NEAR after the unstaking period completes

  • get_staking_info - Query a user's staking position, balances, and pending withdrawals

  • get_pool_stats - Get pool statistics including APY, TVL, exchange rate, and fees

  • list_validators - List validators used by each staking pool

Related MCP server: NEAR Liquid Staking

Supported Protocols

Protocol

Contract

Token

Typical APY

Meta Pool

meta-pool.near

stNEAR

~9-10%

Linear

linear-protocol.near

LiNEAR

~10%

Installation

npm install
npm run build

Usage

As MCP Server

Start the server:

npm start
# or
node dist/index.js

The server communicates over stdio using the MCP protocol.

MCP Configuration

Add to your MCP client configuration:

{
  "mcpServers": {
    "near-liquid-staking": {
      "command": "node",
      "args": ["/path/to/mcp-near-liquid-staking/dist/index.js"]
    }
  }
}

Tools

stake_near

Stake NEAR tokens on Meta Pool or Linear.

{
  "protocol": "meta-pool",
  "amount": "100",
  "accountId": "your-account.near"
}

Returns transaction data ready for signing. Estimated liquid tokens to receive are calculated based on current exchange rate.

unstake

Request unstaking. Initiates the unbonding period (~48 hours / 4 epochs).

{
  "protocol": "linear",
  "amount": "50",
  "accountId": "your-account.near"
}

withdraw

Withdraw NEAR after the unstaking period completes.

{
  "protocol": "meta-pool",
  "accountId": "your-account.near"
}

get_staking_info

Get user's complete staking position.

{
  "protocol": "meta-pool",
  "accountId": "your-account.near"
}

Response includes:

  • stakedBalance - Total NEAR equivalent staked

  • liquidTokenBalance - stNEAR/LiNEAR balance

  • pendingWithdrawal - Amount in unbonding

  • withdrawableBalance - Ready to withdraw

  • epochsUntilWithdrawable - Epochs remaining until withdrawal

get_pool_stats

Get pool statistics and current rates.

{
  "protocol": "linear"
}

Response includes:

  • totalStaked - Total NEAR staked in pool

  • exchangeRate - Current NEAR per liquid token rate

  • apy - Annual percentage yield

  • tvlNear - Total value locked

  • fee - Protocol fee percentage

  • validatorCount - Number of validators

list_validators

List validators used by the staking pool.

{
  "protocol": "meta-pool"
}

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Run tests
npm test

# Build
npm run build

Testing

npm test

Tests cover:

  • Pool stats retrieval for both protocols

  • Staking info queries

  • Stake/unstake/withdraw transaction preparation

  • Validator listing

  • Edge cases (small/large amounts)

Architecture

src/
├── index.ts         # MCP server entry point with tool handlers
└── near-client.ts   # NEAR RPC client for staking operations

The server uses:

  • @modelcontextprotocol/sdk - MCP server implementation

  • near-api-js - NEAR blockchain interaction

  • zod - Input validation

Notes

  • Transaction Signing: This server prepares transaction data but does not sign transactions. The consuming application must handle wallet integration and signing.

  • RPC Endpoints: Uses public NEAR RPC endpoints. For production, consider using a dedicated RPC provider.

  • Exchange Rates: Liquid token amounts are calculated based on current exchange rates which may vary slightly at execution time.

License

MIT

Available Tools

6 tools
get_pool_statsA

Get pool statistics including APY, TVL, total staked, and fees

ParametersJSON Schema
NameRequiredDescriptionDefault
protocolYesProtocol to query

TDQS

A4/5.0
Behavior4/5

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

Without annotations, the description carries the full burden. It transparently discloses the specific data points returned (APY, TVL, total staked, fees), making the tool's behavior predictable. Though it does not explicitly state that it is read-only or mention rate limits, 'Get' strongly implies no side effects and the metric list is sufficient for this simple getter.

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 sentence with no filler, directly stating the action and key return metrics. It is front-loaded and every word contributes value.

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 one-parameter tool with a well-documented schema and no output schema, the description covers the core purpose and return data. It could explicitly differentiate from get_staking_info, but the distinction is largely implied by 'pool statistics' vs. personal staking info, making the description complete enough 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 schema already fully documents the single parameter 'protocol' with an enum and description 'Protocol to query'. The description adds no parameter-specific details, so it remains at the baseline expected for high schema coverage.

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 uses the specific verb 'Get' and identifies the resource 'pool statistics' with concrete metrics (APY, TVL, total staked, fees). This clearly distinguishes it from sibling staking actions like stake_near/unstake and from get_staking_info, which likely covers personal staking details.

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 does not provide explicit when-to-use or comparison with alternatives. It implies usage for retrieving protocol-level pool metrics, but doesn't mention when to choose this over get_staking_info, so usage guidance is only implicit.

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

get_staking_infoA

Get user's staking position including staked amount, rewards, and pending withdrawals

ParametersJSON Schema
NameRequiredDescriptionDefault
protocolYesProtocol to query
accountIdYesNEAR account ID to check

TDQS

A3.8/5.0
Behavior3/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 disclosing behavior. It indicates the output content (staked amount, rewards, pending withdrawals), which implies a read-only operation, but it does not explicitly mention safety, permissions, or potential errors. This is adequate but lacks depth.

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 that immediately conveys the tool's purpose. It contains no extraneous text and efficiently lists the key return items. Excellent conciseness and structure.

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?

Given the simplicity of the tool, the description covers its purpose and the main return values (staked amount, rewards, pending withdrawals). While there is no output schema, the description provides enough context for an agent to understand what to expect. It could mention edge cases, but overall it is fairly complete.

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 already provides clear descriptions for both parameters (protocol enum, accountId). The tool description does not add additional meaning to the parameters themselves, so the schema is sufficient. Baseline of 3 is appropriate since schema coverage is 100%.

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 gets the user's staking position, listing the specific data points (staked amount, rewards, pending withdrawals). This verb-resource pairing is precise and distinguishes it from sibling tools like stake_near, unstake, and withdraw, which perform actions rather than queries.

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 this tool is for checking staking status, as opposed to performing staking actions, but it does not explicitly state when to use it or when to prefer a sibling like get_pool_stats. There is no mention of exclusions or alternatives, so the guidance is only implicit.

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

list_validatorsB

List validators used by the staking pool

ParametersJSON Schema
NameRequiredDescriptionDefault
protocolYesProtocol to query validators for

TDQS

B3.1/5.0
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. It states 'List validators' but does not explicitly indicate read-only behavior, response format, or any side effects. The description adds minimal context beyond the tool name.

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 redundancy. It communicates the core purpose efficiently.

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 is simple with one parameter and no output schema, so the description is reasonably complete for listing validators. However, it lacks explicit read-only indication or any note about what the returned list contains, which would be expected given the absence of annotations.

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 parameter 'protocol' has a clear description and enum. The tool description adds no extra meaning beyond the schema, so baseline 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 clearly states the tool lists validators used by the staking pool, with a specific verb and resource. It is distinguishable from siblings like stake_near and unstake, but overlaps somewhat with get_staking_info and get_pool_stats without explicitly differentiating the exact scope (e.g., protocol-specific).

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 is provided on when to use this tool versus alternatives. The description does not mention the protocol parameter or distinguish it from sibling info-gathering tools like get_staking_info or get_pool_stats.

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

stake_nearA

Stake NEAR tokens on Meta Pool or Linear to receive liquid staking tokens (stNEAR or LiNEAR)

ParametersJSON Schema
NameRequiredDescriptionDefault
amountYesAmount of NEAR to stake (in NEAR units)
protocolYesLiquid staking protocol to use
accountIdYesNEAR account ID

TDQS

A3.9/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It discloses the immediate outcome (receiving liquid staking tokens) but omits important behavioral details like token transfer, fees, confirmation requirements, or reversibility. This is a thin description for a transactional 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, efficient sentence that delivers the core purpose without wasted words. It front-loads the action and outcome immediately.

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 is simple with fully documented parameters and no output schema. The description covers the essential action and outcome, but lacks context about prerequisites (e.g., funded account), side effects, or return value. It is minimally viable but not rich.

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?

Schema covers all parameters (100% coverage). The description adds semantic value by linking 'meta-pool' to stNEAR and 'linear' to LiNEAR, which clarifies the protocol enum. It also reinforces that amount is in NEAR units, beyond a bare schema listing.

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 a specific action ('Stake NEAR tokens') with resource context (Meta Pool or Linear) and outcome (receiving stNEAR or LiNEAR). It effectively distinguishes from sibling tools like unstake and withdraw.

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

Usage Guidelines4/5

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

The description implies usage context: when you want to stake NEAR to earn liquid staking tokens. Sibling tool names (unstake, withdraw) make the alternative scenarios obvious, though no explicit 'use when not' guidance is given.

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

unstakeA

Request unstaking of liquid staking tokens. Initiates the unstaking process which has a waiting period.

ParametersJSON Schema
NameRequiredDescriptionDefault
amountYesAmount to unstake (in stNEAR/LiNEAR units)
protocolYesProtocol to unstake from
accountIdYesNEAR account ID

TDQS

A3.9/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 of behavioral disclosure. It discloses the waiting period, which is a key consequence, but does not mention that this is a blockchain transaction, its reversibility, or the effect on staked balances. Some disclosure is present but gaps remain.

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 two concise sentences: the first states the action, the second adds the essential waiting-period consequence. There is no redundancy or unnecessary detail.

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 state-changing staking operation with no output schema, the description covers the core action and waiting period, but lacks information about the transaction result, the follow-up withdraw step, or prerequisites. This leaves some context gaps for an agent.

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 already describes all three parameters (amount, protocol, accountId) with 100% coverage. The description adds no parameter-specific meaning, so it meets the baseline but does not enhance understanding beyond the schema.

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's function: requesting unstaking of liquid staking tokens. It distinguishes itself from staking (stake_near) and withdrawal (withdraw) by explicitly noting it initiates a process with a waiting period, making the purpose unambiguous.

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

Usage Guidelines4/5

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

The description provides clear context that this is the initial unstaking step ('Initiates the unstaking process'), which implies use before withdraw. However, it does not explicitly name alternatives or provide exclusion criteria, so it falls short of a full 5.

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

withdrawA

Withdraw NEAR after the unstaking period is complete

ParametersJSON Schema
NameRequiredDescriptionDefault
protocolYesProtocol to withdraw from
accountIdYesNEAR account ID

TDQS

A3.6/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It only states the action and timing, without disclosing side effects, prerequisites beyond timing, or failure modes, which is a significant gap for a mutating financial operation.

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

Conciseness4/5

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

The description is a single sentence with an action verb and no wasted words, effectively front-loaded with the 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 is minimal and does not explain return values or prerequisites beyond timing (e.g., that the user must have unstaked previously). With no output schema, more context could be expected for a withdrawal 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% for both parameters, and the tool description adds no additional parameter context. The baseline score of 3 is appropriate since parameters are fully described in the schema.

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?

Description uses a specific verb 'Withdraw' with a clear resource 'NEAR' and a context condition ('after the unstaking period is complete'), which clearly distinguishes it from sibling tools like stake_near and unstake.

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

Usage Guidelines4/5

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

The description provides clear context on when to use the tool ('after the unstaking period is complete') but does not explicitly name alternatives or when not to use it, so it lacks full exclusionary guidance.

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

TDQS

A3.9/5.0
Disambiguation5/5

Each tool addresses a distinct action or query: staking, initiating unstake, withdrawing, viewing user info, viewing pool stats, and listing validators. No two tools overlap in purpose.

Naming Consistency4/5

Most tools follow a verb_noun pattern (stake_near, get_staking_info, get_pool_stats, list_validators). Two are single verbs (unstake, withdraw) but remain clear and consistent with the action-oriented style.

Tool Count5/5

Six tools cover the essential liquid staking workflow without redundancy or bloat, fitting well within the expected 3-15 range.

Completeness5/5

The set covers the full staking lifecycle (stake, unstake, withdraw) plus necessary informational queries (user staking info, pool stats, validators). No critical gaps for the domain.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

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/jim-agent/mcp-near-liquid-staking'

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