Oeis Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.1.3更新於 Oct 24, 2026

Identify integer sequences by terms, search the OEIS, read formulas, programs, b-files, cross-refs.

已驗證Streamable HTTP可網頁執行知識與記憶資料與分析

概覽

AI 產生的概覽

一個 OEIS 伺服器,讓助理依數列項辨識整數數列、檢索該百科,並讀取公式、程式、b-file 與交互參照。

可以做什麼
依給定的一段連續項辨識包含它的數列,回傳符合的起始索引,每頁最多 10 個候選,依 OEIS 相關度排序。使用 OEIS 本身的查詢語法檢索,包括 keyword:、author:、formula: 等前綴、OR 與排除運算子以及排序方式。依 A 編號取得完整條目:項、偏移、關鍵字、作者、評論、公式、範例、程式、參考文獻、連結與擴充,大型條目支援大綱與分頁。從條目的 b-file 或資料列列出帶索引的項 a(n),以精確十進位字串回傳。列出具外向交互參照及其註記,或列出提及某 A 編號的入向條目。查詢靜態參考表,解讀關鍵字旗標、檢索語法與識別碼慣例。
適用情境
適合處理整數數列的場合:從少量觀測項辨認數列、查閱 OEIS 條目的公式、遞迴式或參考程式,或探索相關數列。也方便在對話中直接核對 OEIS 關鍵字與檢索語法。
執行需求
可使用公開託管的 Streamable HTTP 端點(免安裝、免 API 金鑰),或透過 npx、bunx、Docker 在本機執行;套件需要 Node.js v24+ 或 Bun v1.4.0+。需要連線至 oeis.org 的網路。選用環境變數涵蓋傳輸方式、HTTP 主機/連接埠/路徑、驗證模式、日誌等級、佇列等待與儲存。
安裝前請注意
僅對公開 OEIS 資料做唯讀查詢,不需要憑證或付費。上游請求限制為每 10 秒最多發出一次,未命中快取的呼叫可能等待,或以限流、佇列逾時錯誤失敗。託管實例的所有呼叫端共用同一節奏。OEIS 內容採 CC BY-SA 4.0 授權:需標示該百科,改作內容須以相同授權分享。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Oeis Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.cyanheads%2Foeis-mcp-server/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "oeis": {
      "type": "http",
      "url": "https://oeis.caseyjhand.com/mcp"
    }
  }
}

README

@cyanheads/oeis-mcp-server

Identify integer sequences by terms, search the OEIS, read formulas, programs, b-files, cross-refs via MCP. STDIO or Streamable HTTP.

6 Tools • 1 Resource

Public Hosted Server: https://oeis.caseyjhand.com/mcp


Overview

Integer sequences from the On-Line Encyclopedia of Integer Sequences (OEIS). Identify a sequence from a few observed terms, search with OEIS's own query syntax, read an entry's formulas and programs, page through extended terms from its b-file, and walk its cross-references. Every result links to its oeis.org page. No API key required.

Tools

ToolDescription
oeis_identify_sequenceIdentify sequences that contain a run of consecutive terms, in OEIS relevance order, with the index where the run begins
oeis_search_sequencesSearch with OEIS query syntax: words, quoted phrases, term lists, and prefixes such as keyword: and author:
oeis_get_sequenceFetch one entry by A-number: terms, offset, keywords, formulas, programs, comments, references, links, and cross-references
oeis_get_termsList terms a(n) with their indices from the entry's b-file, or from its data line when it has none
oeis_get_cross_refsList the sequences an entry cross-references, or the entries that mention it
oeis_list_referenceDecode keyword flags, search syntax, and identifier and offset conventions, with no upstream call

Resources

ResourceDescription
oeis://sequence/{aNumber}One entry by A-number as JSON, always whole

The same record is available through oeis_get_sequence for clients that only call tools.

Capability reference

oeis_identify_sequence tool

  • terms: up to 60 consecutive terms separated by commas or spaces (a bracketed list or a trailing ... is accepted), each an integer of at most 200 digits or _ for one unknown term; matchSigns (default false) ignores signs unless set
  • Up to 10 candidates per page, start 0–100 in steps of 10; each row carries the oeis_search_sequences row fields plus matchStartIndex, the n where the run begins in that entry's data line (absent when the run isn't there)
  • No match and "too many results" both return an empty page; the notice says which and how to retry (drop leading terms, divide out a common factor, or add terms). OEIS matches a run only within each entry's data line (at most about 270 characters), never its b-file, and a zero-hit notice says so when every nonzero term has 10 or more digits, five or more terms of 4 or more digits lie within 10% of each other, or the run passes 270 characters

oeis_search_sequences tool

  • query (1–1,000 characters) is sent as written: words, "quoted phrases", term lists, prefixes such as keyword:, author:, name:, formula:, xref:, and id:, | for OR, and a leading - to exclude
  • sort: relevance (default), number, created, or modified; 10 per page, start 0–100 in steps of 10
  • Rows carry name, terms, offset / firstIndex, keywords, author, legacyIds, modified (the last edit, ISO 8601 with offset), and url, in oeis_get_sequence's formats; author and legacyIds are absent where OEIS has none
  • Reports totalCount and effectiveQuery, the query as OEIS parsed it. A query OEIS parses as one run of terms (effectiveQuery reads seq: or signed: and the terms, as for bare numbers separated by commas) is matched within each entry's data line, as in oeis_identify_sequence, and its zero-hit notice names that limit under the same conditions
  • With spaces alone between numbers, OEIS starts a new run at a negative term after the first and does not join fewer than three numbers; when effectiveQuery shows that split, the notice says so and gives the terms joined by commas to search as one run

oeis_get_sequence tool

  • Returns name, terms, offset / firstIndex, keywords, author, legacyIds, referenceCount, revision, created / modified, url, and bFileUrl, plus eight sections: comments, formulas, examples, programs, references, links, crossReferences, extensions
  • When the sections exceed 24,000 characters of serialized JSON, kind: "outline" returns the core fields and a sized sections list; pass sections (e.g. ["formulas", "programs"]) to get the chosen ones
  • A selection past 100,000 bytes comes back in parts cut between whole items; pass each part's nextFromItem as fromItem, with the same sections, for the next. A fromItem naming a section not in sections fails as from_item_not_selected
  • An unknown A-number fails as sequence_not_found; withdrawn (dead), reserved, and recycled entries come back with a notice

oeis_get_terms tool

  • fromIndex (default: the first available index) and limit (default 100; one call returns at most 1,000 terms, so a larger limit is served as 1,000); a slice also stops at about 100,000 bytes or at the end of a 1 MiB part of the b-file, and nextFromIndex continues it
  • source: "bfile" reads the entry's b-file in 1 MiB parts, so a fromIndex past the first 1 MiB costs one or two more paced requests; bFileCut: true means the file goes on past lastAvailableIndex. source: "data" means the entry has no b-file and the terms are its data line
  • Terms come back as { n, value }, value an exact decimal string; an unknown A-number fails as sequence_not_found
  • A b-file line that is not blank, a # comment, or an n a(n) pair is skipped, and the notice says how many; a b-file that holds no pair at all fails as upstream_unparseable and is not cached

oeis_get_cross_refs tool

  • direction: "outgoing" (default) lists the A-numbers named in the entry's cross-reference lines, with the note written beside each and the lines verbatim; "incoming" lists the entries that mention the A-number
  • 10 rows per page, start 0–100 in steps of 10; every row carries url, and resolved rows add the name, terms, offset, keywords, author, legacy IDs, and last edit (modified)
  • If the name lookup for an outgoing page is rate-limited, unavailable, or times out, rows come back resolved: false with a retry notice instead of failing; sequence_not_found applies to outgoing only

oeis_list_reference tool

  • topic: keywords (flags such as nonn, core, tabl, cons), search_syntax (prefixes, operators, wildcards, sort orders, paging), or identifiers (A-numbers, legacy M/N numbers, offsets, b-files)
  • Returns entries (name, description) and notes from static tables

oeis://sequence/{aNumber} resource

  • The full entry as application/json: the record oeis_get_sequence returns with kind: "full", never outlined
  • aNumber takes the same forms as the tools (oeis://sequence/A108 reads A000108); an unknown A-number fails as sequence_not_found

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

OEIS-specific:

  • One paced, cached oeis.org client (see Pacing and caching); searches tell "no results" apart from "too many results" and report the match total
  • Forgiving A-numbers: A000045, a000045, A45, 45, and an oeis.org sequence URL all resolve in every tool; a legacy M/N book number is pointed to oeis_search_sequences
  • Exact terms: every term and b-file value is a decimal string, so values past 2^53 keep every digit
  • Pasted term runs are normalized: brackets, a trailing ..., the Unicode minus sign, and mixed comma and space separators

Agent-friendly output:

  • Paging context on every page (truncated, shown, cap, plus totalCount and effectiveQuery where OEIS reports them) and a notice that says how to narrow or continue
  • Typed failures with recovery hints: sequence_not_found, from_item_not_selected, upstream_unparseable, pacer_shed, and upstream_rate_limited, the rate-limit errors carrying retryAfter when one is known
  • Discriminated outputs (kind, source, per-row resolved), so callers branch on data, not string parsing
  • Every record and row carries its https://oeis.org/A###### URL; contributor-written text renders as code spans and code fences, so a markdown client shows formulas and names exactly as written, and only http and https link URLs are kept

Pacing and caching

oeis.org asks automated clients to wait 10 seconds between requests. The server sends one upstream request at a time and starts each at least 10 seconds after the last, across every tool. Results are cached in memory, so a repeated lookup returns at once and costs oeis.org nothing: records for 24 hours, or until a search result shows a later edit (then revalidated with a conditional request), search pages for 1 hour, and b-file parts for 7 days. An entry's cached "no b-file" answer is dropped as soon as a fetched record lists a b-file.

A call with nothing cached waits its turn in the queue. When the wait would pass OEIS_QUEUE_MAX_WAIT_MS (default 30,000 ms), the call fails with pacer_shed and a retryAfter instead of hanging. If oeis.org answers 429, the server holds every queued call back before trying again, and reports upstream_rate_limited once its retries are spent. The pace is per server process.

Known limitations

  • Anonymous paging is capped upstream at 110 results per query (start ≤ 100); A000045's 6,161 incoming references, for example, are reachable only through their first 110.
  • A query OEIS judges too broad returns no rows ("Too many results"), which is common for a single word (prime) or a two-term run. The server reports it but cannot page it.
  • OEIS searches an unknown prefix as plain words instead of rejecting it; the zero-hit notice names it.
  • Term matching (oeis_identify_sequence, and an oeis_search_sequences query of bare numbers or seq: / signed: terms) searches each entry's data line only, not b-files, and data lines are short: at most 269 characters, signs included, across 105 measured (2026-10-01). A run that starts beyond the data line, or one longer than about 270 characters, is not found.
  • oeis_get_terms reads at most two 1 MiB parts of a b-file past the first per call; an index deeper in comes back with a notice to call again, which continues from the parts already cached. A b-file served without byte ranges or a strong ETag is read only to its first 1 MiB.
  • oeis_get_cross_refs outgoing shares the start ≤ 100 bound, so an entry naming more than 110 distinct A-numbers lists only the first 110; lines still names them all.

Data and licensing

OEIS content is licensed CC BY-SA 4.0 under the OEIS End-User License Agreement. When you reuse it, credit "The On-Line Encyclopedia of Integer Sequences" with a link to https://oeis.org/ or to the sequence page; every record the server returns carries its https://oeis.org/A###### URL for that purpose. ShareAlike applies: adaptations of OEIS content must be shared under the same license.

This server is an independent project and is not affiliated with or endorsed by the OEIS Foundation.

Getting started

Public Hosted Instance

A public instance is available at https://oeis.caseyjhand.com/mcp — no installation required. Point any MCP client at it via Streamable HTTP:

json
{  "mcpServers": {    "oeis-mcp-server": {      "type": "streamable-http",      "url": "https://oeis.caseyjhand.com/mcp"    }  }}

Every caller of the hosted instance shares one oeis.org pace of one request every 10 seconds; cached lookups return at once. For sustained use, run your own instance.

Self-Hosted / Local

Add the following to your MCP client configuration file.

json
{  "mcpServers": {    "oeis-mcp-server": {      "type": "stdio",      "command": "bunx",      "args": ["@cyanheads/oeis-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info"      }    }  }}

Or with npx (no Bun required):

json
{  "mcpServers": {    "oeis-mcp-server": {      "type": "stdio",      "command": "npx",      "args": ["-y", "@cyanheads/oeis-mcp-server@latest"],      "env": {        "MCP_TRANSPORT_TYPE": "stdio",        "MCP_LOG_LEVEL": "info"      }    }  }}

Or with Docker:

json
{  "mcpServers": {    "oeis-mcp-server": {      "type": "stdio",      "command": "docker",      "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/oeis-mcp-server:latest"]    }  }}

For Streamable HTTP, set the transport and start the server:

sh
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http# Server listens at http://localhost:3010/mcp

Prerequisites

  • Bun v1.4.0 or higher (or Node.js v24+).
  • No API key or account: the server reads public oeis.org data.

Installation

  1. Clone the repository:
sh
git clone https://github.com/cyanheads/oeis-mcp-server.git
  1. Navigate into the directory:
sh
cd oeis-mcp-server
  1. Install dependencies:
sh
bun install
  1. Configure environment:
sh
cp .env.example .env# optional: adjust OEIS_QUEUE_MAX_WAIT_MS, the transport, or the log level

Configuration

VariableDescriptionDefault
OEIS_QUEUE_MAX_WAIT_MSLongest a call waits in the oeis.org request queue before failing with pacer_shed and a retryAfter, in ms. Each call's 50 s deadline also has to cover the request itself, so waits stop at about 35,000 ms whatever the setting.30000
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTHTTP server port.3010
MCP_SESSION_MODEHTTP session mode: stateless, stateful, or auto.stateless
MCP_AUTH_MODEAuthentication: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (debug, info, warning, error, etc.).info
LOGS_DIRDirectory for log files (Node.js only).<app-root>/logs
STORAGE_PROVIDER_TYPEStorage backend: in-memory, filesystem, supabase, cloudflare-kv/r2/d1.in-memory
OTEL_ENABLEDEnable OpenTelemetry.false

See .env.example for every server setting and the common framework overrides.

Running the server

Local development

  • Build and run the production version:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:http# orbun run start:stdio
  • Run checks and tests:

    sh
    bun run devcheck  # Lints, formats, type-checks, and morebun run test      # Runs the test suite

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point: registers the tools and resource, sets the server instructions, and starts the OEIS service.
src/configServer-specific environment variable parsing and validation with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts). Six tools.
src/mcp-server/resourcesResource definitions. The oeis://sequence/{aNumber} resource.
src/mcp-server/sharedSchemas shared across definitions (A-number input, paging, summary rows), Markdown helpers for contributor-written text, and the data-line-limit test and sentence the term-matching zero-hit notices share.
src/services/oeisoeis.org client: pacer, retries, fetch boundaries, LRU cache, record normalization, and the internal-format parser.
tests/Unit tests mirroring the src/ structure; upstream responses come from fixtures, never the live site.

Development guide

See CLAUDE.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for logging and ctx.enrich for notices, totals, and paging context
  • Register new tools and resources in the barrels at src/mcp-server/*/definitions/index.ts
  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

This project is licensed under the Apache 2.0 License. See the LICENSE file for details.

來源:README.md,提交 d01d0ee

工具

6

oeis_identify_sequence

Identify OEIS Sequence

Identify integer sequences that contain a run of consecutive terms, e.g. "1, 2, 5, 14, 42". Returns up to 10 matches per page in OEIS relevance order, each with the index n at which the supplied run begins. For the best hit rate supply about 6 terms and leave off the first one or two, since sources disagree on where a sequence starts. OEIS matches only the first terms of each entry (its data line, at most about 270 characters), not its b-file, so a run from far into a sequence is not found. Takes up to 60 terms, each an integer of at most 200 digits or the wildcard _ for one unknown term.

輸入參數startterms必填matchSigns

oeis_search_sequences

Search OEIS Sequences

Search the OEIS using its query syntax: plain words, "quoted phrases", comma-separated terms, prefixes (keyword:, author:, name:, comment:, formula:, program:, xref:, id:), | for OR, and a leading - to exclude. Returns up to 10 summaries per page. For identifying a sequence from its terms, oeis_identify_sequence is the direct route.

輸入參數sortquery必填start

oeis_get_sequence

Get OEIS Sequence

Fetch one OEIS entry by A-number. Returns the name, data-line terms, offset, keywords, author, dates, and the sections: comments, formulas (recurrences and generating functions), examples, programs (Maple, Mathematica, PARI, Python, …), references, links, cross-references, and extensions. When the sections together exceed 24,000 characters of serialized JSON, the core fields come back with a section outline instead; call again with sections to pick what to read. A selection past 100,000 bytes comes back in parts cut between items: pass nextFromItem as fromItem, with the same sections, for the next part.

輸入參數aNumber必填fromItemsections

oeis_get_terms

Get OEIS Sequence Terms

List terms a(n) of a sequence with their indices n. Reads the entry's b-file when it has one — often thousands of terms beyond the data line — and otherwise the data line itself. Values are exact decimal strings of any size. A slice stops at limit terms (at most 1000 per call), at about 100,000 bytes, or at the end of one 1 MiB part of a larger b-file, whichever comes first; nextFromIndex continues it.

輸入參數limitaNumber必填fromIndex

oeis_get_cross_refs

Get OEIS Cross-References

List sequences related to an OEIS entry. direction outgoing returns the A-numbers named in the entry's cross-reference (Cf.) lines, with any parenthetical note beside each; direction incoming returns entries that mention this A-number anywhere. Each row carries the related sequence's name and first terms. 10 rows per page.

輸入參數startaNumber必填direction

oeis_list_reference

List OEIS Reference

Look up OEIS vocabulary used by the other tools: keyword flags (nonn, core, tabl, cons, …), search syntax (prefixes, operators, wildcards, sort orders, paging window), and identifier conventions (A-numbers, legacy M/N numbers, offsets, b-files).

輸入參數topic必填

版本歷史

3
  1. v0.1.3最新Oct 18, 2026
  2. v0.1.2Oct 2, 2026
  3. v0.1.1Oct 1, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分