MCP Server

Connect Cograph to AI agents via the Model Context Protocol.

What is MCP?

The Model Context Protocol (MCP) lets AI agents call tools on external systems. Cograph exposes an MCP server so agents like Claude, Cursor, Windsurf, and custom agents can query your knowledge graphs directly.

Setup

Grab an API key from your dashboard, then add this to your MCP client configuration (e.g., Claude Code settings, Cursor config, or ~/.claude/mcp.json):

json
{
  "mcpServers": {
    "cograph": {
      "command": "npx",
      "args": ["-y", "cograph-mcp"],
      "env": {
        "COGRAPH_API_KEY": "sk_live_..."
      }
    }
  }
}

The server connects to https://api.cograph.cloud by default. Override with COGRAPH_API_URL if self-hosting.

Available Tools

ask

Ask a natural language question against a knowledge graph.

Parameters
questionstring, requiredThe question to ask
kg_namestring, optionalTarget knowledge graph name

list_knowledge_graphs

List all available knowledge graphs and their descriptions. No parameters.

ingest_csv

Ingest a CSV file into a knowledge graph. Schema is automatically inferred.

Parameters
file_pathstring, requiredAbsolute path to the CSV file
kg_namestring, requiredName for the knowledge graph

view_ontology

View the ontology (types, attributes, relationships) across all knowledge graphs. No parameters.

evolve_ontology

Evolve the ontology by describing a schema change in plain English — no exact type, attribute, or relationship names required. Cograph matches your request against the existing ontology, auto-applies high-confidence changes, and returns ambiguous or new-type changes as proposals to confirm.

Parameters
askstring, requiredThe schema change in plain English (e.g. "track which company a person works for")
knowledge_graphstring, optionalTarget knowledge graph name

Returns a summary, the applied changes, and any proposals to confirm.

apply_ontology_change

Commit a single proposal returned by evolve_ontology. Use this to confirm changes that weren't auto-applied.

Parameters
proposalobject, requiredOne proposal object returned by evolve_ontology

Example Usage

Once configured, you can interact with your knowledge graphs from any MCP-compatible agent:

> "What knowledge graphs do I have?"
   calls list_knowledge_graphs()

> "How many events in San Francisco are free?"
   calls ask(question="...", kg_name="events-sf")

> "Ingest this sales data"
   calls ingest_csv(file_path="/path/to/sales.csv", kg_name="sales-2026")

> "Track which company a person works for"
   calls evolve_ontology(ask="track which company a person works for")
    reuses the existing Person type, adds a works_at relationship to
    Company (creating Company if absent), and returns applied changes
    plus any proposals to confirm

> "Yes, apply that proposal"
   calls apply_ontology_change(proposal=<the proposal from evolve_ontology>)