This example runs an MCP server that exposes a lance-context store as a
simple memory and knowledge base for Claude Code.
Ensure Python 3.11+ is available locally.
cd examples/mcp-claude-code
uv venv
source .venv/bin/activate
uv pip install -r requirements.txtcd examples/mcp-claude-code
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtpython server/lance_context_mcp.py --uri .artifacts/claude_context.lanceThe server creates a Lance dataset under .artifacts/ if it doesn't exist.
From the example directory, add the MCP server to Claude Code (project scope):
claude mcp add --transport stdio --scope project lance-context -- \
.venv/bin/python server/lance_context_mcp.py --uri .artifacts/claude_context.lanceThis writes a .mcp.json file in the current directory. Verify with:
claude mcp listIf you launch Claude Code via aifx agent run claude, run it from this
directory after adding the MCP server so it can pick up the project-scoped
configuration.
Now you can use tools like add_entry, list_entries, search_entries,
stats, and checkout_version inside Claude Code.
This walkthrough uses Claude Code plus the lance-context MCP server to fix a real packaging build failure in a UV project.
From the example root:
cd examples/mcp-claude-code/e2e/uv-build-broken
uv buildExpected failure (excerpt):
OSError: Readme file does not exist: README.md
Ensure the MCP server is running (see "Run the MCP server"). Then start Claude
Code from examples/mcp-claude-code so it picks up .mcp.json:
aifx agent run claudeExample prompt (paste into Claude Code):
We need to fix `examples/mcp-claude-code/e2e/uv-build-broken`.
1) Run `uv build` to confirm the failure.
2) Store the error in lance-context with `add_entry` (session_id: build).
3) Fix the project so `uv build` succeeds.
4) Re-run `uv build`, then store the fix summary in lance-context (session_id: build).
After Claude updates the project, run:
uv buildThe build should succeed. The expected fix is to point the readme field in
pyproject.toml at docs/README.md. A reference solution lives at:
examples/mcp-claude-code/e2e/uv-build-fixed
If you want to verify the MCP server programmatically without Claude Code:
python mcp_smoke_test.py --keepThis script drives the MCP server over stdio, writes sample entries, and keeps
the dataset so you can inspect .artifacts/e2e_context.lance.
For teams using Codex skills, an example skill definition lives at:
examples/mcp-claude-code/skills/mcp-lance-context
It is provided as a reference for how to document MCP tooling and Claude Code setup in a reusable skill.
To start fresh, stop the server and delete .artifacts/claude_context.lance.