near-liquid-staking

near-liquid-staking

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

Category
Visit Server

README

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

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured