Skip to main content
Glama
bank-of-japan-mcp-server

bank-of-japan-mcp-server

by cyanheads

npm License Docker MCP SDK TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

Overview

Search series metadata in English or Japanese across the Bank of Japan's 50 statistical databases. Retrieve observations in their published frequencies, filter Tankan surveys by industry and firm size, or look up realized overnight call rates and basic discount and loan rate changes. No API key required.

Tools

Tool

Description

boj_search_series

Find series by text, code, database, or frequency

boj_get_series_observations

Fetch observations by series code or database branch

boj_get_tankan

Retrieve Tankan observations by survey dimension

boj_get_policy_rates

Get realized call rates and basic discount and loan rate history

boj_list_reference

Browse databases, layers, period formats, Tankan codes, rate codes, coverage, and attribution

boj_dataframe_describe

Inspect staged tables, columns, and series metadata

boj_dataframe_query

Run read-only SQL on staged tables

boj_dataframe_drop

Delete one staged table. Opt-in via BOJ_DATAFRAME_DROP_ENABLED=true

Related MCP server: mcp-boj

Capability reference

boj_search_series tool

  • Pass query (literal words or a series code), db, and/or frequency. Set active_only: false to include discontinued series. Page with limit (default 25, cap 100) and next_cursor.

  • Global result pages omit Tankan (CO) and report excluded_co_matches when available. Set db: "CO" for Tankan catalog matches.

  • A cold catalog may return catalog_loading. Repeat the query after loading progresses. A stale result identifies the databases served from older catalog data.

boj_get_series_observations tool

  • Pass codes using qualified IDs from search, for example {"codes":["IR01'MADR1Z@D"],"start_date":"2024-01","limit":10} for the basic discount and loan rate. Or pass a branch with db, layer, and frequency from the layer reference. A code request resolves up to 250 unique identifiers and reports additional ones in unprocessed_codes.

  • start_date and end_date are inclusive. Accepts calendar dates, months, quarters, halves, or years. Returned periods retain the series' native frequency and calendar convention.

  • series_limit counts series per roster page (default 1, cap 250). limit counts inline observations per series (default 25, cap 1,000). Use include_nulls: true for dated nulls inline.

  • If temporary observation storage reaches capacity, start without a cursor and narrow the date range or reduce series_limit. For contention with other active windows, retry after they expire.

  • On collecting, resend the original request with the returned cursor. When ready, next_cursor visits earlier observations on the same page and next_selection_cursor moves to the next roster page. Pass either as cursor with the original filters and limits. Restart the original call if its cursor expires or the source revision changes.

  • When a response includes staged, its table contains the complete roster-page window, including dated nulls. Carry the returned canvas_id to the next roster page to stage another table on the same canvas.

boj_get_tankan tool

  • {} requests the business conditions DI for large manufacturers and nonmanufacturers, actual and forecast. Browse tankan_codes to select item, industries, sizes, horizons, series_type, frequency, aggregation, or detail_item.

  • Observation windows and continuations work as above, with series_limit default 4 and cap 25. The unavailable list reports unpublished combinations and their available frequencies.

boj_get_policy_rates tool

  • Returns the latest daily overnight call-rate average, high and low, the latest monthly average, and the latest basic discount and loan rate.

  • The basic rate's effective-date changes are derived from the published series and sorted newest first. Page through changes with limit (default 25, cap 100) and next_cursor passed as cursor.

boj_list_reference tool

  • For example, call with {"topic":"layers","db":"IR01"} to browse the basic discount and loan rate database hierarchy. Use topic: "tankan_codes" with an optional dimension for the codebook.

  • Other topics are databases, frequencies, policy_rates, coverage_gaps, and attribution. Page with limit (default 25, cap 100) and next_cursor passed as cursor.

boj_dataframe_describe tool

  • Pass canvas_id from a staged result. The response includes table schema, row count, expiration, and each series' recorded and staged date ranges.

  • Continue a table's series manifest with its table_name, cursor, and the same limit (default 25, cap 100).

boj_dataframe_query tool

  • Pass canvas_id and a single read-only SELECT, optionally with CTEs. Use the names from boj_dataframe_describe. For stable paging, add an ORDER BY that uniquely orders the rows.

  • SQL is limited to 65,536 UTF-16 code units. The 30-second query deadline includes time waiting for the canvas. DuckDB may need to finish preparing a statement before it can honor cancellation.

  • limit defaults to 25 rows and caps at 1,000. Pass next_cursor as cursor with the same canvas, SQL, and limit.

boj_dataframe_drop tool

  • Pass canvas_id and table_name to remove a staged table. Requires DuckDB and BOJ_DATAFRAME_DROP_ENABLED=true.

