Skip to content

MCP

The Knowledge Graph exposes agent retrieval as a first-party Model Context Protocol (MCP) server on your tenant origin at /_kg-engine/mcp (Streamable HTTP). Agents explore through an evidence loop: search or open a chunk, read its position, section, entities and neighbours in the same payload, then hop to more chunks. Every answer contains only what the caller may read (Permissions). This page is the reference for the tools, the chunk package they return, the search parameters, the OpenCypher tool, and how you connect an external client.

One Knowledge Graph MCP callAn agent in Flow, running as the signed-in person, or an external MCP client with a personal access token calls the Knowledge Graph MCP server on your tenant origin. A permission check resolves the namespaces the caller may read; a call without caller context is refused with an explicit auth error. The graph is searched within those namespaces and chunk packages with text, section, entities and a citation are returned to the caller.CALLSREADABLERETURNSAGENTAgent in Flowruns as the signed-in personCLIENTExternal MCP clientpersonal access tokenSERVERKnowledge Graph MCP serveron your tenant originCHECKPermission checknamespaces the caller may readNORefusedno caller contextGRAPHSearch the graphonly files the caller may readANSWERChunk packagestext · section · entities · citation

One call: the permission check decides which namespaces the caller may read, or refuses the call, before the graph is searched.

Tool What it does
kg_search Hybrid search (full text, vector, graph expansion) fused by reciprocal rank fusion; several namespaces fuse by rank. Returns capped chunk packages. Disabled and unreadable content is excluded
kg_open Open packages by exactly one of chunkKey, outlineKey (that section’s chunks), entityKey (chunks mentioning it) or fileId (the file’s chunks in order)
kg_hop Typed hop onto related packages: next_chunk, prev_chunk, similar (from a chunkKey); mentions, rel, same_type (from an entityKey); outline_child, outline_parent, outline_siblings (from an outlineKey)
kg_outline A file’s page index: sections in document order with outlineKey, title, depth, parent and pages. Paged with cursor / nextCursor; maxDepth limits large files
kg_ontology The published schema of a namespace: entity types, relation types and the patterns that connect them
kg_entity_search Entity entry by text and/or vector similarity; returns type labels and mention evidence packages
kg_file_entities All entities mentioned by one file’s chunks, plus the published entity types used in that file. Paged with afterEntityKey when truncated
kg_file_triples Typed relationship triples where both subject and object are mentioned in one file
kg_namespaces The Knowledge Graph namespaces the caller may read
kg_collections A namespace’s collections (for example a regulation and its successor) with their folder paths; collectionId values go to kg_search as filters.collectionIds
kg_status Processing status of one namespace, or of the files under folderPrefix: disabled, not_started, in_progress, blocked or settled. An agent reads it before importing into a namespace
kg_files Files in one namespace by path. folderPrefix and name (a path glob) combine. Lists a page (cursor / nextCursor). Each file includes namespace, path and fileId (file: plus the path)
kg_file One file’s path, size and content hash from namespace plus path or fileId; a csv or tsv also returns columns. Contents and queries are Fontana Files. See Read or query a file
kg_cypher One read-only OpenCypher statement for an exact word, a figure or a known path (at most 50 rows, 2 second limit). Returns the file path and the chunk text

You enable these tools on an agent with the Knowledge capability tile on the agent card. Five more tools write the graph during an agent turn; see Write tools.

Every search, open, hop and entity-search hit is a chunk package. Lists carry truncated and total when clipped at the requested cap.

Field Contents
text The chunk text, plus contextHeader (the “Document › Heading › Subheading” trail) and citation (namespace/path › sections (pp.))
position chunkIndex, charStart / charEnd in the parsed text, page and line span, tokenCount, prevChunkKey, nextChunkKey
outline The chunk’s page-index section: outlineKey, title, depth, order, and its ancestors, siblings and children
mentions Entities the chunk mentions: key, name, type id and label, how it was found (method), and the quoted text
relNeighbors Typed relations of those entities, when a file you may read states them
dates The file’s documentDate, effective window and collections
similarFiles Readable files similar to the chunk’s file, best first
Cap Default Hard max
topK 8 32
mentions 8 24
rel 8 24
ancestors 6 12
siblings 8 24
children 8 24
similar 4 16

Caps passed on the tool call override the defaults. A value over the hard max fails closed with an error. An optional tokenBudget omits or truncates chunk text. Files processed before character offsets existed report trace.missingOffsets until they are reprocessed.

kg_search runs one or more retrieval lanes and fuses the results with reciprocal rank fusion (RRF):

Parameter Default Purpose
query (required) Search text
namespaces All allowed Subset of the caller’s namespace allow-list
lanes fulltext, vector, graph_expand Which lanes to run. co_annotation is opt-in. A failed lane returns empty without aborting the search
tokenBudget none Estimated token cap on returned chunk text
filters none Collection, folder, temporal and relation filters
ranking.rrfK 60 RRF constant k
ranking.laneWeights 1 each Per-lane multipliers on RRF contributions
ranking.minScore none Drop hits below this display score (0 to 1)

Across several namespaces, results interleave by rank within each namespace, not by raw score, because scores from different corpora are not comparable. A failed lane or namespace returns empty while the others continue; the agent turn is never aborted.

When filters or disabled files hide most of a namespace, the vector lane widens its candidate pool in rounds instead of returning fewer hits; trace.vectorWidening reports the final pool and whether its cap was reached.

The co_annotation lane finds chunks that mention two entities named in the question. It runs only when the search call includes it in lanes; the assistant adds it to its own calls, and KG Studio search has no switch for it. With the lane on, the span linker attaches a phrase in the question to a nearby entity when the published ontology did not already name it, and grounding roles label those entities from how often they are mentioned.

How the assistant answers from the Knowledge GraphYou ask a question. The assistant calls Knowledge Graph search. Full text, embeddings, and a Cypher graph hop run every time and fuse into one ranked list. Co-annotation finds chunks that name two entities in the question. The span linker attaches a phrase the ontology did not name. The response labels entities bridge, filter, or ignore from how often each appears.ASKSALWAYSFUSELISTOPTROLESEVERY SEARCHYOUYouask in chatAIAssistantcalls search over MCPTXTFull textkeywords in the chunksVECEmbeddingsvectors of the chunksCYPCypherone graph hopRRFRank fusionone ranked listOUTSearch responsebridge · filter · ignorefrom how often each appearsOPTCo-annotationtwo entities in the questionchunks naming two entitiesspan linker if a phrase is unnamedLEGENDEvery searchWhen the question names two entitiesExtra lane

Every search runs full text, embeddings and a graph hop and fuses them by rank; co-annotation joins when the question names two entities.

When the lane runs, the response includes grounding, one entry per namespace. Each entry lists the grounded entities with their roles, the chosen pair, directCount (chunks that mention both entities) and bridgeCount (chunks one relation away). When the lane cannot form that evidence, the entry carries a reason such as too_few_bridges.

The remaining read tools move from one hit to the evidence around it.

  • kg_open resolves one key to packages, from a chunk, outline, entity or file id the agent already holds.
  • kg_hop expands from fromKey with a typed kind. similar moves to the first chunks of files similar to the chunk’s file.
  • kg_outline returns a file’s table of contents; kg_open {outlineKey} then opens one section.
  • kg_ontology returns the published schema on its own, so the types do not have to travel on every search hit.
  • kg_entity_search starts from a name and lands on mention packages, so an answer built from it stays citation-backed. Each hit carries degree (how many chunks mention the entity) and role: bridge (specific enough to connect the question to evidence), filter (common enough to narrow the question, not to connect chunks) or ignore (too common to connect the question to evidence).
  • kg_file_entities lists the entities and entity types already extracted for one file; the Ontology Agent reads it before it retypes entities or reviews the file again. afterEntityKey pages the list when the response is truncated.
  • kg_file_triples lists typed relationship triples for one file when both endpoints are mentioned in that file. When truncated is true, the response’s continueAfter goes back as afterSourceEntityKey, afterRelationTypeId and afterTargetEntityKey.

Five tools write the Knowledge Graph on an agent’s behalf. The Ontology Agent uses them when it reviews what processing found in your documents.

Tool What it does
kg_upsert_triples Write typed relationships between entities. Each one cites the file and the quoted text that states it
kg_set_entity_types Set the entity type of one or more entities
kg_propose_ontology_terms Propose entity types and relation patterns. The namespace’s evolution policy decides whether a proposal is applied or waits for review
kg_merge_entities Merge duplicate entities into one. A later merge does not undo it
kg_save_recognition Replace the namespace’s recognition tree (.fontana/kg/recognition.yaml), creating or moving each entity type under the parent the file names
  • Agent turns only. The write tools run only inside a Fontana agent turn. An external client connected with a personal access token does not see them in its tool list, and a call to one is refused.
  • Scope. The person the agent runs for must be allowed to write the Knowledge Graph and must have edit access (editor or admin) to the namespace, and the namespace must be one the agent is set to use. An extraction turn for one file may cite and retype only that file.
  • Files first. Each write lands in the namespace’s files in Fontana Files before it reaches the graph, so a rebuilt graph keeps it. See Where the ontology is kept.
  • Activity. Each write is recorded in the agent turn’s activity.

