orgraph-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- orgraph_mcp-0.1.0/.github/workflows/release.yml +178 -0
- orgraph_mcp-0.1.0/.gitignore +24 -0
- orgraph_mcp-0.1.0/AGENTS.md +133 -0
- orgraph_mcp-0.1.0/CHANGELOG.md +14 -0
- orgraph_mcp-0.1.0/LICENSE +21 -0
- orgraph_mcp-0.1.0/PKG-INFO +85 -0
- orgraph_mcp-0.1.0/README.md +46 -0
- orgraph_mcp-0.1.0/orgraph/__init__.py +3 -0
- orgraph_mcp-0.1.0/orgraph/_vendor/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/_vendor/cache.py +475 -0
- orgraph_mcp-0.1.0/orgraph/_vendor/cluster.py +272 -0
- orgraph_mcp-0.1.0/orgraph/_vendor/extract.py +12390 -0
- orgraph_mcp-0.1.0/orgraph/_vendor/mcp_ingest.py +402 -0
- orgraph_mcp-0.1.0/orgraph/cli.py +348 -0
- orgraph_mcp-0.1.0/orgraph/eval/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/eval/fixtures/codewiki_gt.json +156 -0
- orgraph_mcp-0.1.0/orgraph/eval/ground_truth.py +44 -0
- orgraph_mcp-0.1.0/orgraph/eval/metrics.py +88 -0
- orgraph_mcp-0.1.0/orgraph/eval/runner.py +116 -0
- orgraph_mcp-0.1.0/orgraph/extract/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/extract/manifest.py +84 -0
- orgraph_mcp-0.1.0/orgraph/extract/scip.py +298 -0
- orgraph_mcp-0.1.0/orgraph/extract/scip_pb2.py +2456 -0
- orgraph_mcp-0.1.0/orgraph/extract/treesitter.py +207 -0
- orgraph_mcp-0.1.0/orgraph/extract/types.py +49 -0
- orgraph_mcp-0.1.0/orgraph/graph/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/graph/builder.py +224 -0
- orgraph_mcp-0.1.0/orgraph/graph/kuzu.py +40 -0
- orgraph_mcp-0.1.0/orgraph/graph/schema.py +158 -0
- orgraph_mcp-0.1.0/orgraph/installer/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/installer/agents.py +136 -0
- orgraph_mcp-0.1.0/orgraph/installer/config.py +123 -0
- orgraph_mcp-0.1.0/orgraph/installer/installer.py +181 -0
- orgraph_mcp-0.1.0/orgraph/mcp/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/mcp/server.py +62 -0
- orgraph_mcp-0.1.0/orgraph/mcp/tools.py +564 -0
- orgraph_mcp-0.1.0/orgraph/search/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/search/index.py +36 -0
- orgraph_mcp-0.1.0/orgraph/topology/__init__.py +0 -0
- orgraph_mcp-0.1.0/orgraph/topology/call_graph.py +193 -0
- orgraph_mcp-0.1.0/orgraph/topology/cluster.py +196 -0
- orgraph_mcp-0.1.0/orgraph/topology/context.py +150 -0
- orgraph_mcp-0.1.0/orgraph/topology/serialise.py +87 -0
- orgraph_mcp-0.1.0/orgraph/topology/topology.py +348 -0
- orgraph_mcp-0.1.0/pyproject.toml +62 -0
- orgraph_mcp-0.1.0/tests/__init__.py +0 -0
- orgraph_mcp-0.1.0/tests/fixtures/__init__.py +0 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/auth.py +12 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/graphify-out/cache/ast/vunknown/764858f200bbb9b2050da8330d35d55eda8925f964d6d7b1798300f6ccdb6679.json +1 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/graphify-out/cache/ast/vunknown/912efd76e7217d029653055aedc38a2f173d4dc352ef9507a7ac1655fd176e54.json +1 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/graphify-out/cache/ast/vunknown/b3a9179a8afe616b559404e30036c3c59af11f6dabb7cbcc8269a3ad588aebfc.json +1 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/graphify-out/cache/stat-index.json +1 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/handlers.py +20 -0
- orgraph_mcp-0.1.0/tests/fixtures/simple_python/models.py +23 -0
- orgraph_mcp-0.1.0/tests/test_eval.py +225 -0
- orgraph_mcp-0.1.0/tests/test_extract.py +75 -0
- orgraph_mcp-0.1.0/tests/test_graph.py +75 -0
- orgraph_mcp-0.1.0/tests/test_mcp_tools.py +170 -0
- orgraph_mcp-0.1.0/tests/test_search.py +92 -0
- orgraph_mcp-0.1.0/tests/test_topology.py +118 -0
- orgraph_mcp-0.1.0/uv.lock +2186 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: release-${{ github.ref }}
|
|
11
|
+
cancel-in-progress: false
|
|
12
|
+
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
|
|
16
|
+
jobs:
|
|
17
|
+
plan-release:
|
|
18
|
+
name: Plan release
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
outputs:
|
|
21
|
+
version: ${{ steps.version.outputs.version }}
|
|
22
|
+
tag: ${{ steps.version.outputs.tag }}
|
|
23
|
+
should_release: ${{ steps.check.outputs.should_release }}
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
with:
|
|
27
|
+
fetch-depth: 0
|
|
28
|
+
|
|
29
|
+
- uses: actions/setup-python@v5
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Read package version
|
|
34
|
+
id: version
|
|
35
|
+
run: |
|
|
36
|
+
python - <<'PY'
|
|
37
|
+
import tomllib
|
|
38
|
+
from pathlib import Path
|
|
39
|
+
data = tomllib.loads(Path("pyproject.toml").read_text())
|
|
40
|
+
version = data["project"]["version"]
|
|
41
|
+
tag = f"v{version}"
|
|
42
|
+
github_output = Path(__import__("os").environ["GITHUB_OUTPUT"])
|
|
43
|
+
with github_output.open("a") as fh:
|
|
44
|
+
fh.write(f"version={version}\n")
|
|
45
|
+
fh.write(f"tag={tag}\n")
|
|
46
|
+
PY
|
|
47
|
+
|
|
48
|
+
- name: Check whether tag already exists
|
|
49
|
+
id: check
|
|
50
|
+
run: |
|
|
51
|
+
if git ls-remote --exit-code --tags origin "refs/tags/${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
|
|
52
|
+
echo "should_release=false" >> "$GITHUB_OUTPUT"
|
|
53
|
+
echo "Tag ${{ steps.version.outputs.tag }} already exists — skipping."
|
|
54
|
+
else
|
|
55
|
+
echo "should_release=true" >> "$GITHUB_OUTPUT"
|
|
56
|
+
echo "Tag ${{ steps.version.outputs.tag }} is new — releasing."
|
|
57
|
+
fi
|
|
58
|
+
|
|
59
|
+
build:
|
|
60
|
+
name: Build distributions
|
|
61
|
+
runs-on: ubuntu-latest
|
|
62
|
+
needs: plan-release
|
|
63
|
+
if: needs.plan-release.outputs.should_release == 'true'
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
|
|
67
|
+
- name: Install uv
|
|
68
|
+
uses: astral-sh/setup-uv@v4
|
|
69
|
+
|
|
70
|
+
- name: Build package
|
|
71
|
+
run: uv build
|
|
72
|
+
|
|
73
|
+
- uses: actions/upload-artifact@v4
|
|
74
|
+
with:
|
|
75
|
+
name: release-dists
|
|
76
|
+
path: dist/*
|
|
77
|
+
|
|
78
|
+
publish-pypi:
|
|
79
|
+
name: Publish to PyPI
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
needs: [plan-release, build]
|
|
82
|
+
if: needs.plan-release.outputs.should_release == 'true'
|
|
83
|
+
environment: pypi
|
|
84
|
+
permissions:
|
|
85
|
+
id-token: write
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/download-artifact@v4
|
|
88
|
+
with:
|
|
89
|
+
name: release-dists
|
|
90
|
+
path: dist
|
|
91
|
+
|
|
92
|
+
- name: Publish to PyPI
|
|
93
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
94
|
+
|
|
95
|
+
create-release:
|
|
96
|
+
name: Create GitHub release
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
needs: [plan-release, publish-pypi]
|
|
99
|
+
if: needs.plan-release.outputs.should_release == 'true'
|
|
100
|
+
permissions:
|
|
101
|
+
contents: write
|
|
102
|
+
steps:
|
|
103
|
+
- uses: actions/checkout@v4
|
|
104
|
+
|
|
105
|
+
- uses: actions/download-artifact@v4
|
|
106
|
+
with:
|
|
107
|
+
name: release-dists
|
|
108
|
+
path: dist
|
|
109
|
+
|
|
110
|
+
- name: Extract release notes from CHANGELOG.md
|
|
111
|
+
id: notes
|
|
112
|
+
env:
|
|
113
|
+
RELEASE_VERSION: ${{ needs.plan-release.outputs.version }}
|
|
114
|
+
run: |
|
|
115
|
+
python - <<'PY'
|
|
116
|
+
import os, re
|
|
117
|
+
from pathlib import Path
|
|
118
|
+
version = os.environ["RELEASE_VERSION"]
|
|
119
|
+
changelog = Path("CHANGELOG.md")
|
|
120
|
+
out = Path(os.environ["RUNNER_TEMP"]) / "release-notes.md"
|
|
121
|
+
github_output = Path(os.environ["GITHUB_OUTPUT"])
|
|
122
|
+
if not changelog.exists():
|
|
123
|
+
github_output.open("a").write("has_notes=false\n")
|
|
124
|
+
raise SystemExit(0)
|
|
125
|
+
heading = re.compile(
|
|
126
|
+
rf"^##\s+(?:\[?v?{re.escape(version)}\]?)(?:\s+-\s+.+)?\s*$"
|
|
127
|
+
)
|
|
128
|
+
next_h = re.compile(r"^##\s+")
|
|
129
|
+
lines = changelog.read_text().splitlines()
|
|
130
|
+
start = None
|
|
131
|
+
for i, l in enumerate(lines):
|
|
132
|
+
if heading.match(l.strip()):
|
|
133
|
+
start = i + 1
|
|
134
|
+
break
|
|
135
|
+
if start is None:
|
|
136
|
+
github_output.open("a").write("has_notes=false\n")
|
|
137
|
+
raise SystemExit(0)
|
|
138
|
+
end = len(lines)
|
|
139
|
+
for i in range(start, len(lines)):
|
|
140
|
+
if next_h.match(lines[i].strip()):
|
|
141
|
+
end = i
|
|
142
|
+
break
|
|
143
|
+
body = "\n".join(lines[start:end]).strip()
|
|
144
|
+
if not body:
|
|
145
|
+
github_output.open("a").write("has_notes=false\n")
|
|
146
|
+
raise SystemExit(0)
|
|
147
|
+
out.write_text(body + "\n")
|
|
148
|
+
with github_output.open("a") as fh:
|
|
149
|
+
fh.write("has_notes=true\n")
|
|
150
|
+
fh.write(f"notes_file={out}\n")
|
|
151
|
+
PY
|
|
152
|
+
|
|
153
|
+
- name: Create git tag
|
|
154
|
+
run: |
|
|
155
|
+
git config user.name "github-actions[bot]"
|
|
156
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
157
|
+
git tag "${{ needs.plan-release.outputs.tag }}" "${{ github.sha }}"
|
|
158
|
+
git push origin "${{ needs.plan-release.outputs.tag }}"
|
|
159
|
+
|
|
160
|
+
- name: Create GitHub release (with CHANGELOG notes)
|
|
161
|
+
if: steps.notes.outputs.has_notes == 'true'
|
|
162
|
+
env:
|
|
163
|
+
GH_TOKEN: ${{ github.token }}
|
|
164
|
+
run: |
|
|
165
|
+
gh release create "${{ needs.plan-release.outputs.tag }}" dist/* \
|
|
166
|
+
--target "${{ github.sha }}" \
|
|
167
|
+
--title "${{ needs.plan-release.outputs.tag }}" \
|
|
168
|
+
--notes-file "${{ steps.notes.outputs.notes_file }}"
|
|
169
|
+
|
|
170
|
+
- name: Create GitHub release (auto-generated notes)
|
|
171
|
+
if: steps.notes.outputs.has_notes != 'true'
|
|
172
|
+
env:
|
|
173
|
+
GH_TOKEN: ${{ github.token }}
|
|
174
|
+
run: |
|
|
175
|
+
gh release create "${{ needs.plan-release.outputs.tag }}" dist/* \
|
|
176
|
+
--target "${{ github.sha }}" \
|
|
177
|
+
--title "${{ needs.plan-release.outputs.tag }}" \
|
|
178
|
+
--generate-notes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
dist/
|
|
6
|
+
build/
|
|
7
|
+
.eggs/
|
|
8
|
+
|
|
9
|
+
# Virtual env
|
|
10
|
+
.venv/
|
|
11
|
+
|
|
12
|
+
# Test cache
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
|
|
15
|
+
# orgraph runtime state (per-repo, not source)
|
|
16
|
+
.orgraph/
|
|
17
|
+
|
|
18
|
+
# Reference code repos (not our source)
|
|
19
|
+
.codes/
|
|
20
|
+
|
|
21
|
+
# Editor
|
|
22
|
+
.DS_Store
|
|
23
|
+
*.swp
|
|
24
|
+
.codes/
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# AGENTS.md — orgraph
|
|
2
|
+
|
|
3
|
+
Authoritative agent guide for the orgraph codebase. Read this before making changes.
|
|
4
|
+
|
|
5
|
+
## Current version: 0.1.0
|
|
6
|
+
|
|
7
|
+
## What orgraph does
|
|
8
|
+
|
|
9
|
+
Points at any repo → builds a persistent Kuzu knowledge graph + topology clusters + Leiden communities → serves it via MCP so coding agents (Cursor, Claude CLI, Codex) can query architectural context.
|
|
10
|
+
## Project Snapshot
|
|
11
|
+
|
|
12
|
+
T3 Code is a minimal web GUI for using coding agents like Codex and Claude.
|
|
13
|
+
|
|
14
|
+
This repository is a VERY EARLY WIP. Proposing sweeping changes that improve long-term maintainability is encouraged.
|
|
15
|
+
|
|
16
|
+
## Core Priorities
|
|
17
|
+
|
|
18
|
+
1. Performance first.
|
|
19
|
+
2. Reliability first.
|
|
20
|
+
3. Keep behavior predictable under load and during failures (session restarts, reconnects, partial streams).
|
|
21
|
+
|
|
22
|
+
If a tradeoff is required, choose correctness and robustness over short-term convenience.
|
|
23
|
+
## Maintainability
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Long term maintainability is a core priority. If you add new functionality, first check if there is shared logic that can be extracted to a separate module. Duplicate logic across multiple files is a code smell and should be avoided. Don't be afraid to change existing code. Don't take shortcuts by just adding local logic to solve a problem.
|
|
27
|
+
#Reference Docs
|
|
28
|
+
.codes directory contain reference repo
|
|
29
|
+
|
|
30
|
+
Use these as implementation references when designing protocol handling, UX flows, and operational safeguards.
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
## Phase status
|
|
34
|
+
|
|
35
|
+
| Phase | Status | Notes |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| P1 Foundation + Extraction | ✅ COMPLETE | `orgraph index` + `orgraph status` working, 21 tests pass |
|
|
38
|
+
| P2 Topology + Communities | ✅ COMPLETE | BFS clusters + Leiden communities wired into `orgraph index` and `orgraph status` |
|
|
39
|
+
| P3 Search | ✅ COMPLETE | `orgraph search` works; semble BM25+Model2Vec; 9 tests |
|
|
40
|
+
| P4 MCP Server | ✅ COMPLETE | FastMCP stdio, 5 tools, 12 tests |
|
|
41
|
+
| P5 Eval Harness | ✅ COMPLETE | NDCG@10=0.903, MRR=0.895 on codewiki (target >0.70); 17 tests |
|
|
42
|
+
|
|
43
|
+
## Package layout
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
orgraph/
|
|
47
|
+
cli.py # Click CLI: index / status / search / serve
|
|
48
|
+
extract/
|
|
49
|
+
types.py # NodeDict, EdgeDict, ExtractionResult, make_uid()
|
|
50
|
+
manifest.py # Manifest — file → md5 tracking (.orgraph/manifest.json)
|
|
51
|
+
scip.py # ScipExtractor — compiler-accurate, falls back to None
|
|
52
|
+
scip_pb2.py # Auto-generated protobuf bindings (SCIP format)
|
|
53
|
+
treesitter.py # TreeSitterExtractor — wraps graphify; _GRAPHIFY_ROOT must exist
|
|
54
|
+
graph/
|
|
55
|
+
kuzu.py # OrgraphDB — thin Kuzu wrapper; do NOT mkdir db_path itself
|
|
56
|
+
schema.py # create_schema(db) — all node/edge tables (IF NOT EXISTS)
|
|
57
|
+
builder.py # GraphBuilder.ingest(result) → (nodes, edges) written
|
|
58
|
+
topology/
|
|
59
|
+
call_graph.py # CallGraph, CallEdge, GraphRelation data structures
|
|
60
|
+
context.py # RepoContext shim; build_repo_context(result, repo_path)
|
|
61
|
+
topology.py # build_topology_map(ctx) → TopologyMap (BFS clusters)
|
|
62
|
+
cluster.py # cluster(G) → Leiden communities; build_nx_graph_from_result()
|
|
63
|
+
serialise.py # save/load topology.json and communities.json
|
|
64
|
+
search/
|
|
65
|
+
index.py # SearchIndex stub (P3)
|
|
66
|
+
mcp/
|
|
67
|
+
server.py # start_server() stub (P4)
|
|
68
|
+
eval/
|
|
69
|
+
__init__.py # empty (P5)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## State written to indexed repos
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
<repo>/.orgraph/
|
|
76
|
+
graph.kuzu # Kuzu DB (single file)
|
|
77
|
+
manifest.json # file → md5
|
|
78
|
+
topology.json # TopologyMap serialised
|
|
79
|
+
communities.json # Leiden {community_id: [node_uids]}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Architecture invariants
|
|
83
|
+
|
|
84
|
+
- **Kuzu DB path**: Kuzu creates its own structure at `db_path`. Never `mkdir(db_path)` — only `mkdir(db_path.parent)`. Fixed in `graph/kuzu.py`.
|
|
85
|
+
- **graphify path**: `extract/treesitter.py` adds `~/tss/codegen/orgraph/.codes/graphify` to `sys.path` at runtime. If `.codes/` moves, update `_GRAPHIFY_ROOT`.
|
|
86
|
+
- **graphify label field**: graphify puts display names in `label` (`"authenticate()"`, `"User"`). Not a type tag. Conversion logic lives in `treesitter.py`.
|
|
87
|
+
- **tree-sitter grammars**: `tree-sitter-python`, `tree-sitter-javascript`, `tree-sitter-typescript` must be installed (in `pyproject.toml` deps).
|
|
88
|
+
- **`_is_test_file` heuristic**: Files under paths containing `/tests/` or `/test/` are excluded from BFS entry points. Tests that run topology on fixture code must copy fixtures to a non-tests temp dir (`shutil.copytree(FIXTURE, tmp_path / "simple_python")`).
|
|
89
|
+
- **Topology depends on ExtractionResult**: `build_repo_context()` builds CallGraph directly from ExtractionResult CALLS edges, not from Kuzu. Topology runs before DB is closed.
|
|
90
|
+
- **Leiden falls back to Louvain**: If `graspologic` is not installed, networkx Louvain is used. Both give stable results via seed=42.
|
|
91
|
+
|
|
92
|
+
## CLI commands
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
orgraph index <repo> # extract → kuzu → topology → leiden → save
|
|
96
|
+
orgraph status <repo> # node/edge counts + cluster table + community count
|
|
97
|
+
orgraph search <q> <r> # search (P3 stub)
|
|
98
|
+
orgraph serve <repo> # MCP server (P4 stub)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Testing
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cd ~/tss/codegen/orgraph
|
|
105
|
+
uv run python -m pytest tests/ -q # all 21 tests
|
|
106
|
+
uv run python -m pytest tests/test_extract.py tests/test_graph.py -q # P1 only
|
|
107
|
+
uv run python -m pytest tests/test_topology.py -q # P2 only
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Reference repos (all at `~/tss/codegen/orgraph/.codes/`)
|
|
111
|
+
|
|
112
|
+
| Repo | What we borrow |
|
|
113
|
+
|---|---|
|
|
114
|
+
| `CodeGraphContext` | SCIP extractor, Kuzu adapter, graph schema, scip_pb2.py |
|
|
115
|
+
| `graphify` | tree-sitter extractor, Leiden cluster.py |
|
|
116
|
+
| `semble` | pip dep only — hybrid BM25+Model2Vec search |
|
|
117
|
+
| `codewiki` (`~/tss/codegen/codewiki`) | CallGraph data structures, BFS topology clustering |
|
|
118
|
+
|
|
119
|
+
## Next phase: P5 — Eval Harness
|
|
120
|
+
|
|
121
|
+
Build `orgraph/eval/` with:
|
|
122
|
+
- `ground_truth.py` — `EvalQuery` dataclass (query, relevant_files, relevant_symbols, query_type)
|
|
123
|
+
- `metrics.py` — `ndcg_at_k()`, `mrr()`, `precision_at_k()`
|
|
124
|
+
- `runner.py` — `EvalRunner(repo_path, ground_truth_path).run() → EvalReport`
|
|
125
|
+
- `fixtures/codewiki_gt.json` — 20+ ground-truth Q&A pairs for codewiki
|
|
126
|
+
- CLI: `orgraph eval <repo> --ground-truth <path>`
|
|
127
|
+
- Target: NDCG@10 > 0.70 on codewiki
|
|
128
|
+
|
|
129
|
+
## MCP tool notes (P4)
|
|
130
|
+
|
|
131
|
+
- `register_tools(mcp, db, idx, topology, communities, repo_path)` returns `dict[str, Callable]` — use this in tests, don't introspect FastMCP internals
|
|
132
|
+
- FastMCP 3.4.2: `list_tools()` is async, `get_tool(name)` is async — bypass both by using the returned dict
|
|
133
|
+
- Tool functions are defined as closures over `db`, `idx`, `topology`, `communities`, `repo_path`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 - 2025-06-17
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- `orgraph index` — extract nodes/edges via tree-sitter (SCIP fallback), build topology clusters, Leiden communities, and hybrid search index
|
|
7
|
+
- `orgraph status` — show graph stats, topology clusters, and community sizes
|
|
8
|
+
- `orgraph search` — hybrid BM25+semantic code search
|
|
9
|
+
- `orgraph serve` — FastMCP stdio server with 6 tools: `search`, `trace`, `get_context`, `find_entry_points`, `get_dependencies`, `reindex`
|
|
10
|
+
- `orgraph eval` — retrieval eval harness with NDCG@10, MRR, Precision@k
|
|
11
|
+
- `orgraph install` / `orgraph uninstall` — interactive installer for Claude Code, Cursor, Codex, VS Code, Gemini CLI, Opencode
|
|
12
|
+
- Auto-index on `serve` — no manual `orgraph index` needed on first run
|
|
13
|
+
- Incremental `reindex` MCP tool — detects changed/deleted files via md5 manifest, re-extracts only what changed, swaps state live without server restart
|
|
14
|
+
- Fully vendored graphify extractor — standalone install, no external path dependencies
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Pranav Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: orgraph-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Codebase knowledge graph MCP server — call chains, topology, and hybrid search for coding agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/tss-pranavkumar/orgraph
|
|
6
|
+
Project-URL: Repository, https://github.com/tss-pranavkumar/orgraph
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/tss-pranavkumar/orgraph/issues
|
|
8
|
+
Author-email: Pranav Kumar <pranav.kumar@thesouledstore.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,code-search,codebase,knowledge-graph,llm,mcp
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: click>=8.1
|
|
22
|
+
Requires-Dist: fastmcp>=2.0
|
|
23
|
+
Requires-Dist: kuzu>=0.8
|
|
24
|
+
Requires-Dist: networkx>=3.4
|
|
25
|
+
Requires-Dist: orjson>=3.9
|
|
26
|
+
Requires-Dist: pathspec>=0.12
|
|
27
|
+
Requires-Dist: protobuf<3.21,>=3.20
|
|
28
|
+
Requires-Dist: questionary>=2.0
|
|
29
|
+
Requires-Dist: rich>=13.0
|
|
30
|
+
Requires-Dist: semble>=0.3.4
|
|
31
|
+
Requires-Dist: tree-sitter-javascript>=0.23
|
|
32
|
+
Requires-Dist: tree-sitter-python>=0.23
|
|
33
|
+
Requires-Dist: tree-sitter-typescript>=0.23
|
|
34
|
+
Requires-Dist: tree-sitter<0.26,>=0.23
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# orgraph
|
|
41
|
+
|
|
42
|
+
Codebase knowledge graph for coding agents. Points at any repo, builds a persistent graph, serves it via MCP.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
uv venv && uv pip install -e .
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Usage
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Index a repo
|
|
54
|
+
orgraph index /path/to/repo
|
|
55
|
+
|
|
56
|
+
# Check graph stats
|
|
57
|
+
orgraph status /path/to/repo
|
|
58
|
+
|
|
59
|
+
# Search code
|
|
60
|
+
orgraph search "authentication middleware" /path/to/repo
|
|
61
|
+
|
|
62
|
+
# Start MCP server (add to Cursor / Claude CLI config)
|
|
63
|
+
orgraph serve /path/to/repo
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## MCP config (Claude CLI)
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"orgraph": { "command": "orgraph", "args": ["serve", "."] }
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Architecture
|
|
77
|
+
|
|
78
|
+
See [plan](../.claude/plans/i-wnant-you-to-glowing-pelican.md) for full design.
|
|
79
|
+
|
|
80
|
+
- **Extraction**: SCIP (compiler-accurate) → tree-sitter fallback (graphify)
|
|
81
|
+
- **Storage**: Kuzu embedded graph DB
|
|
82
|
+
- **Search**: semble hybrid BM25 + Model2Vec
|
|
83
|
+
- **Topology**: codewiki BFS entry-point clustering
|
|
84
|
+
- **Communities**: Leiden community detection (graphify)
|
|
85
|
+
- **Agent interface**: FastMCP stdio server, 5 tools
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# orgraph
|
|
2
|
+
|
|
3
|
+
Codebase knowledge graph for coding agents. Points at any repo, builds a persistent graph, serves it via MCP.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv venv && uv pip install -e .
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Index a repo
|
|
15
|
+
orgraph index /path/to/repo
|
|
16
|
+
|
|
17
|
+
# Check graph stats
|
|
18
|
+
orgraph status /path/to/repo
|
|
19
|
+
|
|
20
|
+
# Search code
|
|
21
|
+
orgraph search "authentication middleware" /path/to/repo
|
|
22
|
+
|
|
23
|
+
# Start MCP server (add to Cursor / Claude CLI config)
|
|
24
|
+
orgraph serve /path/to/repo
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## MCP config (Claude CLI)
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"mcpServers": {
|
|
32
|
+
"orgraph": { "command": "orgraph", "args": ["serve", "."] }
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Architecture
|
|
38
|
+
|
|
39
|
+
See [plan](../.claude/plans/i-wnant-you-to-glowing-pelican.md) for full design.
|
|
40
|
+
|
|
41
|
+
- **Extraction**: SCIP (compiler-accurate) → tree-sitter fallback (graphify)
|
|
42
|
+
- **Storage**: Kuzu embedded graph DB
|
|
43
|
+
- **Search**: semble hybrid BM25 + Model2Vec
|
|
44
|
+
- **Topology**: codewiki BFS entry-point clustering
|
|
45
|
+
- **Communities**: Leiden community detection (graphify)
|
|
46
|
+
- **Agent interface**: FastMCP stdio server, 5 tools
|
|
File without changes
|