Features

  • The catalog is cached locally and populated on demand. Start with a database-scoped search for a faster cold lookup. Allow roughly 1 GB of disk space for all 50 databases. Requests to BOJ are paced, so loading the full catalog takes time.

  • Native installs default to DuckDB for SQL. The portable Claude Desktop bundle uses inline observation continuation and a portable catalog cache.

  • For Japanese Government Bond yields, use the Ministry of Finance's JGB yield series. For announced policy targets, decisions, and meeting records, use the BOJ Monetary Policy Meetings archive.

Getting started

For Claude Code, using Node.js 24 or later:

claude mcp add bank-of-japan-mcp-server -- npx -y @cyanheads/bank-of-japan-mcp-server

For another stdio client, add this to its MCP config:

{
  "mcpServers": {
    "bank-of-japan-mcp-server": {
      "command": "npx",
      "args": ["-y", "@cyanheads/bank-of-japan-mcp-server"]
    }
  }
}

With Bun 1.4.4 or later, use "command": "bunx" and "args": ["--bun", "@cyanheads/bank-of-japan-mcp-server"]. Or download and open the .mcpb using the Claude Desktop badge above.

Configuration

Variable

Description

Default

BOJ_CATALOG_DIR

Writable directory for the persisted series catalog

$XDG_CACHE_HOME/bank-of-japan-mcp-server or ~/.cache/bank-of-japan-mcp-server

BOJ_DATAFRAME_DROP_ENABLED

Set true to expose the staged-table drop tool

false

CANVAS_PROVIDER_TYPE

Canvas engine. Set none to disable SQL staging

duckdb, fixed to none in the Desktop bundle

MCP_TRANSPORT_TYPE

stdio or http

stdio

MCP_HTTP_HOST / MCP_HTTP_PORT / MCP_HTTP_ENDPOINT_PATH

Local HTTP address, port, and route

127.0.0.1 / 3010 / /mcp

MCP_PUBLIC_URL

Public origin for a TLS-terminating proxy

Unset

MCP_AUTH_MODE

none, jwt, or oauth

none

MCP_LOG_LEVEL

Minimum log level

info

See .env.example for framework overrides. Claude Code prompts for the two BOJ options when enabling the plugin. For the Codex plugin, set the BOJ variables in the environment that launches Codex.

Running the server

Local development

git clone https://github.com/cyanheads/bank-of-japan-mcp-server.git
cd bank-of-japan-mcp-server
bun install
bun run rebuild
bun run start:http

Connect your client to http://localhost:3010/mcp, or use bun run start:stdio. To preload the catalog, use its CLI after installing the npm package globally:

npm install -g @cyanheads/bank-of-japan-mcp-server
boj-catalog init
boj-catalog verify
boj-catalog refresh

init loads missing or stale databases, verify checks coverage on disk, and refresh forces a reload. Use the same BOJ_CATALOG_DIR as the server. From a source build, use bun run mirror:init, bun run mirror:verify, and bun run mirror:refresh. The HTTP server schedules a refresh for 00:01 UTC each day.

Docker

docker run --rm -p 127.0.0.1:3010:3010 \
  -v boj-catalog:/usr/src/app/.mirror \
  ghcr.io/cyanheads/bank-of-japan-mcp-server:latest

The image runs HTTP on port 3010 and persists the catalog in the mounted volume. To run it over stdio, use docker run -i --rm -e MCP_TRANSPORT_TYPE=stdio followed by the image name.

Project structure

Path

Purpose

src/index.ts

Server registration, canvas setup, HTTP catalog refresh, and shutdown

src/catalog-cli.ts

Catalog initialization, refresh, and verification

src/mcp-server/tools/definitions/

MCP tool input, output, and error contracts

src/services/

BOJ transport, catalog backends, observation traversal, rate and Tankan lookups, and canvas

tests/

Unit and integration tests

Development guide

See developer rules, the design notes, and the repository tree.

Contributing

Run bun run devcheck and bun run test before submitting changes.

License and data attribution

The server code is licensed under Apache 2.0. The Bank of Japan's terms govern reuse of its data. The site notice requires source credit when copying data and prior permission for commercial reproduction, designated materials, and images. See the Time-Series Data Search site notice, API notice, API manual, and Tankan codebook.

This service uses the API provided by the "Bank of Japan Time-Series Data Search." The Bank of Japan does not guarantee the content of the service.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides keyless access to Bank of Japan monetary data, including the current policy rate and Japan CPI inflation, with recent monthly history.
      84 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Provides universal access to over 800,000 economic time series through three tools that browse the full catalog by category, release, or source, search by keywords, tags, and filters, and retrieve observations with date ranges, frequency aggregation, and transformations such as percent change or natural log. It also supports stdio, Docker, and Streamable HTTP transports with caching, rate limiting, and retry handling for deployment in AI assistant clients.
      312 npm
      AGPL 3.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables searching Bank of Japan time-series statistics series by name or series code and retrieving time-series data for a specified series code and period through the official BOJ statistics API.
      MIT