Local Context MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add local-context-mcp -- docker run -i --rm obaratch/local-context-mcp-server
README.md

Share local contextual information like date, time, and location with your AI.

local-context-mcp

日本語 English

local-context-mcp は、MCP サーバ実装の習作として作ったミニプロジェクトです。 AIとユーザが同じ環境にいる前提で、現在の文脈を共有するために便利、かもしれない、機能を提供します。

機能説明

  • ローカルで動く MCP サーバ
  • AIとユーザが同じ場所にある前提で、現在日時を共有するための tool を提供
  • GeoIP 由来の位置情報は補助用途に限る。取得できない場合があり、取得できても精度は低く、国や都市レベルでも大きく外すことがある

`when-is-now`

  • 現在日時(ISO 8601形式)を返します
  • タイムゾーンは TZ、GeoIP cache 付き自動取得、ローカル環境の順で解決します
  • 返却値には解決済みタイムゾーン名も含みます
  • GeoIP ベースの自動取得は失敗しうるうえ、推定結果が大きく外れる場合があります。確実性が必要なら TZ を明示設定してください
  • auto-tz の詳細は `docs/auto-tz.md` を参照
  • 詳細は `docs/tools/when-is-now.md` を参照

`where-are-we`

  • GeoIP 由来の情報から、大まかな場所文字列を返します
  • 返却値は Tokyo, Tokyo-toTokyo, JP のような、LLM が文脈として扱いやすい粗い表現です
  • 位置文字列は cityregioncountry のうち使える情報を優先して組み立てます
  • 空文字や空白だけの値は使わず、重複する値はできるだけ省いて簡素な表現にします
  • GeoIP location は取得できない場合があり、取得できても国や都市レベルで大きく外れることがあります
  • 詳細は `docs/tools/where-are-we.md` を参照

LM Studio から Docker で使う

詳細仕様は `docs/docker.md` を参照。

事前準備

  • Docker イメージをビルドする
npm run docker:build

設定例

  • LM Studio の MCP サーバ設定に以下を追加する
{
  "mcpServers": {
    "local-context": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "obaratch/local-context-mcp-server"]
    }
  }
}
  • 必要に応じて args-e TZ=Asia/Tokyo を追加して明示設定できる
  • auto-tz の GeoIP cache を再利用したい場合は、named volume を追加する
  • GeoIP ベースの位置推定やタイムゾーン推定は、MCP クライアント側の現在地を正確に表す保証がない。取得不能や大きな誤判定を前提に扱う

確認

  • 接続後に tools/list で以下のツールが見えること
    • when-is-now
    • where-are-we

cache 永続化あり設定例

{
  "mcpServers": {
    "local-context": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--mount",
        "source=local-context-store,target=/data",
        "obaratch/local-context-mcp-server"
      ]
    }
  }
}
  • この構成では store と GeoIP cache が named volume local-context-store に保存される
  • named volume は Docker が管理するため、ホスト側に固定ディレクトリを作らなくてよい
  • 詳細は `docs/docker.md``docs/store.md` を参照

Tools (2)

when-is-nowReturns the current date and time in ISO 8601 format including the resolved timezone.
where-are-weReturns an approximate location string based on GeoIP information.

Environment Variables

TZTimezone setting to explicitly define the local time for the server.

Configuration

claude_desktop_config.json
{"mcpServers": {"local-context": {"command": "docker", "args": ["run", "-i", "--rm", "obaratch/local-context-mcp-server"]}}}

Try it

What time is it right now in my current timezone?
Can you tell me my approximate location based on my current network context?
What is the current date and time, and where am I located?

Frequently Asked Questions

What are the key features of Local Context MCP?

Provides current date and time in ISO 8601 format. Resolves timezone via TZ environment variable, GeoIP cache, or local environment. Returns approximate location strings based on GeoIP data. Supports Docker-based deployment for easy integration with MCP clients.

What can I use Local Context MCP for?

Providing AI with accurate local time for time-sensitive tasks. Helping AI understand the user's general geographic context for location-aware responses. Standardizing date and time formats across different AI interactions.

How do I install Local Context MCP?

Install Local Context MCP by running: npm run docker:build

What MCP clients work with Local Context MCP?

Local Context MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Local Context MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare