mcpserver/AGENTS.md¶
Scoped instructions for the mcpserver/ package. Root rules in /AGENTS.md still apply; only deviations and package-specific gotchas live here.
Architecture¶
Configuration vs runtime services¶
Config structs are declarative — strings, ints, bools only.
Never put runtime service instances inside a config struct.
Pass runtime services directly as parameters to constructors.
Server types and the search service¶
InMemoryServer(embedded in the plugin) takessearchService tools.SemanticSearchServicedirectly. The plugin passes*search.Search, which implementsSemanticSearchService.HTTP / Stdio / PluginHandlers (external servers) build their own
HTTPSemanticSearchServiceinternally; that service calls back to the plugin’s/api/v1/search/rawendpoint.
Type sharing¶
Do not duplicate types from the
searchpackage insidemcpserver/tools. TheSemanticSearchServiceinterface usessearch.Optionsandsearch.RAGResultdirectly.HTTP serialization DTOs (e.g.,
httpSearchRequest,httpSearchResultinsearch_http.go) are intentionally separate from domain types and stay in their respective files.If you only need a subset of fields, accept the full type and ignore the unused fields rather than introducing a parallel struct.
Adding a new optional capability¶
Define the interface in
tools/, reusing types from their source package.For embedded servers: add the parameter to
NewInMemoryServer.For external servers: add a plugin HTTP endpoint plus an HTTP client implementation that calls it.