jquants-mcp: Instructions file for Claude Code

CLAUDE.md

jquants-mcp CLAUDE.md is an instructions file for Claude Code from shigechika/jquants-mcp. It costs 4,084 tokens per session, scanned A, original, MIT.

Repository instructions for jquants-mcp, a server that retrieves Japanese stock-market data through the J-Quants API. It uses the official Model Context Protocol software development kit, communicates over standard input and output, and includes testing and linting commands.

In plain words
What is it for?
Use it when modifying stock-data tools, the API client, the SQLite cache, tests, or the server's deployment and smoke-test workflow.
Why use it?
The repository has specific choices about its protocol library, authentication boundary, caching, and command-line workflow. These instructions reduce the risk of changing code in ways that conflict with that setup.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md.

This is shigechika/jquants-mcp's own configuration. It tells Claude Code how to work on jquants-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything jquants-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to shigechika/jquants-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/shigechika/jquants-mcp/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/shigechika/jquants-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for jquants-mcp CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/shigechika/jquants-mcp/claude-md/github.svg)](https://agentmods.dev/instructions/shigechika/jquants-mcp/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/shigechika/jquants-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/shigechika/jquants-mcp/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for jquants-mcp CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/shigechika/jquants-mcp/claude-md"><img src="https://agentmods.dev/badge/instructions/shigechika/jquants-mcp/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 4,084 This file is loaded in full into every session.
When invoked 4,084 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.04084 $0.04084
Opus 5 $0.02042 $0.02042
Sonnet 5 $0.00817 $0.00817
Haiku 4.5 $0.00408 $0.00408

Measured 9d ago against content hash b2f197037fc5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

jquants-mcp CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 182 lines

How it starts

The opening of the file, as written. The whole thing — 182 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

Project Overview

jquants-mcp is an MCP server that retrieves Japanese stock market data via J-Quants API v2. The server is stdio-only and is built on the official mcp SDK's mcp.server.fastmcp.FastMCP (server.py + tools/). The standalone FastMCP v3 package (fastmcp) is no longer a dependency: its last in-repo users — the HTTP/OAuth surface (auth.py, settings/, oauth_kv_store.py, the non-stdio branch of run_server()) and scripts/smoke_test.py's client — were deleted or ported to the official SDK in #568. httpx, SQLite cache. Multi-user OAuth is terminated upstream by the Cloud Run gateway (oauth2-proxy + mcp-stdio serve), not in this process — see "Deployment Targets".

Commands

uv sync --dev          # Install dependencies
uv run pytest -v       # Run tests
uv run ruff check src/ tests/   # Lint
uv run ruff format src/ tests/  # Format

uv run python scripts/smoke_test.py            # Exercise every tool against real data
uv run python scripts/smoke_test.py --only earnings --traceback   # Debug one tool

