[{"data":1,"prerenderedAt":2041},["ShallowReactive",2],{"navigation":3,"\u002Fdocs\u002Fmcp":135,"\u002Fdocs\u002Fmcp-surround":2036},[4],{"title":5,"path":6,"stem":7,"children":8,"page":134},"Docs","\u002Fdocs","docs",[9,13,17,21,25,29,33,37,41,45,49,53,57,61,70,74,78,82,86,90,94,98,102,106,110,114,118,122,126,130],{"title":10,"path":11,"stem":12},"AI harnesses: LLM tools, MCP servers and agents","\u002Fdocs\u002Fai-tools","docs\u002Fai-tools",{"title":14,"path":15,"stem":16},"Architecture","\u002Fdocs\u002Farchitecture","docs\u002Farchitecture",{"title":18,"path":19,"stem":20},"Web \u002F native bridges","\u002Fdocs\u002Fbridges","docs\u002Fbridges",{"title":22,"path":23,"stem":24},"Broadcast channels and tests","\u002Fdocs\u002Fchannels-and-tests","docs\u002Fchannels-and-tests",{"title":26,"path":27,"stem":28},"CLI reference","\u002Fdocs\u002Fcli","docs\u002Fcli",{"title":30,"path":31,"stem":32},"Completeness: how far an answer reaches","\u002Fdocs\u002Fcompleteness","docs\u002Fcompleteness",{"title":34,"path":35,"stem":36},"Configuration","\u002Fdocs\u002Fconfiguration","docs\u002Fconfiguration",{"title":38,"path":39,"stem":40},"External systems","\u002Fdocs\u002Fexternal","docs\u002Fexternal",{"title":42,"path":43,"stem":44},"Generated, copied and vendored files","\u002Fdocs\u002Fgenerated","docs\u002Fgenerated",{"title":46,"path":47,"stem":48},"Installing and updating cg","\u002Fdocs\u002Finstall","docs\u002Finstall",{"title":50,"path":51,"stem":52},"Java","\u002Fdocs\u002Fjava","docs\u002Fjava",{"title":54,"path":55,"stem":56},"Kotlin","\u002Fdocs\u002Fkotlin","docs\u002Fkotlin",{"title":58,"path":59,"stem":60},"Known limitations","\u002Fdocs\u002Flimitations","docs\u002Flimitations",{"title":62,"path":63,"stem":64,"children":65},"MCP server","\u002Fdocs\u002Fmcp","docs\u002Fmcp",[66],{"title":67,"path":68,"stem":69},"code-graph MCP: sample outputs (real calls via the MCP Python SDK stdio client)","\u002Fdocs\u002Fmcp\u002Fsample_outputs","docs\u002Fmcp\u002Fsample_outputs",{"title":71,"path":72,"stem":73},"Rust, C and C++","\u002Fdocs\u002Fnative","docs\u002Fnative",{"title":75,"path":76,"stem":77},"Port gaps: cg parity","\u002Fdocs\u002Fparity","docs\u002Fparity",{"title":79,"path":80,"stem":81},"PHP","\u002Fdocs\u002Fphp","docs\u002Fphp",{"title":83,"path":84,"stem":85},"Planned changes","\u002Fdocs\u002Fplans","docs\u002Fplans",{"title":87,"path":88,"stem":89},"Platform-specific code","\u002Fdocs\u002Fplatforms","docs\u002Fplatforms",{"title":91,"path":92,"stem":93},"Protocol links","\u002Fdocs\u002Fprotocols","docs\u002Fprotocols",{"title":95,"path":96,"stem":97},"Python","\u002Fdocs\u002Fpython","docs\u002Fpython",{"title":99,"path":100,"stem":101},"Quick start","\u002Fdocs\u002Fquickstart","docs\u002Fquickstart",{"title":103,"path":104,"stem":105},"Graph schema","\u002Fdocs\u002Fschema","docs\u002Fschema",{"title":107,"path":108,"stem":109},"Attack surface","\u002Fdocs\u002Fsurface","docs\u002Fsurface",{"title":111,"path":112,"stem":113},"Swift","\u002Fdocs\u002Fswift","docs\u002Fswift",{"title":115,"path":116,"stem":117},"TypeScript \u002F JavaScript frameworks","\u002Fdocs\u002Fts-frameworks","docs\u002Fts-frameworks",{"title":119,"path":120,"stem":121},"How we validate","\u002Fdocs\u002Fvalidation","docs\u002Fvalidation",{"title":123,"path":124,"stem":125},"Validation log","\u002Fdocs\u002Fvalidation-log","docs\u002Fvalidation-log",{"title":127,"path":128,"stem":129},"Value facts and resolutions","\u002Fdocs\u002Fvalue-facts","docs\u002Fvalue-facts",{"title":131,"path":132,"stem":133},"Visual view","\u002Fdocs\u002Fviz","docs\u002Fviz",false,{"id":136,"title":62,"body":137,"description":2031,"extension":2032,"meta":2033,"navigation":527,"path":63,"seo":2034,"stem":64,"__hash__":2035},"docs\u002Fdocs\u002Fmcp.md",{"type":138,"value":139,"toc":2020},"minimark",[140,169,174,203,377,393,397,427,461,511,575,626,653,681,684,1160,1232,1235,1238,1247,1287,1293,1297,1342,1346,1373,1383,1435,1513,1534,1550,1787,1806,1856,1890,1894,1902,1956,1977,1981,2004,2008,2016],[141,142,143,144,151,152,156,157,160,161,164,165,168],"p",{},"code-graph ships a stdio ",[145,146,150],"a",{"href":147,"rel":148},"https:\u002F\u002Fmodelcontextprotocol.io",[149],"nofollow","Model Context Protocol"," server. An agent gets callers, entry points and ",[153,154,155],"code",{},"file:line"," evidence from the graph. It needs the ",[153,158,159],{},"mcp"," Python SDK (2.x). Use the installed ",[153,162,163],{},"cg-mcp"," command from ",[145,166,167],{"href":47},"Install",".",[170,171,173],"h2",{"id":172},"use-as-an-mcp-server","Use as an MCP server",[175,176,177,185],"ol",{},[178,179,180,181,184],"li",{},"Build the graph first, from the repo root: ",[153,182,183],{},"cg index . --db out\u002Fgraph.db",". The server only reads a graph; it does not index on start.",[178,186,187,188,191,192,195,196,195,199,202],{},"Add the server to your client. ",[153,189,190],{},"cg install --host cursor"," (or ",[153,193,194],{},"claude",", ",[153,197,198],{},"codex",[153,200,201],{},"vscode",", …) writes the entry for you. To add it by hand, without installing cg first:",[204,205,210],"pre",{"className":206,"code":207,"language":208,"meta":209,"style":209},"language-json shiki shiki-themes cg-light cg-light cg-dark","{\n  \"mcpServers\": {\n    \"code-graph\": {\n      \"command\": \"uvx\",\n      \"args\": [\"--from\", \"cg-code-graph\", \"cg-mcp\", \"--db\", \"out\u002Fgraph.db\", \"--tools\", \"core\"]\n    }\n  }\n}\n","json","",[153,211,212,221,240,255,280,359,365,371],{"__ignoreMap":209},[213,214,217],"span",{"class":215,"line":216},"line",1,[213,218,220],{"class":219},"sZ_TN","{\n",[213,222,224,227,231,234,237],{"class":215,"line":223},2,[213,225,226],{"class":219},"  \"",[213,228,230],{"class":229},"sbOAO","mcpServers",[213,232,233],{"class":219},"\"",[213,235,236],{"class":219},":",[213,238,239],{"class":219}," {\n",[213,241,243,246,249,251,253],{"class":215,"line":242},3,[213,244,245],{"class":219},"    \"",[213,247,248],{"class":229},"code-graph",[213,250,233],{"class":219},[213,252,236],{"class":219},[213,254,239],{"class":219},[213,256,258,261,264,266,268,271,275,277],{"class":215,"line":257},4,[213,259,260],{"class":219},"      \"",[213,262,263],{"class":229},"command",[213,265,233],{"class":219},[213,267,236],{"class":219},[213,269,270],{"class":219}," \"",[213,272,274],{"class":273},"sha9Y","uvx",[213,276,233],{"class":219},[213,278,279],{"class":219},",\n",[213,281,283,285,288,290,292,295,297,300,302,305,307,310,312,314,316,318,320,322,324,327,329,331,333,336,338,340,342,345,347,349,351,354,356],{"class":215,"line":282},5,[213,284,260],{"class":219},[213,286,287],{"class":229},"args",[213,289,233],{"class":219},[213,291,236],{"class":219},[213,293,294],{"class":219}," [",[213,296,233],{"class":219},[213,298,299],{"class":273},"--from",[213,301,233],{"class":219},[213,303,304],{"class":219},",",[213,306,270],{"class":219},[213,308,309],{"class":273},"cg-code-graph",[213,311,233],{"class":219},[213,313,304],{"class":219},[213,315,270],{"class":219},[213,317,163],{"class":273},[213,319,233],{"class":219},[213,321,304],{"class":219},[213,323,270],{"class":219},[213,325,326],{"class":273},"--db",[213,328,233],{"class":219},[213,330,304],{"class":219},[213,332,270],{"class":219},[213,334,335],{"class":273},"out\u002Fgraph.db",[213,337,233],{"class":219},[213,339,304],{"class":219},[213,341,270],{"class":219},[213,343,344],{"class":273},"--tools",[213,346,233],{"class":219},[213,348,304],{"class":219},[213,350,270],{"class":219},[213,352,353],{"class":273},"core",[213,355,233],{"class":219},[213,357,358],{"class":219},"]\n",[213,360,362],{"class":215,"line":361},6,[213,363,364],{"class":219},"    }\n",[213,366,368],{"class":215,"line":367},7,[213,369,370],{"class":219},"  }\n",[213,372,374],{"class":215,"line":373},8,[213,375,376],{"class":219},"}\n",[141,378,379,382,383,385,386,389,390,168],{},[153,380,381],{},"--tools core"," lists a small set of tools; drop it to list all of them. A relative ",[153,384,326],{}," resolves from the client's working directory, usually the project root. The same entry ships as ",[153,387,388],{},".mcp.json"," in the repo, and the server is listed in the MCP Registry as ",[153,391,392],{},"io.github.cyberchronos00\u002Fcg-code-graph",[170,394,396],{"id":395},"run","Run",[204,398,402],{"className":399,"code":400,"language":401,"meta":209,"style":209},"language-bash shiki shiki-themes cg-light cg-light cg-dark","cg-mcp --db out\u002Fgraph.db --gates examples\u002Fbookstore.gates.json --plans examples\u002Fplans\n","bash",[153,403,404],{"__ignoreMap":209},[213,405,406,409,412,415,418,421,424],{"class":215,"line":216},[213,407,163],{"class":408},"sZJo5",[213,410,411],{"class":273}," --db",[213,413,414],{"class":273}," out\u002Fgraph.db",[213,416,417],{"class":273}," --gates",[213,419,420],{"class":273}," examples\u002Fbookstore.gates.json",[213,422,423],{"class":273}," --plans",[213,425,426],{"class":273}," examples\u002Fplans\n",[141,428,429,431,432,434,435,438,439,442,443,431,446,449,450,453,454,457,458,168],{},[153,430,326],{}," defaults to ",[153,433,335],{},". ",[153,436,437],{},"--root"," is the project root for a single-repo DB (the ",[153,440,441],{},"index"," tool). ",[153,444,445],{},"--plans",[153,447,448],{},"plans.dir"," in ",[153,451,452],{},".cg.yaml",", else ",[153,455,456],{},"\u003Crepo>\u002Fplans",". Flags: ",[153,459,460],{},"cg-mcp -h",[141,462,463,464,466,467,469,470,473,474,477,478,481,482,485,486,489,490,493,494,497,498,500,501,503,504,507,508,510],{},"One ",[153,465,163],{}," process can serve many graphs. Repeat ",[153,468,326],{}," (",[153,471,472],{},"NAME=PATH"," or a path), pass ",[153,475,476],{},"--db-dir"," (every ",[153,479,480],{},"*.db"," in that directory), or point at a registry file. The file is ",[153,483,484],{},"~\u002F.config\u002Fcg\u002Fgraphs.toml"," unless ",[153,487,488],{},"CG_GRAPHS"," or ",[153,491,492],{},"--graphs"," sets another path. Each entry has a name, a database path and one or more repo roots, so a combined graph (",[153,495,496],{},"cg link",") is one entry. With no ",[153,499,326],{}," on the command line, a registry file at the default path is loaded on its own. A single ",[153,502,326],{}," stays the one-graph server: replies have no ",[153,505,506],{},"graph"," field and tools do not gain a ",[153,509,506],{}," argument.",[204,512,516],{"className":513,"code":514,"language":515,"meta":209,"style":209},"language-toml shiki shiki-themes cg-light cg-light cg-dark","default = \"shop\"\n\n[[graphs]]\nname = \"shop\"\ndb = \"\u002Fabs\u002Fshop.db\"\nroots = [\"\u002Fabs\u002Fshop\"]\n\n[[graphs]]\nname = \"workspace\"\ndb = \"\u002Fabs\u002Fworkspace.db\"\nroots = [\"\u002Fabs\u002Fweb\", \"\u002Fabs\u002Fapi\"]\n","toml",[153,517,518,523,529,534,539,544,549,553,557,563,569],{"__ignoreMap":209},[213,519,520],{"class":215,"line":216},[213,521,522],{},"default = \"shop\"\n",[213,524,525],{"class":215,"line":223},[213,526,528],{"emptyLinePlaceholder":527},true,"\n",[213,530,531],{"class":215,"line":242},[213,532,533],{},"[[graphs]]\n",[213,535,536],{"class":215,"line":257},[213,537,538],{},"name = \"shop\"\n",[213,540,541],{"class":215,"line":282},[213,542,543],{},"db = \"\u002Fabs\u002Fshop.db\"\n",[213,545,546],{"class":215,"line":361},[213,547,548],{},"roots = [\"\u002Fabs\u002Fshop\"]\n",[213,550,551],{"class":215,"line":367},[213,552,528],{"emptyLinePlaceholder":527},[213,554,555],{"class":215,"line":373},[213,556,533],{},[213,558,560],{"class":215,"line":559},9,[213,561,562],{},"name = \"workspace\"\n",[213,564,566],{"class":215,"line":565},10,[213,567,568],{},"db = \"\u002Fabs\u002Fworkspace.db\"\n",[213,570,572],{"class":215,"line":571},11,[213,573,574],{},"roots = [\"\u002Fabs\u002Fweb\", \"\u002Fabs\u002Fapi\"]\n",[141,576,577,578,581,582,195,585,489,588,591,592,594,595,597,598,601,602,605,606,195,608,611,612,615,616,618,619,622,623,625],{},"The ",[153,579,580],{},"graphs"," tool lists name, roots, languages, indexed commit and freshness (",[153,583,584],{},"fresh",[153,586,587],{},"stale",[153,589,590],{},"unknown","). It is part of ",[153,593,381],{},". Every other tool takes an optional ",[153,596,506],{}," name. Omit it and the server resolves, in order: a path in the call, then MCP roots (",[153,599,600],{},"roots\u002Flist",") or the working directory, then the configured default. When several graphs match and one graph's roots contain the others, that graph is selected. Otherwise, if exactly one matching graph's roots are only the repo that contains the path (its own graph, not a combined graph that also includes that repo), that graph is selected. Otherwise the configured default is used when it is one of the matches. If none of those applies, the reply lists the choices and does not guess. From a shared ",[153,603,604],{},"backend"," directory, with ",[153,607,604],{},[153,609,610],{},"appA+backend"," and ",[153,613,614],{},"appB+backend"," registered, the server selects ",[153,617,604],{},". Replies from a multi-graph server start with ",[153,620,621],{},"graph \u003Cname>"," and the structured result includes ",[153,624,506],{},". Each call opens only the database it resolved, so registered graphs that nobody queries are not opened.",[141,627,628,629,632,633,636,637,489,639,642,643,645,646,648,649,652],{},"A registry entry may set ",[153,630,631],{},"tools"," (written by ",[153,634,635],{},"cg install --migrate"," from that host's ",[153,638,344],{},[153,640,641],{},"CG_MCP_TOOLS","). The process still lists one tool set: the server's ",[153,644,344],{}," when it is set, otherwise the union of those allowlists. A graph with no ",[153,647,631],{}," value keeps every listed tool. A call that resolves to a graph whose allowlist omits the tool returns ",[153,650,651],{},"tool \u003Cname> is not allowed for graph \u003Cname>"," and does not run. One graph's shorter allowlist does not remove tools from the other graphs.",[141,654,655,658,659,662,663,665,666,668,669,672,673,676,677,680],{},[153,656,657],{},"cg install --global --registry"," writes one ",[153,660,661],{},"cg"," entry with no ",[153,664,326],{},", which reads that registry. ",[153,667,635],{}," prints how existing per-repo ",[153,670,671],{},"cg-*"," entries would fold into the registry; ",[153,674,675],{},"--apply"," writes the registry and the host config and keeps a ",[153,678,679],{},".bak"," of each file it changes.",[170,682,683],{"id":631},"Tools",[685,686,687,700],"table",{},[688,689,690],"thead",{},[691,692,693,697],"tr",{},[694,695,696],"th",{},"tool",[694,698,699],{},"what it returns",[701,702,703,714,736,750,764,774,784,794,804,818,828,842,884,897,907,932,945,957,969,982,994,1009,1019,1032,1045,1065,1079,1091,1105,1118,1131,1141,1151],"tbody",{},[691,704,705,711],{},[706,707,708],"td",{},[153,709,710],{},"explore",[706,712,713],{},"start here for a broad question: matching symbols' source, entry points, call paths and blast radius, within a token budget",[691,715,716,721],{},[706,717,718],{},[153,719,720],{},"reaches",[706,722,723,724,727,728,469,731,735],{},"what depends on the targets, grouped by entry classification; ",[153,725,726],{},"connection"," keeps one database connection and an edge on another one shows ",[153,729,730],{},"conn=\u003Cname>",[145,732,734],{"href":733},"\u002Fdocs\u002Fcli#database-connections","connections",")",[691,737,738,743],{},[706,739,740],{},[153,741,742],{},"impact",[706,744,745,746,749],{},"callers of a method up to entry points; overrides listed apart from callers; a ",[153,747,748],{},"connections:"," line when the method uses a non-default database connection",[691,751,752,757],{},[706,753,754],{},[153,755,756],{},"callers",[706,758,759,760,763],{},"direct callers; ",[153,761,762],{},"ref@file:line"," when code takes the function as a value",[691,765,766,771],{},[706,767,768],{},[153,769,770],{},"siblings",[706,772,773],{},"hierarchy, the same method on sibling classes, shared resources",[691,775,776,781],{},[706,777,778],{},[153,779,780],{},"downstream",[706,782,783],{},"forward dependencies (calls, HTTP, routes, tables)",[691,785,786,791],{},[706,787,788],{},[153,789,790],{},"path",[706,792,793],{},"one shortest evidence chain between two specs",[691,795,796,801],{},[706,797,798],{},[153,799,800],{},"node",[706,802,803],{},"one node and its edges; an ambiguous name lists candidates",[691,805,806,811],{},[706,807,808],{},[153,809,810],{},"snippet",[706,812,813,814,817],{},"that symbol's source: ",[153,815,816],{},"path:start-end",", then numbered lines",[691,819,820,825],{},[706,821,822],{},[153,823,824],{},"search",[706,826,827],{},"name \u002F FQN substring, plus route guard and auth names",[691,829,830,835],{},[706,831,832],{},[153,833,834],{},"routes",[706,836,837,838,735],{},"routes with guards; filter by writes, reaches, missing or unguarded (",[145,839,841],{"href":840},"\u002Fdocs\u002Fcli#routes-and-guards","routes and guards",[691,843,844,853],{},[706,845,846,849,850],{},[153,847,848],{},"writers"," \u002F ",[153,851,852],{},"readers",[706,854,855,856,195,859,862,863,195,866,869,870,849,873,469,876,880,881,883],{},"writers or readers of a table, a column (",[153,857,858],{},"table.column",[153,860,861],{},"column:table.column",") or a stored property (",[153,864,865],{},"Type.prop",[153,867,868],{},"Class::$prop","); the same specs, groups and errors as ",[153,871,872],{},"cg writers",[153,874,875],{},"cg readers",[145,877,879],{"href":878},"\u002Fdocs\u002Fcli#readers-and-writers-specs","spec forms","); ",[153,882,726],{}," keeps one database connection",[691,885,886,891],{},[706,887,888],{},[153,889,890],{},"roundtrip",[706,892,893,894,896],{},"heuristic: a lossy write of ",[153,895,865],{}," read back into UI state",[691,898,899,904],{},[706,900,901],{},[153,902,903],{},"lint_async_state",[706,905,906],{},"heuristic async-state lints",[691,908,909,914],{},[706,910,911],{},[153,912,913],{},"api_calls",[706,915,916,917,920,921,489,924,927,928,931],{},"client HTTP calls, request keys and the matched route. ",[153,918,919],{},"route:VERB \u002Fpath"," matches that route only (exact; ",[153,922,923],{},"*",[153,925,926],{},"route:*"," widens). An unknown route returns ",[153,929,930],{},"no such route"," and the nearest routes",[691,933,934,939],{},[706,935,936],{},[153,937,938],{},"channels",[706,940,941,942,735],{},"broadcast channels (",[145,943,944],{"href":23},"Channels and tests",[691,946,947,952],{},[706,948,949],{},[153,950,951],{},"bridges",[706,953,954,955,735],{},"web \u002F native bridge endpoints (",[145,956,18],{"href":19},[691,958,959,964],{},[706,960,961],{},[153,962,963],{},"protocol_links",[706,965,966,967,735],{},"protocol endpoints and their checks (",[145,968,91],{"href":92},[691,970,971,976],{},[706,972,973],{},[153,974,975],{},"llm_tools",[706,977,978,979,735],{},"LLM and MCP tools, resources and prompts (",[145,980,981],{"href":11},"AI tools",[691,983,984,989],{},[706,985,986],{},[153,987,988],{},"external_systems",[706,990,991,992,735],{},"databases, caches, brokers and other hosts (",[145,993,38],{"href":39},[691,995,996,1001],{},[706,997,998],{},[153,999,1000],{},"attack_surface",[706,1002,1003,1004,469,1007,735],{},"findings and the inbound \u002F outbound surface; same filters as ",[153,1005,1006],{},"cg surface",[145,1008,107],{"href":108},[691,1010,1011,1016],{},[706,1012,1013],{},[153,1014,1015],{},"tests_covering",[706,1017,1018],{},"tests that reach a symbol, route or table",[691,1020,1021,1026],{},[706,1022,1023],{},[153,1024,1025],{},"affected",[706,1027,1028,1029,735],{},"tests and entry points reached by changed files or a git diff (",[145,1030,26],{"href":1031},"\u002Fdocs\u002Fcli#affected",[691,1033,1034,1039],{},[706,1035,1036],{},[153,1037,1038],{},"resolutions",[706,1040,1041,1042,735],{},"where a concept's value is decided (",[145,1043,1044],{"href":128},"Value facts",[691,1046,1047,1062],{},[706,1048,1049,1052,1053,1052,1056,1052,1059],{},[153,1050,1051],{},"plan_list"," ",[153,1054,1055],{},"plan_load",[153,1057,1058],{},"plan_validate",[153,1060,1061],{},"plan_baseline",[706,1063,1064],{},"plan files under the plans directory",[691,1066,1067,1072],{},[706,1068,1069],{},[153,1070,1071],{},"plan_check",[706,1073,1074,1075,1078],{},"compact plan report; ",[153,1076,1077],{},"details=true"," adds file:line and chains",[691,1080,1081,1085],{},[706,1082,1083],{},[153,1084,441],{},[706,1086,1087,1088,1090],{},"re-index into temp files, then swap the DBs; ",[153,1089,452],{}," is re-read",[691,1092,1093,1098],{},[706,1094,1095],{},[153,1096,1097],{},"doctor",[706,1099,1100,1101,1104],{},"the ",[153,1102,1103],{},"cg doctor"," report; no graph needed",[691,1106,1107,1112],{},[706,1108,1109],{},[153,1110,1111],{},"coverage",[706,1113,1114,1115,735],{},"languages, files, blind spots (",[145,1116,1117],{"href":31},"Completeness",[691,1119,1120,1128],{},[706,1121,1122,849,1125],{},[153,1123,1124],{},"platforms",[153,1126,1127],{},"platform_divergence",[706,1129,1130],{},"build targets, and variants that leave one uncovered",[691,1132,1133,1138],{},[706,1134,1135],{},[153,1136,1137],{},"starters",[706,1139,1140],{},"starter queries that resolve to nodes in this graph",[691,1142,1143,1148],{},[706,1144,1145],{},[153,1146,1147],{},"stats",[706,1149,1150],{},"node and edge counts",[691,1152,1153,1157],{},[706,1154,1155],{},[153,1156,580],{},[706,1158,1159],{},"registered graphs: name, roots, languages, indexed commit, freshness",[141,1161,1162,1163,1166,1167,195,1169,195,1171,195,1173,195,1175,611,1177,1179,1180,469,1183,195,1186,195,1189,195,1192,195,1195,195,1198,1201,1202,1206,1207,1210,1211,1166,1215,1217,1218,489,1221,1224,1225,1227,1228,1231],{},"Argument lists match the CLI (",[153,1164,1165],{},"cg \u003Ccmd> -h","). ",[153,1168,720],{},[153,1170,742],{},[153,1172,780],{},[153,1174,790],{},[153,1176,834],{},[153,1178,824],{}," take ",[153,1181,1182],{},"platform",[153,1184,1185],{},"windows",[153,1187,1188],{},"linux",[153,1190,1191],{},"macos",[153,1193,1194],{},"ios",[153,1196,1197],{},"android",[153,1199,1200],{},"web","). Rust and C \u002F C++ specs: ",[145,1203,1205],{"href":1204},"\u002Fdocs\u002Fnative#query-specs","Rust, C and C++ query specs",". On a combined graph, ",[153,1208,1209],{},"repo:Class.method"," selects one repo (",[145,1212,1214],{"href":1213},"\u002Fdocs\u002Fcli#workspace","workspace linking",[153,1216,441],{}," with no arguments re-indexes every linked repo (two or more) and rebuilds the one combined link; ",[153,1219,1220],{},"repo",[153,1222,1223],{},"root"," narrows it. A root that matches nothing, an unknown repo, or a result with 0 nodes is refused and the current graph stays. ",[153,1226,710],{}," ends with the fine-grained calls to make next (",[145,1229,26],{"href":1230},"\u002Fdocs\u002Fcli#explore",").",[141,1233,1234],{},"Paths in replies are repo-relative. An empty result says why and suggests the next call.",[170,1236,1237],{"id":1111},"Coverage",[141,1239,1240,1242,1243,1246],{},[153,1241,1111],{}," (and ",[153,1244,1245],{},"cg coverage",") reports parser mode, file counts and blind spots. Three consequences for other tools:",[1248,1249,1250,1269,1272],"ul",{},[178,1251,1252,195,1254,195,1256,195,1258,195,1260,611,1262,1264,1265,1268],{},[153,1253,834],{},[153,1255,742],{},[153,1257,756],{},[153,1259,720],{},[153,1261,1015],{},[153,1263,1071],{}," add one ",[153,1266,1267],{},"coverage note:"," when a blind spot could affect that answer.",[178,1270,1271],{},"An empty reply or an unknown symbol ends with a coverage line for the whole index.",[178,1273,1274,1275,1278,1279,1282,1283,1286],{},"Every reply includes a ",[153,1276,1277],{},"completeness"," object (",[153,1280,1281],{},"complete",", per-language counts, ",[153,1284,1285],{},"blind_spots",") so the agent can fall back to search without parsing the prose.",[141,1288,1289,1290,168],{},"Where the answer is not complete, use normal search and file reading for that part. Sample replies: ",[145,1291,1292],{"href":68},"MCP sample outputs",[170,1294,1296],{"id":1295},"staleness","Staleness",[141,1298,1299,1300,1303,1304,1307,1308,1311,1312,1315,1316,1319,1320,1322,1323,1326,1327,611,1329,1331,1332,1334,1335,1338,1339,1231],{},"When the working tree has changed since this graph was built, tool replies add one ",[153,1301,1302],{},"index note:"," line and the structured content includes ",[153,1305,1306],{},"stale: true",". The check compares ",[153,1309,1310],{},"\u003Cdb>.refresh.state"," (the fingerprint of paths, mtimes and sizes that ",[153,1313,1314],{},"cg refresh"," stored, plus the database mtime) with the current tree. File contents are not hashed. A database built by ",[153,1317,1318],{},"cg index"," or the ",[153,1321,441],{}," tool has no state file, so any listed file newer than the database counts. Paths come from one ",[153,1324,1325],{},"git ls-files"," call. The result is cached for 5 seconds. ",[153,1328,441],{},[153,1330,1097],{}," skip the check. A combined graph (",[153,1333,496],{},") is not checked. ",[153,1336,1337],{},"CG_NO_STALE_CHECK=1"," turns the check off (",[145,1340,34],{"href":1341},"\u002Fdocs\u002Fconfiguration#environment-variables",[170,1343,1345],{"id":1344},"install-into-a-host","Install into a host",[141,1347,1348,1351,1352,434,1354,1357,1358,1361,1362,1365,1366,1369,1370,1372],{},[153,1349,1350],{},"cg install"," registers this server under the key ",[153,1353,661],{},[153,1355,1356],{},"cg uninstall"," removes that entry. Both preview a unified diff and ask before writing (",[153,1359,1360],{},"--yes"," skips the prompt, ",[153,1363,1364],{},"--dry-run"," writes nothing). A second install with the same entry prints ",[153,1367,1368],{},"no change (cg already registered)",". The edit affects only the ",[153,1371,661],{}," member, and install then uninstall leaves the file byte-identical.",[141,1374,1375,1376,489,1379,1382],{},"Two known edges: a file that was already ",[153,1377,1378],{},"{}",[153,1380,1381],{},"{\"mcpServers\": {}}"," is deleted or collapsed by uninstall, and a TOML file without a final newline gains one.",[141,1384,1385,1386,1388,1389,1391,1392,1394,1395,1398,1399,1401,1402,434,1404,1407,1408,1411,1412,1414,1415,1418,1419,1421,1422,1424,1425,1428,1429,1431,1432,1434],{},"The command is the absolute ",[153,1387,163],{}," next to the Python that is running ",[153,1390,661],{}," (so a venv, pipx or uv tool wins over an older ",[153,1393,163],{}," on ",[153,1396,1397],{},"PATH","), and ",[153,1400,326],{}," is the absolute graph path. Project scope also passes ",[153,1403,437],{},[153,1405,1406],{},"--portable"," writes the relative entry below instead, for a config committed to git. ",[153,1409,1410],{},"--global"," without ",[153,1413,326],{}," exits 2: a global entry serves one graph. ",[153,1416,1417],{},"--global --registry"," is the exception: one ",[153,1420,661],{}," entry and no ",[153,1423,326],{},", for a server that reads the graph registry. ",[153,1426,1427],{},"--migrate"," (dry run; ",[153,1430,675],{}," writes) folds per-repo ",[153,1433,671],{}," entries into that registry.",[204,1436,1438],{"className":206,"code":1437,"language":208,"meta":209,"style":209},"{\"mcpServers\": {\"cg\": {\n  \"command\": \"cg-mcp\",\n  \"args\": [\"--db\", \"out\u002Fgraph.db\"]}}}\n",[153,1439,1440,1466,1484],{"__ignoreMap":209},[213,1441,1442,1445,1447,1449,1451,1453,1456,1458,1460,1462,1464],{"class":215,"line":216},[213,1443,1444],{"class":219},"{",[213,1446,233],{"class":219},[213,1448,230],{"class":229},[213,1450,233],{"class":219},[213,1452,236],{"class":219},[213,1454,1455],{"class":219}," {",[213,1457,233],{"class":219},[213,1459,661],{"class":229},[213,1461,233],{"class":219},[213,1463,236],{"class":219},[213,1465,239],{"class":219},[213,1467,1468,1470,1472,1474,1476,1478,1480,1482],{"class":215,"line":223},[213,1469,226],{"class":219},[213,1471,263],{"class":229},[213,1473,233],{"class":219},[213,1475,236],{"class":219},[213,1477,270],{"class":219},[213,1479,163],{"class":273},[213,1481,233],{"class":219},[213,1483,279],{"class":219},[213,1485,1486,1488,1490,1492,1494,1496,1498,1500,1502,1504,1506,1508,1510],{"class":215,"line":242},[213,1487,226],{"class":219},[213,1489,287],{"class":229},[213,1491,233],{"class":219},[213,1493,236],{"class":219},[213,1495,294],{"class":219},[213,1497,233],{"class":219},[213,1499,326],{"class":273},[213,1501,233],{"class":219},[213,1503,304],{"class":219},[213,1505,270],{"class":219},[213,1507,335],{"class":273},[213,1509,233],{"class":219},[213,1511,1512],{"class":219},"]}}}\n",[141,1514,1515,1516,611,1519,1521,1522,1524,1525,1527,1528,1530,1531,1533],{},"Add ",[153,1517,1518],{},"--gates",[153,1520,445],{}," on the manual command when you use them. An older ",[153,1523,248],{}," key whose command is ",[153,1526,163],{}," is reported at install time; ",[153,1529,1356],{}," removes it. A ",[153,1532,248],{}," entry that is not cg is left alone.",[141,1535,1536,1537,1540,1541,1543,1544,1546,1547,1549],{},"Codex reads ",[153,1538,1539],{},"\u003Croot>\u002F.codex\u002Fconfig.toml"," only in trusted projects. ",[153,1542,1103],{}," lists every host where ",[153,1545,661],{}," (or a cg-owned ",[153,1548,248],{}," key) is registered, and says when the command or the database is missing.",[685,1551,1552,1575],{},[688,1553,1554],{},[691,1555,1556,1561,1568,1573],{},[694,1557,1558],{},[153,1559,1560],{},"--host",[694,1562,1563,1564,1567],{},"project (",[153,1565,1566],{},"--project",", default)",[694,1569,1570,1571,735],{},"global (",[153,1572,1410],{},[694,1574,7],{},[701,1576,1577,1601,1630,1658,1687,1716,1738,1762],{},[691,1578,1579,1584,1589,1594],{},[706,1580,1581],{},[153,1582,1583],{},"cursor",[706,1585,1586],{},[153,1587,1588],{},"\u003Croot>\u002F.cursor\u002Fmcp.json",[706,1590,1591],{},[153,1592,1593],{},"~\u002F.cursor\u002Fmcp.json",[706,1595,1596],{},[145,1597,1600],{"href":1598,"rel":1599},"https:\u002F\u002Fcursor.com\u002Fdocs\u002Fcontext\u002Fmcp",[149],"Cursor",[691,1602,1603,1607,1612,1623],{},[706,1604,1605],{},[153,1606,194],{},[706,1608,1609],{},[153,1610,1611],{},"\u003Croot>\u002F.mcp.json",[706,1613,1614,1617,1618,1620,1621,735],{},[153,1615,1616],{},"claude mcp add-json"," (user scope; ",[153,1619,194],{}," must be on ",[153,1622,1397],{},[706,1624,1625],{},[145,1626,1629],{"href":1627,"rel":1628},"https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fmcp",[149],"Claude Code",[691,1631,1632,1637,1640,1651],{},[706,1633,1634],{},[153,1635,1636],{},"claude-desktop",[706,1638,1639],{},"global only",[706,1641,1642,1643,1646,1647,1650],{},"macOS ",[153,1644,1645],{},"~\u002FLibrary\u002FApplication Support\u002FClaude\u002Fclaude_desktop_config.json","; Windows ",[153,1648,1649],{},"%APPDATA%\\Claude\\claude_desktop_config.json","; no Linux build",[706,1652,1653],{},[145,1654,1657],{"href":1655,"rel":1656},"https:\u002F\u002Fmodelcontextprotocol.io\u002Fquickstart",[149],"Claude Desktop",[691,1659,1660,1664,1672,1680],{},[706,1661,1662],{},[153,1663,201],{},[706,1665,1666,469,1669,735],{},[153,1667,1668],{},"\u003Croot>\u002F.vscode\u002Fmcp.json",[153,1670,1671],{},"servers",[706,1673,1674,453,1677],{},[153,1675,1676],{},"$COPILOT_HOME\u002Fmcp-config.json",[153,1678,1679],{},"~\u002F.copilot\u002Fmcp-config.json",[706,1681,1682],{},[145,1683,1686],{"href":1684,"rel":1685},"https:\u002F\u002Fcode.visualstudio.com\u002Fdocs\u002Fcopilot\u002Freference\u002Fmcp-configuration",[149],"VS Code",[691,1688,1689,1694,1696,1709],{},[706,1690,1691],{},[153,1692,1693],{},"windsurf",[706,1695,1639],{},[706,1697,1698,1701,1702,1705,1706],{},[153,1699,1700],{},"$XDG_CONFIG_HOME\u002Fdevin\u002Fmcp_config.json"," (else ",[153,1703,1704],{},"~\u002F.config\u002Fdevin\u002F…","); Windows ",[153,1707,1708],{},"%APPDATA%\\devin\\mcp_config.json",[706,1710,1711],{},[145,1712,1715],{"href":1713,"rel":1714},"https:\u002F\u002Fdocs.windsurf.com\u002Fwindsurf\u002Fcascade\u002Fmcp",[149],"Windsurf",[691,1717,1718,1722,1726,1731],{},[706,1719,1720],{},[153,1721,198],{},[706,1723,1724],{},[153,1725,1539],{},[706,1727,1728],{},[153,1729,1730],{},"~\u002F.codex\u002Fconfig.toml",[706,1732,1733],{},[145,1734,1737],{"href":1735,"rel":1736},"https:\u002F\u002Fdevelopers.openai.com\u002Fcodex\u002Fmcp",[149],"Codex",[691,1739,1740,1745,1750,1755],{},[706,1741,1742],{},[153,1743,1744],{},"gemini",[706,1746,1747],{},[153,1748,1749],{},"\u003Croot>\u002F.gemini\u002Fsettings.json",[706,1751,1752],{},[153,1753,1754],{},"~\u002F.gemini\u002Fsettings.json",[706,1756,1757],{},[145,1758,1761],{"href":1759,"rel":1760},"https:\u002F\u002Fgeminicli.com\u002Fdocs\u002Ftools\u002Fmcp-server",[149],"Gemini CLI",[691,1763,1764,1769,1774,1780],{},[706,1765,1766],{},[153,1767,1768],{},"zed",[706,1770,1771],{},[153,1772,1773],{},"\u003Croot>\u002F.zed\u002Fsettings.json",[706,1775,1776,1779],{},[153,1777,1778],{},"~\u002F.config\u002Fzed\u002Fsettings.json"," (macOS and Linux)",[706,1781,1782],{},[145,1783,1786],{"href":1784,"rel":1785},"https:\u002F\u002Fzed.dev\u002Fdocs\u002Fai\u002Fmcp",[149],"Zed",[141,1788,1789,1790,1792,1793,1394,1795,1797,1798,1801,1802,168],{},"Without ",[153,1791,1560],{},", cg acts on hosts it can see (the config file or its directory, or ",[153,1794,194],{},[153,1796,1397],{}," for Claude Code's user scope) and prints ",[153,1799,1800],{},"detected: …",". Flags and exit codes: ",[145,1803,1805],{"href":1804},"\u002Fdocs\u002Fcli#install","install",[141,1807,1808,1809,1811,1812,195,1814,611,1816,1818,1819,1821,1822,1825,1826,1829,1830,1833,1834,1837,1838,1841,1842,1845,1846,1848,1849,1852,1853,1855],{},"Agent rules: project-scope ",[153,1810,1350],{}," also writes a short \"use cg first\" rule (use ",[153,1813,824],{},[153,1815,742],{},[153,1817,810],{}," before grep or opening whole files, ",[153,1820,580],{}," when unsure which graph) to two places: a ",[153,1823,1824],{},"\u003C!-- cg:start --> … \u003C!-- cg:end -->"," section in ",[153,1827,1828],{},"AGENTS.md",", which Claude Code, Codex and other agents read, and ",[153,1831,1832],{},".cursor\u002Frules\u002Fcg.mdc"," with ",[153,1835,1836],{},"alwaysApply: true",". Both appear in the preview, and the output names each file written. A re-run replaces only the marked section, so it never duplicates the rule and keeps everything else in the file. An existing ",[153,1839,1840],{},"cg.mdc"," without front matter gets the ",[153,1843,1844],{},"alwaysApply"," header added once in front. ",[153,1847,1356],{}," removes the section and deletes a file that held nothing else. ",[153,1850,1851],{},"--no-rules"," skips both files. ",[153,1854,1410],{}," never writes them.",[141,1857,1858,1861,1862,195,1864,489,1867,1869,1870,1873,1874,1876,1877,191,1880,1166,1883,1886,1887,168],{},[153,1859,1860],{},"cg agents install"," writes a short cg reading-rules block into ",[153,1863,1828],{},[153,1865,1866],{},"CLAUDE.md",[153,1868,1832],{},". It previews the change and asks before writing. ",[153,1871,1872],{},"--mcp"," edits only the ",[153,1875,661],{}," entry in ",[153,1878,1879],{},".cursor\u002Fmcp.json",[153,1881,1882],{},"--mcp-file",[153,1884,1885],{},"cg agents remove"," takes it back out. See ",[153,1888,1889],{},"cg agents -h",[170,1891,1893],{"id":1892},"choosing-tools","Choosing tools",[141,1895,1896,611,1898,1901],{},[153,1897,641],{},[153,1899,1900],{},"cg-mcp --tools"," choose which tools are listed. Unset or empty means all of them. Items are separated by commas or spaces:",[1248,1903,1904,1935,1946],{},[178,1905,1906,1908,1909,195,1911,195,1913,195,1915,195,1917,195,1919,195,1921,195,1923,195,1925,195,1927,195,1929,195,1931,195,1933],{},[153,1907,353],{}," is ",[153,1910,710],{},[153,1912,824],{},[153,1914,800],{},[153,1916,810],{},[153,1918,742],{},[153,1920,720],{},[153,1922,756],{},[153,1924,834],{},[153,1926,780],{},[153,1928,790],{},[153,1930,1111],{},[153,1932,441],{},[153,1934,580],{},[178,1936,1937,1938,1941,1942,1945],{},"a name or an ",[153,1939,1940],{},"fnmatch"," glob (",[153,1943,1944],{},"plan_*",") adds tools",[178,1947,1948,1949,1952,1953,735],{},"a leading ",[153,1950,1951],{},"-"," removes them (",[153,1954,1955],{},"all,-plan_*",[141,1957,1958,1959,1961,1962,1965,1966,1969,1970,1973,1974,1976],{},"An unknown name is ignored after one warning. If the selection is empty, ",[153,1960,163],{}," exits 2. Codex ",[153,1963,1964],{},"enabled_tools"," and Gemini ",[153,1967,1968],{},"includeTools"," can filter again on the host side. ",[153,1971,1972],{},"cg install --tools LIST"," stores the same list in the host entry. Per-graph ",[153,1975,631],{}," in the registry narrows calls for that graph only; the listed set stays the union (or this server-wide list, when it is set).",[170,1978,1980],{"id":1979},"server-instructions","Server instructions",[141,1982,577,1983,1986,1987,1989,1990,849,1992,1994,1995,1997,1998,2000,2001,168],{},[153,1984,1985],{},"initialize"," result carries short instructions (under 600 characters): use cg before grep or opening files, ",[153,1988,824],{}," to find a symbol, ",[153,1991,742],{},[153,1993,720],{}," before editing, ",[153,1996,810],{}," instead of whole files, ",[153,1999,580],{}," when unsure, and normal search only for what cg reports as not covered. Each core tool's description opens with when to use it. The full reference (stacks, spec forms, per-feature notes) is the resource ",[153,2002,2003],{},"cg:\u002F\u002Fguide",[170,2005,2007],{"id":2006},"suggested-agent-instructions","Suggested agent instructions",[204,2009,2014],{"className":2010,"code":2012,"language":2013,"meta":209},[2011],"language-text","Before changing code that affects a table, column, DB connection, config key or route, call the code-graph MCP tools:\n- reaches(\u003Ctarget>) for every function and entry point that depends on it;\n- impact(\u003CClass::method>) before editing a method, and siblings(\u003CClass::method>) for parallel paths;\n- routes(writes=\"*\", unguarded=true) or routes(reaches=[\u003Ctarget>]) for guards;\n- for a planned feature, write plans\u002F\u003Cname>.yaml, then plan_check(\u003Cname>) and resolve every MISSING FROM PLAN item.\nQuote the file:line evidence. Re-run index after editing.\nIf coverage() or a coverage note says a language or file is not covered, use normal search for that part.\n","text",[153,2015,2012],{"__ignoreMap":209},[2017,2018,2019],"style",{},"html pre.shiki code .sZ_TN, html code.shiki .sZ_TN{--shiki-light:#71717A;--shiki-default:#71717A;--shiki-dark:#A1A1AA}html pre.shiki code .sbOAO, html code.shiki .sbOAO{--shiki-light:#3F6212;--shiki-default:#3F6212;--shiki-dark:#A3E635}html pre.shiki code .sha9Y, html code.shiki .sha9Y{--shiki-light:#9F8CFF;--shiki-default:#9F8CFF;--shiki-dark:#C4B5FD}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sZJo5, html code.shiki .sZJo5{--shiki-light:#65A30D;--shiki-default:#65A30D;--shiki-dark:#84CC16}",{"title":209,"searchDepth":257,"depth":223,"links":2021},[2022,2023,2024,2025,2026,2027,2028,2029,2030],{"id":172,"depth":223,"text":173},{"id":395,"depth":223,"text":396},{"id":631,"depth":223,"text":683},{"id":1111,"depth":223,"text":1237},{"id":1295,"depth":223,"text":1296},{"id":1344,"depth":223,"text":1345},{"id":1892,"depth":223,"text":1893},{"id":1979,"depth":223,"text":1980},{"id":2006,"depth":223,"text":2007},"code-graph ships a stdio Model Context Protocol server. An agent gets callers, entry points and file:line evidence from the graph. It needs the mcp Python SDK (2.x). Use the installed cg-mcp command from Install.","md",{},{"title":62,"description":2031},"KLThm6CONzKs3EjO4KJ2C_WGN02xc1hkbIjtU_VAuao",[2037,2039],{"title":58,"path":59,"stem":60,"description":2038,"children":-1},"code-graph is beta. This page is the cross-cutting ceiling: how far an answer reaches when the graph is incomplete.\nLanguage gaps are on the language pages, linked at the end.",{"title":67,"path":68,"stem":69,"description":2040,"children":-1},"Server: code-graph, DB: combined graph of examples\u002Fbookstore-api + examples\u002Fbookstore-web. Generated by tests\u002Fmcp_e2e.py. Volatile values (index timestamps and durations) are replaced by placeholders, so regenerating the file on unchanged code gives identical bytes.",1792170232406]