Labsco
ahmetenesdur logo

Fibrous MCP Server

β˜… 1

from ahmetenesdur

A server for Fibrous Finance, a DeFi aggregation platform.

πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeNeeds API keys

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

Development

Prerequisites

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

Setup

Copy & paste β€” that's it
# 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

Copy & paste β€” that's it
# 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:

Copy & paste β€” that's it
# 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
Copy & paste β€” that's it
// 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

Resources

API Endpoints:

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.