SGraph MCP Server
OfficialServer Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
| experimental | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| sgraph_load_modelA | Load a graph model from file and return its ID for subsequent queries. If the model was already auto-loaded at startup, returns the existing ID instantly. |
| sgraph_search_elementsA | Find code elements by name pattern. Use instead of grep for precise symbol lookup. When to use:
Parameters:
Returns JSON with match count and element list. |
| sgraph_get_element_dependenciesA | Query what code depends on an element, or what it depends on. THE KEY TOOL. When to use:
Direction:
result_level (controls abstraction):
include_descendants:
target_filter:
WARNING: include_descendants=true on large directories (e.g., src/) can return thousands of results. Use target_filter or result_level=3 to keep output manageable. Example - "Does src/web depend on src/db?": element_path="/project/src/web", direction="outgoing", include_descendants=true, result_level=3, target_filter="/project/src/db" -> Returns only dependencies from src/web subtree targeting src/db Returns JSON with outgoing/incoming dependency lists. |
| sgraph_get_element_structureA | Explore what's inside a file, class, or directory WITHOUT reading source code. When to use:
max_depth:
Returns JSON hierarchy with path, type, name, and children. Much cheaper than Read - use this first to decide what to read. |
| sgraph_analyze_change_impactA | BEFORE modifying any public interface, call this to see what breaks. Returns ALL abstraction levels at once (no need for multiple calls):
Automatic warnings (when detected):
When to use:
Returns JSON with summary, warnings, and callers at multiple aggregation levels. |
| sgraph_auditA | Run architectural health checks on the codebase. For occasional reviews, not daily use. Available checks:
aggregation_level controls module granularity:
Returns JSON with cycles, hub modules, and summary metrics. |
| sgraph_get_element_attributesA | Get all attributes (metadata) of a code element. When to use:
Returns element info + all attributes as flat key-value pairs. Only attributes that exist on the element are included. |
| sgraph_resolve_local_pathA | Map sgraph path to local filesystem path. Use to find source code for NuGet packages. When to use:
The mapping is configured in sgraph-mapping.json. Default maps:
Returns:
After resolving, use the Read tool to view the source code. |
| sgraph_security_auditA | Security overview across 6 dimensions: secrets, vulnerabilities, outdated/EOL, risk levels, backstage metadata, bus factor. Use for: organizational security posture, audit preparation, risk prioritization. Dimensions (only those with findings are included):
Returns JSON with summary + per-dimension breakdown. |
| sgraph_cypher_queryA | Run an openCypher query against the loaded model. Powerful and flexible. Use this tool for complex graph queries that the other tools can't express:
The sgraph model is mapped to a labeled property graph: Nodes (= code elements):
Relationships (= dependencies):
Example queries: "What files does main.py import?" MATCH (a:file)-[:imports]->(b:file) WHERE a.name = 'main.py' RETURN b.name, b.path "Count dependencies per file, top 10:" MATCH (a:file)-[r]->(b) WHERE type(r) <> 'CONTAINS' RETURN a.name, count(r) AS deps ORDER BY deps DESC LIMIT 10 "Find all transitive imports from a file (up to 3 hops):" MATCH (a:file)-[:imports*1..3]->(b) WHERE a.name = 'app.py' RETURN DISTINCT b.name, b.path "Files with more than 500 lines of code:" MATCH (f:file) WHERE f.loc > 500 RETURN f.name, f.loc ORDER BY f.loc DESC "Does module A depend on module B? (directory-level)" MATCH (a)-[r]->(b) WHERE a.path STARTS WITH '/project/src/web/' AND b.path STARTS WITH '/project/src/db/' AND type(r) <> 'CONTAINS' RETURN type(r), count(r) AS cnt ORDER BY cnt DESC Performance notes:
Returns JSON array of result rows. Read-only: CREATE/DELETE/SET not supported. |
| sgraph_queryA | Filter the model using SGraph Query Language — concise, architecture-native syntax. Best for: filtering sub-models, checking module dependencies, attribute-based element selection. Returns a filtered model (elements + associations), not tabular data. For tabular queries and aggregation, use sgraph_cypher_query instead. Syntax quick reference: Element selection: "/project/src/web" Exact path (quoted, case-sensitive) phone Keyword (unquoted, case-insensitive partial match) "/path/*" Direct children "/path/**" All descendants Attribute filters: @type=file Attribute equals (contains match) @type="file" Exact match (quoted value) @type!=dir Not equals @loc>500 Greater than (numeric) @loc<100 Less than @name=~".*.py$" Regex match @loc Has attribute (any value) Dependency queries: "/src/web" --> "/src/db" Directed: does web depend on db? "/src/web" -- "/src/db" Undirected: dependency in either direction "/web" -import-> "/db" Filter by dependency type "*" --> "/src/db" Wildcard: anything that depends on db "/a" ---> "/b" Chain search: all transitive paths (DFS) "/a" --import-> "/b" Chain with type filter "/a" --- "/b" Shortest undirected path (BFS) Logical operators: expr1 AND expr2 Sequential filter (intersection) expr1 OR expr2 Union NOT expr Complement (expr) Grouping Examples: @type=file AND @loc>500 "/src" AND NOT "/src/External" "/src/web" --> "/src/db" (@type=file OR @type=dir) AND @loc>200 Returns JSON with elements (path, type, name) and associations (from, to, type). |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 11 tools
Each tool has a clearly specialized purpose with explicit 'when to use' guidance, so agents can generally pick the right one. Minor overlap exists between sgraph_query, sgraph_cypher_query, and sgraph_get_element_dependencies, since all can express dependency lookups, but the intended boundaries are described well enough to avoid major confusion.
All tools share the sgraph_ prefix and snake_case naming, which gives the set a strong sense of consistency. Most names follow a verb_object pattern (load_model, search_elements, get_element_dependencies), but sgraph_audit, sgraph_query, and sgraph_security_audit are slightly less uniform in structure.
Eleven tools is a well-scoped size for a code dependency graph analysis server. Each tool covers a distinct aspect of the workflow—loading, searching, exploring, analyzing impact, auditing, and querying—so none feels redundant or excessive.
The tool surface covers model loading, symbol search, structural exploration, dependency and impact analysis, architecture audits, security audits, attribute inspection, path resolution, and two flexible query languages. The only apparent workflow gap—reading actual source code—is intentionally bridged by resolving local paths and delegating to a Read tool, and advanced needs are covered by sgraph_cypher_query.