LODA API MCP Server

LODA API MCP Server

Enables exploration and computation of mathematical integer sequences from OEIS using the LODA assembly language. Supports sequence discovery, program execution, algorithmic mining, and real-time computation of mathematical sequences.

Category
访问服务器

README

LODA MCP Server

A Model Context Protocol (MCP) server for the LODA Language API, providing seamless access to the LODA language and integer sequences from the On-Line Encyclopedia of Integer Sequences® (OEIS®).

🌟 Overview

LODA (Lexicographical Order Descent Assembly) is an assembly language and computational model for integer sequences. This MCP server enables you to:

  • 🔍 Explore integer sequences with rich metadata and formatting
  • 🔧 Discover LODA programs that compute specific sequences
  • Execute programs in real-time and compute sequence terms
  • 📊 Monitor project statistics

✨ Features

Core Capabilities

  • OEIS-style Sequence Integration: Access any sequence with A-number formatting
  • Program Discovery: Find and search LODA programs for sequences
  • Real-time Execution: Run LODA programs and see results instantly
  • Robust Error Handling: Comprehensive validation and error messages

Available Tools

Tool Description Primary Use Case
get_sequence Get details about an integer sequence by ID Research mathematical sequences
search_sequences Search for integer sequences Find sequences by keyword or ID
get_program Get details about a LODA program by ID Analyze program implementations
search_programs Search for LODA programs Find programs by keyword or ID
eval_program Evaluate a LODA program Test and validate program correctness
submit_program Submit a new LODA program Contribute new implementations
get_stats View LODA project statistics Understand project scope and growth
get_submitters List all submitters and their number of programs See top contributors

🚀 Quick Start

Prerequisites

  • Node.js 18.0.0 or higher
  • npm 8.0.0 or higher

Installation

  1. Install dependencies:

    npm install
    
  2. Build the server:

    npm run build
    
  3. Test the installation:

    npm run test-connection  # Test API connectivity
    npm start                # Start the server
    

Development Workflow

# Development with auto-rebuild
npm run dev

# Type checking
npm run type-check

# Clean build
npm run clean && npm run build

⚙️ Configuration

Claude Desktop Integration

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "loda-api": {
      "command": "node",
      "args": ["/absolute/path/to/your/loda-mcp/build/index.js"],
      "env": {
        "LODA_API_BASE_URL": "https://api.loda-lang.org/v2"
      }
    }
  }
}

Environment Variables

Variable Description Default
LODA_API_BASE_URL LODA API endpoint override https://api.loda-lang.org/v2

📖 Usage Examples

🔢 Exploring OEIS Sequences

"Show me details about OEIS sequence 45"
→ Gets Fibonacci sequence (A000045) with full metadata

"What is OEIS sequence 1?"  
→ Gets A000001 (groups of order n) with terms and description

🔧 Working with LODA Programs

"Find all LODA programs for sequence 45"
→ Shows all programs that compute Fibonacci numbers, sorted by length

"Get LODA program 12345"
→ Retrieves specific program with code and metadata

⚡ Running Programs

"Run this LODA program and compute 10 terms:
mov $0,1
lpb $1
  add $0,$1
  sub $1,1
lpe"
→ Executes program and shows computed sequence values

⛏️ Mining New Programs

"Start mining programs for OEIS sequence 142857 with max length 50"
→ Begins mining operation and returns operation ID

"Check status of mining operation 987"  
→ Shows current status and any discovered programs

📊 Project Statistics

"What are the current LODA project statistics?"
→ Shows number of sequences, programs, and contributors

🔧 API Reference

Tool Schemas

All tools use strict JSON schemas with proper validation. Example schemas:

get_sequence

{
  "id": "A000045"
}

search_sequences

{
  "q": "Fibonacci",
  "limit": 5
}

get_program

{
  "id": "A000045"
}

search_programs

{
  "q": "Fibonacci",
  "limit": 5
}

eval_program

{
  "code": "mov $1,10\npow $1,$0\nmov $0,$1\ndiv $0,9",
  "t": 10
}

submit_program

{
  "id": "A000045",
  "code": "mov $2,1\nlpb $0\n  sub $0,2\n  add $2,$1\n  add $1,$2\nlpe\nmul $0,$2\nadd $0,$1"
}

get_stats

{}

get_submitters

{}

Response Format

All responses include:

  • Rich formatting with emojis and visual structure
  • Clear status indicators
  • Contextual information and helpful tips
  • Proper error messages with actionable guidance

🏗️ Architecture

Core Components

LODAMCPServer
├── LODAApiClient       # HTTP client for LODA API
├── Tool Handlers       # Individual tool implementations  
├── Validation Layer    # Input validation and sanitization
└── Error Management    # Comprehensive error handling

Error Handling Strategy

  • Input Validation: Strict parameter checking with clear error messages
  • Network Resilience: Retry logic and connection error handling
  • API Error Translation: Convert HTTP errors to meaningful user messages
  • Graceful Degradation: Partial results when possible

🔍 Troubleshooting

Common Issues

Issue Solution
Server won't start Check Node.js version (18+), verify build completed
API connection failed Test with npm run test-connection, check firewall
Tool not found Verify tool name spelling, check MCP client connection
Invalid parameters Check parameter types match schema exactly
Mining timeout Use shorter max_runtime, check sequence exists

Debug Mode

# Enable verbose logging
DEBUG=* npm start

# Test specific tool
echo '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_stats","arguments":{}},"id":1}' | npm start

Health Checks

# Test API connectivity
npm run test-connection

# Verify tool listing  
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | npm start

🤝 Contributing

Development Setup

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make changes with proper TypeScript types
  4. Test thoroughly: npm run type-check
  5. Submit a pull request

Code Standards

  • TypeScript: Strict mode with full type coverage
  • Error Handling: Always use McpError for user-facing errors
  • Validation: Validate all inputs before API calls
  • Documentation: Clear JSDoc comments for public methods
  • Formatting: Consistent emoji usage and output structure

🔗 Resources

📄 API Endpoints

Based on the official OpenAPI v2 specification:

Endpoint Method Description
/sequences/{id} GET Get integer sequence details
/sequences/search GET Search integer sequences
/programs/{id} GET Get LODA program details
/programs/search GET Search LODA programs
/programs/eval POST Evaluate a LODA program
/programs/{id}/submit POST Submit a new LODA program
/stats/summary GET Get statistics summary
/stats/submitters GET List all submitters

📝 License

Apache 2.0

🙏 Acknowledgments

  • LODA Project Team - For creating this amazing mathematical tool
  • OEIS Contributors - For maintaining the world's most important sequence database
  • MCP Community - For the excellent protocol and SDK
  • Mathematical Community - For continuous sequence discoveries and research

Made with ❤️ for mathematical discovery and algorithmic research

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选