Skip to content

Expanded Context Providers

jgravelle edited this page Mar 13, 2026 · 1 revision

Expanded Context Providers

Index and search infrastructure files the same way you index code — paths, schemas, resources, RPCs all become first-class symbols.

What

Terraform configs, Protobuf definitions, and OpenAPI specs describe your system as precisely as source code does — but most code search tools treat them as plain text. jcodemunch-mcp v1.3.9 adds first-class symbol extraction for all three formats, so search_symbols, get_file_outline, and get_context_bundle work on .tf, .proto, and openapi.yaml files exactly like they work on .py or .go.

Symbols extracted: HCL resource/variable/output/module blocks, Protobuf message/service/rpc/enum nodes (with nested scope), and OpenAPI path operations (GET /users) plus component schemas.


Why It Matters

For everyone

If you've ever grepped through a Terraform repo for "which bucket does this Lambda write to?" or searched a .proto file for a specific RPC — you now get ranked, token-efficient symbol search instead of a raw text scan.

For engineers

Provider File extensions Symbols extracted Kind mapping
Protobuf .proto message, enum, service, rpc, extend class, type, class, method
Terraform / HCL .tf, .hcl, .tfvars resource, data, module, variable, output, provider, terraform class / constant / type
OpenAPI v3 openapi.yaml, .openapi.yaml, .swagger.yaml Path operations (GET /path) + components/schemas function, type
Swagger v2 swagger.json, .swagger.json Path operations + definitions function, type

OpenAPI file detection (priority order):

  1. Well-known basenames: openapi.yaml, swagger.json, openapi.yml, etc.
  2. Compound extensions: .openapi.yaml, .swagger.json

Plain .yaml files are never mis-classified — the parser validates an openapi, swagger, or paths key before extracting anything.

Protobuf and HCL use tree-sitter grammars from tree-sitter-language-pack. OpenAPI uses pyyaml (now a core dependency) for YAML and stdlib json for JSON files.


How

Usage

{
  "tool": "search_symbols",
  "arguments": {
    "repo": "my-org/my-service",
    "query": "CreateUser",
    "language": "proto"
  }
}
{
  "tool": "search_symbols",
  "arguments": {
    "repo": "my-org/infra",
    "query": "s3 bucket",
    "language": "hcl"
  }
}
{
  "tool": "search_symbols",
  "arguments": {
    "repo": "my-org/api",
    "query": "GET /users",
    "language": "openapi"
  }
}

What comes back

Protobuf — nested scope preserved:

[
  { "kind": "class",   "name": "User",         "signature": "message User" },
  { "kind": "class",   "name": "Address",       "signature": "message Address",  "qualified_name": "User.Address" },
  { "kind": "class",   "name": "UserService",   "signature": "service UserService" },
  { "kind": "method",  "name": "GetUser",       "signature": "rpc GetUser",      "qualified_name": "UserService.GetUser" }
]

HCL / Terraform — block type folded into name:

[
  { "kind": "class",    "name": "aws_s3_bucket.my_bucket", "signature": "resource \"aws_s3_bucket\" \"my_bucket\"" },
  { "kind": "constant", "name": "region",                  "signature": "variable \"region\"" },
  { "kind": "constant", "name": "bucket_arn",              "signature": "output \"bucket_arn\"" }
]

OpenAPI — HTTP method + path as symbol name:

[
  { "kind": "function", "name": "GET /pets",          "signature": "GET /pets  # listPets" },
  { "kind": "function", "name": "POST /pets/{petId}", "signature": "POST /pets/{petId}  # createPet" },
  { "kind": "type",     "name": "Pet",                "signature": "schema Pet" },
  { "kind": "type",     "name": "PetId",              "signature": "schema PetId: string" }
]

Where the change lives

  • src/jcodemunch_mcp/parser/languages.pyOPENAPI_SPEC added; compound extensions (.openapi.yaml, .swagger.json, …) and _OPENAPI_BASENAMES frozenset registered; get_language_for_path updated with basename-first detection; "openapi" added to LANGUAGE_REGISTRY.
  • src/jcodemunch_mcp/parser/extractor.py_parse_openapi_symbols() added (YAML/JSON parsing, path operation + schema extraction, line-accurate byte offsets); dispatch added to parse_file.
  • src/jcodemunch_mcp/server.py"openapi" added to the language enum in search_symbols.
  • pyproject.tomlpyyaml>=6.0 promoted from optional to core dependency; version bumped to 1.3.9.

Connection to the jMRI Spec

The jMRI retrieval spec defines provider-agnostic symbol retrieval — these additions extend jcodemunch-mcp's coverage from general-purpose code into the infrastructure and API-contract layer. Helm chart support is the natural next step once a Helm-specific schema key detection strategy is established.


jcodemunch-mcp on GitHub · 900+ stars

Clone this wiki locally