Fibrous MCP Server

Fibrous MCP Server

Provides tools for multi-chain DeFi operations using the Fibrous SDK, enabling AI agents to find swap routes, build transactions, and execute swaps across Base, Starknet, and Scroll networks.

Category
访问服务器

README

Fibrous MCP Server

Node.js TypeScript License Fibrous SDK Test Coverage

MCP server providing AI agents with tools for multi-chain DeFi operations using the Fibrous SDK.

Features

10 Available Tools:

  • get-supported-tokens - List available tokens
  • get-supported-protocols - List DEX protocols
  • get-best-route - Find optimal swap routes
  • get-best-route-batch - Find optimal routes for batch swaps (Starknet only)
  • build-transaction - Generate transaction data
  • build-batch-transaction - Generate batch transaction data (Starknet only)
  • format-token-amount - Convert between human and wei formats
  • get-token - Fetch token details by address
  • execute-swap - Execute token swaps (requires wallet config)
  • estimate-swap - Estimate gas costs (requires wallet config)

Supported Networks:

  • Base - Uniswap V3, Aerodrome, SwapBased
  • Starknet - JediSwap, MySwap, 10kSwap, Ekubo
  • Scroll - Uniswap V3, SyncSwap, iZiSwap

Quick Start

# Install dependencies
pnpm install

# Configure environment
cp .env.example .env
# Edit .env with your RPC URLs and private keys

# Build the project
pnpm build

# Start server
pnpm start

Configuration

Environment Variables

Core Configuration:

NODE_ENV=development
DEFAULT_SLIPPAGE=1.0

Network Configuration:

# Base Network
BASE_RPC_URL=https://mainnet.base.org
BASE_PRIVATE_KEY=0x...

# Starknet Network
STARKNET_RPC_URL=https://starknet-mainnet.public.blastapi.io
STARKNET_PRIVATE_KEY=0x...
STARKNET_PUBLIC_KEY=0x...

# Scroll Network
SCROLL_RPC_URL=https://rpc.scroll.io
SCROLL_PRIVATE_KEY=0x...

Optional Settings:

# Debug configuration
DEBUG=false
LOG_LEVEL=info
ENABLE_METRICS=false

# API optimization
FIBROUS_API_KEY=your_api_key_here

MCP Client Setup

Add to your MCP client configuration:

{
	"mcpServers": {
		"fibrous-mcp": {
			"command": "node",
			"args": ["/path/to/fibrous-mcp/build/src/index.js"]
		}
	}
}

Development

Prerequisites

  • Node.js 18+
  • pnpm (recommended)
  • TypeScript 5.0+

Setup

# Clone repository
git clone <repository-url>
cd fibrous-mcp

# Install dependencies
pnpm install

# Start development server
pnpm dev

# Watch mode with auto-reload
pnpm dev:watch

Code Quality

# Type checking
pnpm typecheck

# Linting
pnpm lint
pnpm lint:fix

# Code formatting
pnpm format
pnpm format:check

Testing

Comprehensive test suite with 82.6% coverage across all modules:

# Run all tests
pnpm test

# Watch mode for development
pnpm test:watch

# Coverage report
pnpm test:coverage

# CI mode
pnpm test:ci

Test Results:

  • 167/167 tests passing
  • 10 test suites, ~3.1s execution
  • Native BigInt with router-sdk v0.6.0

Test Coverage by Module

  • API endpoints: 17 tests
  • Server configuration: 14 tests
  • Tool handlers: 14 tests
  • Utilities: 122 tests (BigInt operations, configuration, responses, swap logic, validation)

Coverage Details

  • Statements: 82.56%
  • Branches: 73.46%
  • Functions: 75.71%
  • Lines: 83.18%

Technical Details

Native BigInt Integration

  • Router SDK v0.6.0: Latest Fibrous SDK compatibility
  • 50KB smaller bundle: Removed BigNumber.js dependency
  • Faster calculations: Native JavaScript bigint operations
  • Modern standards: ES2022+ features
// Example: Native BigInt usage
const amount = BigInt("1000000000000000000"); // 1 ETH
const route = await router.getBestRoute(amount, tokenIn, tokenOut, "base");

Architecture

  • MCP Protocol: Model Context Protocol compliance
  • Type Safety: Full TypeScript implementation
  • Error Handling: Comprehensive error management
  • Security: Environment variable validation and masking

Production Deployment

Environment Setup

# Production build
pnpm build:clean

# Production start
NODE_ENV=production pnpm start:prod

Security Considerations

  • Store private keys securely (use secrets management)
  • Configure appropriate RPC endpoints
  • Set up monitoring and logging
  • Use HTTPS for all external connections

Performance

  • Native BigInt: 2-3x faster than BigNumber.js
  • Bundle Size: 50KB reduction vs v0.5.x
  • Memory Usage: Optimized for long-running processes
  • Rate Limiting: 200 req/min (configurable)

Resources

API Endpoints:

  • https://api.fibrous.finance (200 req/min)
  • https://graph.fibrous.finance

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass: pnpm test
  6. Submit a pull request

Development Guidelines

  • Follow TypeScript best practices
  • Maintain test coverage above 75%
  • Use conventional commit messages
  • Update documentation for new features

License

MIT - see LICENSE


Risk Warning: DeFi operations involve financial risk. Always verify transactions and use testnet for development.

Status: Production ready with comprehensive test coverage and native BigInt support.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选