Docs

Claude Code

Add the Foam MCP server to Claude Code for one project, for every project, or for your whole team.

Before you start

You need your personal Foam MCP token in FOAM_MCP_TOKEN. If you have not done that yet, follow Get your token first.

Add Foam to Claude Code

  1. In a terminal where FOAM_MCP_TOKEN is set, run:
    claude mcp add --transport http foam https://api.foam.ai/mcp \
      --header "Authorization: Bearer $FOAM_MCP_TOKEN"
    This registers Foam for the current project. Add --scope user before the name to have it in every project.
  2. Check the connection:
    claude mcp list
    # ✔ Connected   foam
    Inside Claude Code, /mcp shows the same list with the tools.
  3. Start claude and type: Using foam, list my services and run a handful of queries. Claude Code calls list_tables and run_query. You should see your services listed and rows returned.

Share it with your team

Commit this .mcp.json at the repository root instead of running the command. Claude Code fills in FOAM_MCP_TOKEN from each person's own shell, so no token is committed:

{
  "mcpServers": {
    "foam": {
      "type": "http",
      "url": "https://api.foam.ai/mcp",
      "headers": {
        "Authorization": "Bearer ${FOAM_MCP_TOKEN}"
      }
    }
  }
}