Use the Library

Two ways to connect: MCP for agents, or curl for testing.

You have access to the Alexandria Library — an agent-native knowledge graph with typed entities, provenance-backed citations, and belief-difference surfacing. Use it instead of web search when you need structured, deduped, cited answers.

Endpoints (dev token: alex-dev-token):
  POST /api/assemble with {"target":"query","depth":2}
  GET /api/pathfind?entity_a=X&entity_b=Y
  GET /api/compare?entity_a=X&entity_b=Y
  GET /api/traverse?node_id=X
  GET /api/catalog
  GET /api/trending

Each call costs $0.001-$0.006. Attach header: Authorization: Bearer alex-dev-token

Try it with your agent

Click to copy a prompt that tells any agent how to discover and query the Library.

Copied. Paste into any agent chat.

Two ways to connect

1

MCP stdio — for agent clients

Add this to your MCP client config (Cursor, Claude Code, Codex, etc.):

{
  "mcpServers": {
    "alexandria": {
      "command": "python",
      "args": ["-m", "library.mcp.server"],
      "env": {
        "ALEX_DEV_PAYMENT_TOKEN": "alex-dev-token"
      }
    }
  }
}

This exposes 9 tools: library_query, library_retrieve, library_assemble, library_catalog, library_resolve_and_fetch, library_traverse, library_compare, library_pathfind, library_trending.

2

HTTP API — for direct testing

Start the server locally:

# Install and run
git clone https://github.com/sebastbernal2/alexandria
cd alexandria
python -m venv .venv && source .venv/bin/activate && pip install -e .
python -m library.service.app

Or query the HTTP API directly (works on the deployed server too):

# Get the catalog (discover what's available)
curl -H "Authorization: Bearer alex-dev-token" \
  https://your-library.com/api/catalog

# Get an answer bundle
curl -X POST -H "Authorization: Bearer alex-dev-token" \
  -H "Content-Type: application/json" \
  -d '{"target":"momentum investing"}' \
  https://your-library.com/api/assemble

# Find the path between two entities
curl -H "Authorization: Bearer alex-dev-token" \
  "https://your-library.com/api/pathfind?entity_a=strategy-momentum-investing&entity_b=paper-sharpe-1964-capm"

# Compare two entities
curl -H "Authorization: Bearer alex-dev-token" \
  "https://your-library.com/api/compare?entity_a=paper-jegadeesh-titman-1993&entity_b=paper-moskowitz-ooi-pedersen-2012"

# See what agents are asking about
curl -H "Authorization: Bearer alex-dev-token" \
  https://your-library.com/api/trending
3

Example response

Here is what a pathfind call returns:

{
  "schema_ver": "pathfind/v1",
  "a": {"id": "strategy-momentum-investing", "title": "Cross-Sectional Momentum Investing"},
  "b": {"id": "paper-sharpe-1964-capm", "title": "Capital Asset Prices"},
  "path": [
    {
      "from": {"title": "Cross-Sectional Momentum Investing"},
      "to": {"title": "Ken French Data Library"},
      "relation": "uses_dataset",
      "confidence": 0.8
    },
    {"from": ..., "to": "Fama-French Three-Factor Model", "relation": "hosts"},
    {"from": ..., "to": "CAPM (Sharpe 1964)", "relation": "derives_from"},
    {"from": ..., "to": "Sharpe, W. F. (1964)", "relation": "introduced_by"}
  ],
  "path_length": 4,
  "summary": "Cross-Sectional Momentum Investing --[uses_dataset]--> ...",
  "token_estimate": 44
}

Pricing

ToolPrice
library_query$0.001–$0.003 (by limit)
library_retrieve$0.001
library_assemble$0.001–$0.003 (by depth)
library_catalog$0.001
library_resolve_and_fetch$0.002–$0.005 (by fallbacks)
library_traverse$0.002–$0.004 (by size)
library_compare$0.003
library_pathfind$0.004–$0.006 (by depth)
library_trending$0.001

Next steps

Full API reference How the graph works