In Flow, an agent sees these tools under the mcp_knowledge-graph_ prefix, for example mcp_knowledge-graph_kg_upsert_triples.

Every hit names a file: a search package, kg_open, kg_files and kg_file all carry namespace, path and fileId. fileId is file: plus path. Chat @kg:<namespace>/<path> maps to that namespace and path.

kg_file describes the file: path, size and content hash, and for a csv or tsv the columns (header names). Reading and querying the file is the Fontana Files MCP, on the same tenant with the same credentials: pass namespace and the same path or fileId, unchanged, to get_file or query. file:notes/a.txt and notes/a.txt are the same file.

Need Fontana Files call
The text get_file with namespace and path
A line window query with type: "text", startLine, endLine
An in-file or folder regex query with type: "grep"; a path ending in / searches that folder; a hit returns path and fileId
SQL over a csv, tsv, json or jsonl query with type: "sql"; the table is the quoted path: SELECT * FROM "sales.csv". Quote a header that is not a bare name: "Market Value (AUD)"
JSON query with type: "jsonpath", "jsonata" or "jinja" (Jinja receives the parsed document as data)

In Flow, the Files ability gives an agent these tools as mcp_ffs_get_file and mcp_ffs_query, next to the Knowledge ability’s mcp_knowledge-graph_* tools.

kg_cypher runs one read-only OpenCypher statement against a single namespace, selected by the namespace argument. It answers an exact word, a figure or a known path; kg_search answers by meaning when the words or the path are unknown.

A statement labels every node, follows one relationship at a time, projects a property such as f.vfsPath, and ends with a literal LIMIT from 1 to 50. The platform stops each query after 2 seconds and runs statements one at a time. The next page is read with WHERE ID(n) > $afterId; SKIP is rejected. Before writing a statement, an agent lists the namespaces it may read with kg_namespaces and reads the namespace’s published schema with kg_ontology.

The graph stores:

  • FileRef, a file (vfsPath, name, fileId). A Folder (folderPath) connects with Folder -[:HAS_CHILD]-> FileRef.
  • Chunk, one text window (text, path, chunkIndex). Chunk -[:PART_OF]-> FileRef and Chunk -[:NEXT_CHUNK]-> Chunk.
  • OutlineNode, a heading (title). OutlineNode -[:COVERS]-> Chunk.
  • Entity, a mention (name, typeId). Only Chunk -[:MENTIONS]-> Entity.
  • EntityType, the published schema (typeId, label, side = "published").
  • REL, a typed link between entities (relationTypeId), when the namespace has any. A query reaches it from a chunk mention and aliases the edge.

An entity, heading or folder shares the pattern with an aliased Chunk or FileRef, so every row leads back to a file. An exact word in a known path:

MATCH (c:Chunk)-[:PART_OF]->(f:FileRef)
WHERE toLower(c.text) CONTAINS "dkim"
AND f.vfsPath CONTAINS "reports"
RETURN f.vfsPath AS path, c.text AS text
LIMIT 10

An answer cites the file path and the chunk text it came from; an entity name on its own carries no citation. Cypher matches the text it is given, so a misspelling such as “remed” for “Resmed” is found with kg_entity_search first, and a Cypher walk from that entity leads back to the mentioning chunk. Two files connect through Chunk -[:MENTIONS]-> Entity <-[:MENTIONS]- Chunk, returning each file path.

The namespace argument has to be one your namespace grants let you read, and the platform adds the enabled-file check and any pinned filters to each aliased Chunk and FileRef before the query runs.

Every Knowledge Graph tool call is permission-enforced. Fontana resolves the caller’s readable namespaces from the namespace grants on each call. Nothing from a namespace the caller may not read, or from a disabled file, reaches the answer: not its chunks, not the entities only it mentions, not relations only it states, not its similar-file links. If the caller context is missing or cannot be resolved, the call fails closed with an explicit auth error, never a silent empty result or a cross-namespace answer.

In-app agents and external clients both run tools under your identity. An in-app agent reads only the namespaces on its allow-list that you may read.

  • Agents: enable the seeded Knowledge Graph MCP connection from AI → Tools and MCP and assign namespaces on the agent’s Knowledge capability tile. Flow runs tool calls as the signed-in person.
  • Chat: when the Knowledge Graph toggle is on, matching search evidence can be placed in the turn automatically. An answer that uses a file shows a bookmark for that file. Hover the bookmark to see the namespace and path; click it to open the file in the Knowledge Graph.
  • KG Studio: graph layout, ontology editing and search run in the product UI against the same tenant graph.

Two private namespaces of yours are searchable through the same tools.

Memory writes use knowledge_addMemory and knowledge_forgetMemory, which every agent has without setup; they are not MCP tools. Each user has one private memory store in Fontana Files, shared by the agents that user runs. Its files are searchable like any other namespace you can read, so Knowledge Graph search returns your memories next to other evidence. See agent memory for paths, overwrite and the Forget memory button in chat.

Your conversations are a private namespace too: every completed turn is saved to your threads namespace in Fontana Files and indexed like any other document. Your own searches reach it. An agent turn reaches it only in a chat of your own, never in a shared conversation, a Slack or Teams thread, a schedule, an evaluation run or Knowledge Graph extraction, and naming the namespace in a tool call does not change that. See where conversations are saved.

On your tenant Flow origin:

  • Health: https://<tenant>.<baseDomain>/_kg-engine/health (no auth)
  • MCP (Streamable HTTP): https://<tenant>.<baseDomain>/_kg-engine/mcp

Use a personal access token to connect an external MCP client to your tenant’s /_kg-engine/mcp endpoint. You create each token under Admin → Fontana MCP and access tokens (/admin/access-tokens) and bind it to one agent. On this URL the token authenticates as you and serves only the Knowledge Graph read tools that agent grants, together with your namespace grants. The write tools are not served to external clients. The same token connects to External agents and to Fontana Files MCP.

  1. Sign in to your tenant Flow origin (the same HTTPS hostname you use for workflows, for example https://acme.example.com).
  2. Open Admin → Fontana MCP and access tokens (/admin/access-tokens).
  3. Create a token, choose the agent it is bound to, and copy the full fnt_pat_… value from the setup step of the create dialog. It is shown only there: once you close the dialog, nobody can see it again.
  4. Rotate a token on that page to replace its bearer: the old one stops working at once and the new one is shown once, the same way. Revoke a token when it should stop connecting for good.

The token must be created on the same tenant origin you configure in your MCP client. A token from one hostname does not work on another.

Add a Streamable HTTP server in your Cursor MCP configuration (~/.cursor/mcp.json or a project-level .cursor/mcp.json):

{
"mcpServers": {
"knowledge-graph": {
"url": "https://<tenant>.<baseDomain>/_kg-engine/mcp",
"headers": {
"Authorization": "Bearer fnt_pat_…"
}
}
}
}

After editing MCP config, run Developer: Reload Window in Cursor (or fully quit and reopen).

ChatGPT connects to remote HTTPS MCP servers only (Streamable HTTP). You need a paid plan with Developer mode enabled (Settings → Security and login).

  1. Open Settings → Apps & Connectors.
  2. Create a custom connector (Developer mode):
    • Connector URL: https://<tenant>.<baseDomain>/_kg-engine/mcp
    • Authentication: Token (not OAuth), or a single Authorization header (see below).
  3. Paste your full fnt_pat_… value. ChatGPT sends Authorization: Bearer fnt_pat_… to your tenant MCP endpoint.

Header-only setup (works in Cursor and ChatGPT):

Field Value
URL https://<tenant>.<baseDomain>/_kg-engine/mcp
Bearer token env var Empty. This field is for the env-var setup below
Header name Authorization
Header value Bearer fnt_pat_… (full token, including the Bearer prefix)

Env-var setup (ChatGPT desktop / Codex): set bearer_token_env_var to a name such as MCP_PAT, export that variable to the raw token (no Bearer prefix), and do not also send an Authorization header.

Health checks do not use auth. Confirm the PAT on the MCP path:

Terminal window
export MCP_PAT='fnt_pat_…' # full token from /admin/access-tokens
curl -fsS "https://<tenant>.<baseDomain>/_kg-engine/health"
# {"ok":true}
curl -sS -w "\nHTTP %{http_code}\n" -X POST \
-H "Authorization: Bearer $MCP_PAT" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' \
"https://<tenant>.<baseDomain>/_kg-engine/mcp"

Replace <tenant>.<baseDomain> with your tenant origin. 401 means the token is missing, truncated, unknown, revoked, or created on a different origin. 200 with a JSON-RPC body means auth succeeded.

Symptom Likely cause Fix
Health OK, MCP 401 Bad or missing Authorization Use Authorization: Bearer fnt_pat_… only; pick one auth method (header or env var, not both)
Intermittent 401 Bearer env var and header both set Pick one auth method; clear the other
Always 401 Truncated token in the UI Re-copy the full PAT
Always 401 PAT from another tenant origin Create the PAT on the same hostname as your MCP client URL
Always 401 Unknown or revoked token Create a token on this origin at /admin/access-tokens and bind it to an agent