OEIS API服务

为在线整数序列百科全书(OEIS)提供的API服务器,支持通过ID、术语或名称搜索序列。

  • by daedalus
  • Python
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 daedalus/mcp-oeis

使用说明

mcp oeis

用于OEIS(整数序列在线百科全书)API的MCP服务器

mcp名称:io.github.daedalus/mcp-oeis

安装

pip install mcp-oeis

用法

作为MCP服务器

在MCP设置中配置:

{
  "mcpServers": {
    "mcp-oeis": {
      "command": "mcp-oeis"
    }
  }
}

Python API

from mcp_oeis import mcp

# Get a sequence by ID
result = mcp.get_sequence_by_id("A000109")
print(result["terms"])  # [1, 1, 1, 2, 5, 14, ...]

# Search by terms
results = mcp.search_by_terms([1, 1, 2, 3, 5, 8])
print(results[0]["name"])  # "Fibonacci numbers"

# Search by name
results = mcp.search_by_name("prime")
print(results[0]["id"])  # "A000040"

MCP工具

get_sequence_by_id

通过其OEIS ID获取序列(例如,“A000109”表示单多面体,“A000045”表示斐波那契)。

搜索_ _术语

通过提供整数项搜索OEIS序列。例如,搜索[1,1,2,3,5,8]将找到斐波那契数列。

search_by_name

按名称或关键字搜索OEIS序列。例如,搜索“Fibonacci”将找到与Fibonacci相关的序列。

发展

git clone https://github.com/daedalus/mcp-oeis.git
cd mcp-oeis
pip install -e ".[test]"

# run tests
pytest

# format
ruff format src/ tests/

# lint
ruff check src/ tests/

# type check
mypy src/