Architecture

  • src/jquants_mcp/ — Main package
    • server.py — Official-SDK FastMCP server (stdio), per-user client management, tool registration
    • client.py — httpx async client with rate limiting, retry, pagination
    • config.py — configparser + env vars hybrid configuration
    • cache/store.py — 2-tier SQLite cache (Tier1: row-level, Tier2: response-level with TTL); background PRAGMA quick_check integrity verification (verify_and_record) with a (dev, ino)-keyed sidecar (cache.db.verified.json) so a fresh per-message CacheStore reuses a prior generation's verdict instead of re-running the multi-second check on every claude.ai message
    • tools/ — Tool modules registered via register(mcp, get_client, get_cache) pattern
    • crypto.py — AES-256-GCM encryption for user API keys
    • db/users.py — Per-user API key storage (SQLite, encrypted)
    • validators.py — Input validation (code, date, sector)
    • allowlist.pyJQUANTS_ALLOWED_EMAILS gate; the gateway-injected principal is the verified email, so server.py passes it straight to is_email_allowed
    • request_context.py — Request-scoped plan contextvar; read by CacheStore._effective_plan as a fallback before its plan_resolver (see below), so each user's plan date window applies without threading plan through tools
  • scripts/ — Operational scripts
    • daily_fetch.py — Daily data fetch (cron / scheduled-task companion for cache population)
    • bulk_fetch_all.py — Historical data bulk fetch via J-Quants Bulk API
    • gcs_sync.py — Cloud Run cache.db startup download from GCS (--init-cache). Skips the download (and the atomic replace that always allocates a new inode, which would invalidate CacheStore's (dev, ino) integrity sidecar) when the GCS generation of the effective object -- whichever cache.db.zst/cache.db the zst-then-fallback precedence would actually use -- is unchanged since the last successful download, tracked in a cache.db.generation.json sidecar. On Cloud Run that skip is dormant since #584 removed the periodic poll it was written for (a cold start always starts from an empty cache dir), but it stays correct and load-bearing for repeat --init-cache runs against a populated dir. Auth DBs are no longer synced here: users.db/oauth_state.db moved to Firestore on Cloud Run, so _DOWNLOAD_FILES/_UPLOAD_FILES are empty and --init/--daemon are auth-DB no-ops
    • gcs_export_cache.py — Export cache.db to GCS (used by the daily publisher)
    • verify_cache.py — Stand-alone cache-integrity prewarm CLI: runs the same verify_and_record quick_check the CacheStore sidecar uses, ahead of the next request, so a freshly downloaded cache.db already has a warm (dev, ino) sidecar by the time the first per-message child process connects. Invoked by entrypoint-stdio.sh (backgrounded after the synchronous startup download)
    • rotate_encryption_key.py — Re-encrypt user API keys during MCP_ENCRYPTION_KEY rotation
    • collect_metrics.py / load_test.py — Cloud Run sizing helpers
    • smoke_test.py — Live smoke test: runs every registered tool against real data (in-process, or --url against a deployment) and fails on empty/stale/error answers. smoke_harness.py is the server-agnostic engine; smoke_probes.py holds the per-tool specs. Needs a populated cache + API key, so it runs on the host that has them — not in CI. CI enforces only the coverage half (tests/test_smoke_probes.py: a new tool without a probe spec fails the build)
    • entrypoint-compose.sh — the Dockerfile's default ENTRYPOINT, for the self-hosted compose.yml path. Runs mcp-stdio serve in front of the stdio server with no OAuth and no GCS; auth is an optional static bearer token read from MCP_STDIO_SERVE_TOKEN. Replaced the streamable-http entrypoint.sh, which had crash-looped since #566 (#601). Refuses to start when K_SERVICE is set — booting it on Cloud Run would publish an unauthenticated /mcp behind oauth2-proxy's skip-auth route for /mcp
    • entrypoint-stdio.sh — Docker/Cloud Run entrypoint for the jquants service (mcp-stdio serve, behind an oauth2-proxy sidecar); downloads cache.db synchronously at startup, then backgrounds verify_cache.py to warm the integrity sidecar. It has no in-container refresh mechanism (#584 removed the 15-minute cache-poll.crontab supercronic poll): with min-instances=0 every cold start already re-downloads a current cache.db, and the only window a refresh could help is an instance staying warm across the publisher's once-a-weekday export. There, not-yet-cached days fall through to the live API (correct, just slower), while corrections to already-cached rows do not — the cache-vs-API decision is presence-based and Tier 1 get_rows applies no TTL, so a restated statement or retroactive split adjustment stays stale until the instance recycles (measured lifetimes 15-26 min under min-instances=0, i.e. the same order as the 15-minute poll it replaces). The retired entrypoint.sh's Pub/Sub-pushed reload route has no equivalent here because a stdio-only server exposes no HTTP route for a push to land on; push-based alternatives were designed and rejected as not worth the moving parts (see #584)
  • tests/ — pytest + pytest-asyncio tests (1272 tests as of 2026-08, after the HTTP/OAuth removal in #568)

Read the full file on GitHub · 182 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 182 lines · 4,084 tokens per session scan A b2f197037fc5

Subscribe to this mod's changes

jquants-mcp CLAUDE.md is an instructions file published in the GitHub repository shigechika/jquants-mcp (2 stars, last pushed 2d ago), licensed MIT. It adds 4,084 tokens to every session, about $0.0204 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

deepseek-harness AGENTS.md

AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.

deepseek-ai/deepseek-harness · 3,735 tokens