Skip to content

MCP: add configurable server profiles (public, internal)#2813

Merged
reakaleek merged 6 commits intomainfrom
feature/mcp-server-profiles
Feb 27, 2026
Merged

MCP: add configurable server profiles (public, internal)#2813
reakaleek merged 6 commits intomainfrom
feature/mcp-server-profiles

Conversation

@reakaleek
Copy link
Member

@reakaleek reakaleek commented Feb 27, 2026

What

  • Add configurable MCP server profiles so the same binary can serve different tool sets and instructions per deployment
  • Each profile produces distinct tool names (e.g. public_docs_semantic_search, internal_docs_semantic_search) and context-aware trigger bullets
  • Public profile: all tools (search, documents, coherence, links, content types) for elastic.co/docs
  • Internal profile: search and documents only for internal knowledge (team processes, run books, architecture)

Why

  • The MCP server is reused across Elastic documentation and Elastic Internal Docs (Codex), which need different tool sets
  • Profile-based tool name prefixes prevent name collisions when both servers are registered in the same client
  • Profile-specific triggers help the LLM choose the correct server based on the user's intent

Notes

  • Profile selection via MCP_SERVER_PROFILE env var (default: public)
  • Tool names are derived from method names, converted to snake_case, and prefixed per profile
  • Module WhenToUse templates use a {docs} placeholder replaced at composition time with the profile's DocsDescription; ExtraTriggers adds profile-only bullets

- Introduce McpServerProfile and McpFeatureModule for compositional tool and instruction assembly
- Public profile: all tools (search, documents, coherence, links, content types)
- Internal profile: search and documents only, with intro for team processes, run books, architecture
- Add MCP_SERVER_PROFILE env var, default "public"
- Add XML tags (triggers, tool_guidance) for LLM-readable instructions
- Add unit tests for instruction composition

Made-with: Cursor
@reakaleek reakaleek requested a review from a team as a code owner February 27, 2026 11:44
theletterf and others added 2 commits February 27, 2026 12:54
Add ToolNamePrefix, DocsDescription, and ExtraTriggers to McpServerProfile
so each profile produces distinct tool names (e.g. public_docs_semantic_search,
internal_docs_semantic_search) and profile-specific trigger bullets.

Made-with: Cursor
@reakaleek reakaleek enabled auto-merge (squash) February 27, 2026 12:33
- Use StringBuilder in ReplaceToolPlaceholders instead of string concatenation in loop
- Add DynamicallyAccessedMembers annotation to ToolType for AOT compatibility
- Replace if/continue with LINQ Where filter in CreatePrefixedTools
- Remove redundant ToString() calls in ToSnakeCase

Made-with: Cursor
Add [property:] target to DynamicallyAccessedMembers on McpFeatureModule.ToolType
so the annotation flows to the generated property (not just the constructor param).
Avoid tuple/local extraction of ToolType in McpToolRegistration and McpServerProfile
to preserve trim annotations through direct property access.
Update container base image from 9.0-noble-chiseled-aot to 10.0-noble-chiseled
to match the net10.0 target framework.

Made-with: Cursor
The record positional parameter needs [DynamicallyAccessedMembers] on both
the parameter (for constructor → backing field assignment) and the property
(for callers accessing ToolType).

Made-with: Cursor
@reakaleek reakaleek merged commit e9950cf into main Feb 27, 2026
30 checks passed
@reakaleek reakaleek deleted the feature/mcp-server-profiles branch February 27, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants