Skip to content

Allow Adding Knowledgebase Only MCP Server - #125

Merged
MikeAlhayek merged 13 commits into
mainfrom
ma/mcp-server
Aug 10, 2026
Merged

Allow Adding Knowledgebase Only MCP Server#125
MikeAlhayek merged 13 commits into
mainfrom
ma/mcp-server

Conversation

@MikeAlhayek

Copy link
Copy Markdown
Member

No description provided.

Let MCP server hosts choose which capabilities (tools, prompts,
resources) are exposed and which tools are listed/invokable via a new
optional configuration delegate on WithCrestAppsHandlers.

- adds CrestAppsMcpHandlerBuilder with WithoutTools/WithoutSdkTools/
  WithoutPrompts/WithoutResources and tool filters (WithToolsInCategory,
  WithToolsForPurpose, WithToolNames, FilterTools)
- applies tool filters to both the list and call handlers so a
  filtered-out tool can neither be discovered nor invoked
- keeps the parameterless WithCrestAppsHandlers() behavior unchanged
  (all capabilities, all non-hidden tools), so the change is additive
  and backward compatible with no breaking changes
- adds tests and updates the MCP server docs and the 1.1.0 changelog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a registerable `search_documentation` AI tool (in CrestApps.Core.AI.Mcp)
that searches one or more configured documentation sites (Docusaurus, MkDocs,
etc.) as a knowledge base and returns relevant passages with source URLs.

- IDocumentationSource abstraction with request/result models and an
  IDocumentationSourceProvider that aggregates code-registered custom sources
  with sites materialized from DocumentationSearchOptions.
- Built-in SitemapDocumentationSource crawls a site's sitemap.xml, strips
  HTML to text, caches the corpus, and ranks with keyword scoring.
- Opt-in registration via AddCoreAIDocumentationSearch(...) and the
  AddDocumentationSearch(...) MCP server builder method; tagged under the
  "knowledgebase" category so a read-only MCP server can expose it with
  WithToolsInCategory("knowledgebase").
- Sites configurable in code (AddSite) or bound from configuration.
- Tests and docs (new mcp/documentation-search page, sidebar, changelog).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MikeAlhayek MikeAlhayek changed the title Ma/mcp server Allow Adding Knowledgebase Only MCP Server Aug 9, 2026
MikeAlhayek and others added 7 commits August 9, 2026 19:24
Replaces the DocumentationSiteKind enum with a free-form string and a
DocumentationSiteKinds constants class so hosts can define their own
generator kinds beyond Docusaurus and MkDocs. The value remains a hint; the
crawler consumes any site exposing a standard sitemap.xml.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Kind hint did not affect crawling or search, so it was dead
configuration. Removed the property and the DocumentationSiteKinds
constants. It can be reintroduced later if generator-specific behavior is
added (for example a Docusaurus search-index fast path).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds two additional opt-in documentation search strategies alongside the
sitemap crawler, each with its own builder method and configuration model:

- AddSearchIndex(...) downloads a prebuilt JSON search index (for example a
  MkDocs Material search_index.json) and ranks it locally.
- AddAlgoliaDocSearch(...) forwards queries to the hosted Algolia DocSearch
  API used by many Docusaurus sites.

Introduces a shared DocumentationCorpus for consistent keyword ranking and a
CachingDocumentationSource base for the local (non-Algolia) sources. Both new
strategies bind from configuration through the new SearchIndexes and
AlgoliaSources lists on DocumentationSearchOptions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a worked example (using core.crestapps.com) for registering an
unauthenticated Docusaurus documentation site with the sitemap crawl
strategy, including code, MCP server builder, options tuning, and
configuration-binding variants.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Documentation search:
- Persist documentation sources as DocumentationSourceEntry catalog entries so
  they can be added, edited, and removed at runtime via a UI or database, and
  aggregate them with options-defined and custom sources.
- Add IDocumentationSourceFactory strategy factories (sitemap, search-index,
  algolia) and DocumentationSourceStrategies, materializing both options-defined
  and stored entries through the factory set with signature-based caching.
- Add DefaultDocumentationSourceCatalog (multi-source), the catalog handler
  (validation + defaults), and manager registration; add YesSql index/schema and
  EntityCore binding source with AddYesSqlStores()/AddEntityCoreStores() builder
  methods.
- Rework IDocumentationSourceProvider to async GetSourcesAsync(IServiceProvider,
  CancellationToken) so the tool passes its request scope to the singleton
  provider to resolve the scoped catalog and custom sources (unreleased 1.1.0
  interface, not a breaking change against 1.0.0).

MCP server capabilities:
- Add McpServerHandlerOptions and a WithCrestAppsHandlers(IConfiguration, ...)
  overload so IncludeTools/IncludeSdkTools/IncludePrompts/IncludeResources can be
  toggled from configuration; configuration wins over code, bound eagerly at
  registration time.

Docs and tests updated; docs site builds; full test suite passes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Rebuild the MCP documentation-search feature on the existing AI tool
instances foundation and make MCP tool exposure an opt-in allow-list.

Framework
- Replace the bespoke documentation-source catalog/store/index/provider
  stack and the single search_documentation function with per-site tool
  instance sources (sitemap crawl, prebuilt search index, Algolia
  DocSearch), each producing a DocumentationSearchToolFunction bound to
  one site. Register with AddDocumentationSearchSources().
