SwiftKG MCP Server
Server 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 |
|---|---|
| query_codebaseA | Hybrid semantic + structural query over the Swift codebase graph. :param q: Natural-language query, e.g. "request retry policy". :param k: Number of semantic seed nodes (default 8). :param hop: Graph expansion hops (default 1). :param rels: Comma-separated edge types to follow. :param max_nodes: Maximum nodes to return (default 25). :param min_score: Minimum semantic score for seed inclusion in [0, 1]. :param max_per_module: Maximum nodes per module (default 3; 0 disables). :param rerank_mode: 'hybrid' (default), 'semantic', or 'legacy'. :param rerank_semantic_weight: Semantic weight for hybrid mode (default 0.7). :param rerank_lexical_weight: Lexical weight for hybrid mode (default 0.3). :param format: 'json' (default) or 'markdown'. :return: JSON string or Markdown table. |
| pack_snippetsA | Hybrid query + source-grounded Swift snippet extraction. Returns a Markdown context pack with ranked, deduplicated code snippets and line numbers — ready for direct LLM ingestion. :param q: Natural-language query, e.g. "request error handling". :param k: Number of semantic seed nodes (default 8). :param hop: Graph expansion hops (default 1). :param rels: Comma-separated edge types to follow. :param context: Extra context lines around each definition (default 5). :param max_lines: Maximum lines per snippet block (default 60). :param max_nodes: Maximum nodes to include in the pack (default 15). :param min_score: Minimum semantic score for seed inclusion in [0, 1]. :param max_per_module: Maximum nodes per module (default 3; 0 disables). :param rerank_mode: 'hybrid' (default), 'semantic', or 'legacy'. :param rerank_semantic_weight: Semantic weight for hybrid mode (default 0.7). :param rerank_lexical_weight: Lexical weight for hybrid mode (default 0.3). :return: Markdown string with source-grounded code snippets. |
| callersA | Return all nodes that call a given node, resolving through Unlike The Typical workflow:: :param node_id: Target node identifier, e.g.
|
| type_hierarchyA | Return everything the graph knows about one Swift type's relationships. Swift spreads a type across three relations that the sibling language modules do not have to separate, and answering "what is this type" means reading all three at once:
Calling :param node_id: Node ID of a class, struct, enum, protocol or actor, e.g.
|
| public_apiA | List the declared public API surface. Swift states access level with a keyword and SwiftKG stores it, so this is
a fact read out of the graph rather than a heuristic. Use it to review what
a module actually exposes, or to find :param module_path: Restrict to files under this path prefix. Empty
(default) covers the whole repository.
:param limit: Maximum declarations to return (1-1000).
:return: JSON with |
| get_nodeA | Fetch a single Swift node by its stable ID and render as Markdown. Node IDs follow the pattern :param node_id: Stable node identifier. :param include_edges: If True, append outgoing edges and incoming callers. :return: Markdown-formatted node summary. |
| graph_statsA | Return node and edge counts by kind and relation as Markdown. Call this first when engaging with a new Swift repo. Reports doc-comment coverage (fraction of functions/methods with doc-comment comments). :return: Markdown summary with total counts, nodes-by-kind, and edges-by-relation tables. |
| list_nodesA | List nodes filtered by module path prefix and/or kind. :param module_path: Module path prefix filter (e.g. "Sources/Networking/Client.swift"). :param kind: Node kind filter: module | class | struct | enum | protocol | actor | extension | function | method | property | typealias. :return: JSON array of matching node dicts. |
| find_nodeA | Find graph nodes by name without knowing their full stable ID. Case-insensitive match against name and qualname. Use when you know a function or class name from reading code and need its stable ID. :param name: Function, type, or protocol name to search for. :param kind: Optional kind filter: module | class | struct | protocol | function | method | etc. :return: JSON array of matching node dicts. |
| centralityA | Compute Structural Importance Ranking (SIR) for the indexed codebase. Runs a deterministic weighted PageRank over the sym-stub-resolved call graph. Edge weights are tuned per relation type (CALLS > INHERITS/CONFORMS/EXTENDS > IMPORTS > CONTAINS) and amplified for cross-module links; private symbols receive a post-convergence penalty. Scores are normalized to sum to 1.0. Use this to:
:param top: Maximum number of ranked entries to return (default 20).
:param kinds: Comma-separated node kinds to include: |
| bridge_centralityA | Compute module connectivity: how many unique modules each module interacts with. For well-modularized codebases, identifies orchestrator and hub modules that touch many other modules. Replaces betweenness centrality (which is meaningless when inter-module edges are zero). Connectivity score = (unique modules called + unique modules calling this) / 30 + frequency / 50 Higher score = more complex coupling with other modules. Scores are persisted to the :param top: Number of top connectivity modules to return (default 20). :param include_imports: Whether to include IMPORTS in connectivity (default True). :return: Markdown-formatted ranking table of modules by connectivity. |
| framework_nodesA | Identify framework-like (hub) modules using SIR + module connectivity. A "framework node" is a module that is both:
Framework score = 0.6 × normalized SIR + 0.4 × normalized connectivity, both auto-computed on first call. High-scoring modules are critical hubs: architecturally central AND complex in their interactions. :param top: Number of top framework-like modules to return (default 20). :return: Markdown-formatted ranking table of framework nodes. |
| find_definition_atA | Find the code node whose definition spans a given file location. Reverse-resolves a Matches the innermost (most-specific) function, method, type, extension,
type alias, or enum whose :param file: Module path as stored in the graph, e.g. |
| analyze_repoA | Run a full structural analysis of the indexed Swift repository. Executes the 14-phase SwiftKG analysis pipeline — baseline metrics, CodeRank, fan-in/fan-out, module coupling, critical call chains, public API surface, doc-comment coverage, type hierarchy and conformance, insights, snapshot history, and SIR centrality — and returns the results as Markdown. :return: Markdown-formatted analysis report. |
| explainA | Return a natural-language explanation of a code node. Given a node ID (e.g.,
This is ideal for understanding the role and context of a specific node
without needing to read the full source code. Use :param node_id: Stable node identifier, e.g.
|
| rank_nodesA | Compute global weighted CodeRank (PageRank) over the repository graph. Builds a directed weighted graph from the SQLite store and runs weighted PageRank to identify the most structurally important nodes. Relation weights follow the CodeRank defaults: CALLS=1.0, IMPORTS=0.9, INHERITS/CONFORMS/EXTENDS=0.75. Test paths are excluded by default. Optionally persists the scores into the :param top: Number of top-ranked nodes to return (default 25).
:param rels: Comma-separated relations to include in the graph
(default |
| query_rankedA | Rank query results using CodeRank-enhanced hybrid or personalized PageRank. Combines semantic seed scores from the vector index with structural centrality and graph proximity to produce a final ranked list with explainability components. Two modes are available:
:param q: Natural-language query string.
:param k: Number of semantic seed nodes to retrieve (default 8).
:param mode: Ranking mode — |
| explain_rankA | Explain the CodeRank score components for a specific node. Returns a Markdown report showing the node's structural position in the graph: how many nodes call it, import it, or inherit from / implement / extend it; its global CodeRank score; and, when a query is provided, its semantic relevance and proximity to the query seed set. :param node_id: Stable node identifier, e.g.
|
| snapshot_listA | List saved temporal snapshots of codebase metrics in reverse chronological order. Each entry in the returned list contains a Use this tool to answer questions like "how has the codebase grown?" or "when did doc-comment coverage improve?" or "show me only main-branch snapshots". :param limit: Maximum number of snapshots to return (default 10; pass 0 for all).
:param branch: If provided, filter to snapshots from this branch only
(e.g. |
| snapshot_showA | Show full details of a specific codebase metrics snapshot. Pass a snapshot key (tree hash) to retrieve that exact snapshot, or use
the special value Snapshot keys are the The returned object contains the full metrics dict (total_nodes, total_edges, meaningful_nodes, docstring_coverage, node_counts, edge_counts, critical_issues, complexity_median), the top hotspots, and deltas computed vs. both the previous and the baseline (oldest) snapshots. :param key: Snapshot key to load, or |
| snapshot_diffA | Compare two codebase metric snapshots side-by-side. Returns the full metrics dict for both snapshots and a computed delta (b − a) covering node and edge counts, plus per-kind node count and per-relation edge count deltas. Typical workflow:: :param key_a: First (older) snapshot key — the |
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 21 tools
Each tool targets a distinct capability: querying (query_codebase, query_ranked, pack_snippets), structural analysis (centrality, rank_nodes, bridge_centrality), node lookup (get_node, find_node, list_nodes), and explanation (explain, explain_rank). There is some overlap between centrality and rank_nodes, but their descriptions clearly differentiate SIR vs. CodeRank, preventing ambiguity.
Tool names follow a consistent verb_noun pattern (e.g., list_nodes, find_node, get_node, explain_rank, snapshot_list). Verbs like query, explain, compute, and find are used predictably, and all names are lowercase snake_case throughout.
With 21 tools, the count is on the heavier side, but each tool has a distinct analytical purpose that justifies its inclusion. The number is borderline above the ideal range, but the server's broad scope (from querying to snapshots) makes it reasonable. It does feel slightly inflated with multiple ranking/centrality variants.
The tool surface covers the full lifecycle of codebase analysis: discovery (graph_stats, list_nodes), lookup (get_node, find_node), explanation (explain), querying (query_codebase, pack_snippets), ranking (rank_nodes, centrality, query_ranked), and temporal monitoring (snapshot_list, snapshot_show, snapshot_diff). The only minor gap is a lack of direct mutation tools, but that is not expected for a read-only analysis server.