feat(mcp): Add foundational Go language support to MCP server#530
Merged
Conversation
SafeDep Report SummaryNo dependency changes detected. Nothing to scan. This report is generated by SafeDep Github App |
Code Pathfinder Security ScanNo security issues detected.
Powered by Code Pathfinder |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #530 +/- ##
==========================================
- Coverage 82.80% 82.75% -0.05%
==========================================
Files 133 133
Lines 15629 15666 +37
==========================================
+ Hits 12942 12965 +23
- Misses 2207 2221 +14
Partials 480 480 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6e47056 to
a46f603
Compare
d64c4b9 to
7196910
Compare
a46f603 to
2f6f473
Compare
This was referenced Feb 15, 2026
Owner
Author
This was referenced Feb 15, 2026
Owner
Author
Merge activity
|
Enable MCP server to index and query Go symbols alongside Python: **cmd/serve.go** (~25 lines): - Detect go.mod in project directory - Build GoModuleRegistry for Go import resolution - Build Go call graph using BuildGoCallGraph - Merge Go and Python call graphs into unified index - Report Go function count in server startup output **mcp/tools.go** (~50 lines): - Add 7 Go symbol types to getSymbolKind(): - function_declaration, init_function → SymbolKindFunction - struct_definition → SymbolKindStruct - type_alias → SymbolKindTypeParam - package_variable, variable_assignment → SymbolKindVariable - func_literal → SymbolKindFunction - Add Go types to validTypes in toolFindSymbol - Update tool descriptions to mention Go support - Update error messages to include Go types **Result**: - find_symbol now returns Go functions, structs, interfaces - get_index_info shows combined Python + Go stats - No breaking changes to existing Python-only projects - Foundation for future Go improvements (type inference, modules) **Testing**: - All existing tests pass (gradle testGo) - Verified with test Go project: go.mod detection works - MCP server output shows "Go call graph merged: N functions" **Known Limitations** (deferred to future PRs): - No GoModuleRegistry in MCP server (module tools unavailable for Go) - Limited call resolution (no type inference yet) - get_callers/get_callees not prioritized for Go Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add comprehensive tests for: **mcp/tools_test.go** (~200 lines): - TestGetSymbolKind_GoTypes: Test all 7 Go symbol type mappings - TestToolFindSymbol_GoTypes: Verify Go types in validTypes - TestToolFindSymbol_GoSymbols: Integration test with Go symbols - TestToolGetIndexInfo_GoSymbols: Verify Go stats in index info **cmd/serve_test.go** (~25 lines): - TestServeWithGoMod: Test go.mod detection - TestServeWithoutGoMod: Test Python-only projects work Coverage for Go symbol types: - function_declaration → SymbolKindFunction (12) - init_function → SymbolKindFunction (12) - struct_definition → SymbolKindStruct (23) - type_alias → SymbolKindTypeParam (26) - package_variable → SymbolKindVariable (13) - variable_assignment → SymbolKindVariable (13) - func_literal → SymbolKindFunction (12) All tests verify: ✅ getSymbolKind() returns correct LSP kinds for Go ✅ find_symbol accepts Go types without error ✅ find_symbol returns Go symbols from call graph ✅ get_index_info shows Go symbol counts ✅ go.mod detection works ✅ Python-only projects unaffected
2f6f473 to
c227257
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Summary
find_symbolandget_index_infofor Go symbolsChanges
cmd/serve.go (~25 lines):
resolutionandfilepathpackagesgo.modin project directoryGoModuleRegistryfor Go import resolutionBuildGoCallGraph(codeGraph, goRegistry)MergeCallGraphs(callGraph, goCG)mcp/tools.go (~50 lines):
getSymbolKind():function_declaration,init_function→ Functionstruct_definition→ Structtype_alias→ TypeAliaspackage_variable,variable_assignment→ Variablefunc_literal→ FunctionvalidTypesmap intoolFindSymbolTest plan
gradle buildGocompiles without errorsgradle testGopasses all tests (300 passed)Verification
Setup
MCP Server Output
MCP Query Results
1.
get_index_info- Shows Go symbols indexed:{ "symbols_by_type": { "function_declaration": 2 }, "total_symbols": 2 }2.
find_symbol(type="function_declaration")- Returns Go functions:{ "matches": [ { "fqn": "example.com/test.Handler", "file": "/tmp/go-mcp-test/main.go", "line": 6, "type": "function_declaration", "symbol_kind": 12, "symbol_kind_name": "Function" }, { "fqn": "example.com/test.main", "file": "/tmp/go-mcp-test/main.go", "line": 33, "type": "function_declaration", "symbol_kind": 12, "symbol_kind_name": "Function" } ], "pagination": { "total": 2, "returned": 2, "hasMore": false } }3.
find_symbol(name="Handler")- Name-based search works:{ "matches": [ { "fqn": "example.com/test.Handler", "file": "/tmp/go-mcp-test/main.go", "line": 6, "type": "function_declaration", "symbol_kind": 12, "symbol_kind_name": "Function" } ], "pagination": { "total": 1, "returned": 1 } }✅ Verified Working
symbols_by_type.function_declaration = 2find_symbolreturns Go functionsexample.com/test.HandlerKnown Limitations (Future Work)
These are intentionally deferred to keep this PR focused:
GoModuleRegistryin MCP Server struct (module tools unavailable for Go)get_callers/get_calleesnot prioritized for Golangfilter parameter (deferred to future PR)Integration
BuildGoCallGraph)MergeCallGraphs)Notes
scan.go(proven working)🤖 Generated with Claude Code