- Rework MCP tool exposure into an opt-in allow-list on the site-settings
  McpServerOptions: nothing is exposed by default; only tools/instances
  named in Tools, or all non-hidden ones when ExposeAllTools is true.
- Read McpServerOptions via IOptionsMonitor so allow-list changes apply
  at runtime without a restart.
- Resolve a listed code tool by its published AIFunction.Name even when
  it differs from the DI registration key, so a listed tool is callable.
- Resolve IOptions<DocumentationSearchOptions> in the tool sources so
  DI-configured caps/cache settings apply.
- Rethrow cancellation from the documentation search function instead of
  reporting it as an error; return a stable, non-leaking failure message.

Sample hosts
- Add source-specific editors (fields, validation, persistence, and
  edit-time load) for the three documentation sources to the MVC and
  Blazor tool instance forms so operators can configure a site
  end-to-end.
- Add an exposed-tools editor to the MVC and Blazor MCP server settings.

Docs
- Rewrite the MCP server, documentation-search, and 1.1.0 changelog
  pages for the allow-list + tool-instance model.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tool-instance documentation sources and the McpServerOptions allow-list
are the final MCP design on this branch. The earlier capability-selection
builder (CrestAppsMcpHandlerBuilder with WithoutTools/WithoutPrompts/
WithoutResources and the WithCrestAppsHandlers configuration overload) was
added before that redesign, was never merged to main, and is superseded by
the default deny-all allow-list. Remove it so exposure is controlled solely
by McpServerOptions.

- delete CrestAppsMcpHandlerBuilder and the WithCrestAppsHandlers(configure)
  overload; WithCrestAppsHandlers() now unconditionally registers the tool,
  prompt, and resource handlers while the tool list/call handlers keep
  enforcing the McpServerOptions allow-list
- drop the unused System.Linq and Documentation usings left in the MCP
  ServiceCollectionExtensions
- remove the WithoutTools/WithoutPrompts/WithoutResources tests and the
  handler-configuration parameter from the test helper
- update the MCP server docs and 1.1.0 changelog to describe only the
  allow-list-based tool exposure

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/CrestApps.Core.Docs/docs/changelog/1.1.0.md Outdated
Comment thread src/CrestApps.Core.Docs/docs/changelog/1.1.0.md Outdated
Comment thread src/CrestApps.Core.Docs/docs/changelog/1.1.0.md
Comment thread src/CrestApps.Core.Docs/docs/mcp/documentation-search.md Outdated
Comment thread src/CrestApps.Core.Docs/docs/mcp/server.md Outdated
Comment thread src/Primitives/CrestApps.Core.AI.Mcp/Documentation/AlgoliaDocumentationSource.cs Outdated
Comment thread src/Primitives/CrestApps.Core.AI.Mcp/McpServerBuilderExtensions.cs
Comment thread src/Primitives/CrestApps.Core.AI.Mcp/McpServerBuilderExtensions.cs
MikeAlhayek and others added 4 commits August 10, 2026 07:08
Responds to Mike Alhayek's review on PR #125.

- move the documentation search tool-instance stack out of the MCP project
  (CrestApps.Core.AI.Mcp) into CrestApps.Core.AI under
  Tooling/Instances/Documentation. These are ordinary tool instance sources
  usable without the MCP server, so they no longer live in or depend on the
  MCP package. The doc HTTP client name moves to DocumentationToolConstants
  and the plain AddHttpClient registration matches the sibling
  HttpApiRequest source (no MCP-only resilience dependency)
- replace per-property [JsonPropertyName] attributes in the Algolia and
  search-index sources with a JsonSerializerOptions (web defaults / camelCase)
  passed to the serialize and deserialize calls
- skip building the allow-list in the MCP list and call handlers when
  ExposeAllTools is true
- add a Breaking Changes note to the 1.1.0 changelog: MCP servers no longer
  expose tools by default (behavior change from 1.0.0)
- reword the changelog so the documentation sources are described as tool
  instance sources (not a replacement for a never-shipped search_documentation
  tool, and not part of the MCP server builder)
- fold the standalone documentation-search page into the MCP server feature
  page and remove it from the sidebar
- clarify in the MCP server docs that ExposeAllTools ignores the Tools list
- relocate the documentation search tests to Core/Tools to match the move

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- replace the free-form exposed tools textarea in both sample apps with grouped checkbox pickers for registered tools and configured tool instances
- hide the exposed tools picker when the site setting exposes all tools and tool instances
- remove "non-hidden" wording from the sample settings UI and MCP docs/changelog wording
- populate the picker from AIToolDefinitionOptions and the AIToolInstance catalog, preserving selected values on validation errors
- add select all/deselect all controls matching the AI Profile tool picker behavior

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- add @crestapps/bootstrap-select 1.2.3 CSS and JavaScript to the MVC and Blazor sample host layouts
- document the sample-host asset update in the 1.1.0 changelog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@MikeAlhayek
MikeAlhayek merged commit c01ca01 into main Aug 10, 2026
10 checks passed
@MikeAlhayek
MikeAlhayek deleted the ma/mcp-server branch August 10, 2026 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants