Commit c9bf4db
Add
* Add `mcp` subcommand to docs-builder CLI
The MCP server was a separate project (Elastic.Documentation.Mcp) but
docs-builder had no `mcp` command, so `docs-builder mcp` crashed and
wrote colored output to stdout, breaking the MCP JSON-RPC protocol.
This adds an early intercept in Program.cs that boots the MCP server
over stdio before ConsoleAppFramework initializes, keeping stdout clean
for JSON-RPC. The MCP tool definitions (LinkTools, Responses) are shared
via linked files to avoid duplication.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add CLI documentation for `mcp` command
Adds docs/cli/mcp.md with usage and links to the MCP server
documentation. Updates the CLI index to include the new MCP section
and adds a cross-link from the MCP docs back to the CLI reference.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Refactor `mcp` as a proper ConsoleAppFramework command
Replace the early-intercept approach with a standard ConsoleAppFramework
command registration. This integrates the MCP server into the existing
CLI pipeline instead of bypassing it.
Key changes:
- Add IsMcp flag to GlobalCliArgs, detected during arg parsing.
- Redirect all logging to stderr in MCP mode via LogToStandardErrorThreshold.
- Skip heavy config registration (versions, products, search) in MCP mode.
- Return no-op diagnostics collector in MCP mode (same pattern as help/version).
- Update InfoLoggerFilter and CheckForUpdatesFilter to skip in MCP mode.
- Replace McpHost with McpCommand registered via app.Add<McpCommand>("mcp").
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Remove console logger in MCP mode instead of redirecting to stderr
Register all common services normally and simply omit the console
logging provider when IsMcp is true, keeping the logging pipeline
open for OpenTelemetry and other providers. Silence ConsoleApp.*
static log delegates via no-ops in ReplaceLogFilter.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Rename `isMcp` parameter to `noConsole` in logging setup
The parameter describes behavior (suppress console logging), not the
caller. Uses named argument at call sites for clarity.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Move MCP tool types from standalone project to assembler
Move `LinkTools` and `Responses` into
`Elastic.Documentation.Assembler.Mcp` so both docs-builder and the
standalone MCP server consume them from a single source via the
existing assembler project reference. This removes the linked files
and explicit `ModelContextProtocol` package from docs-builder.csproj.
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
* Fix imports ordering in McpCommand.cs
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>mcp subcommand to docs-builder CLI (#2687)1 parent b910d18 commit c9bf4db
16 files changed
Lines changed: 106 additions & 18 deletions
File tree
- docs
- cli
- mcp
- src
- Elastic.Documentation.Mcp
- Elastic.Documentation.ServiceDefaults
- Elastic.Documentation
- services/Elastic.Documentation.Assembler
- Mcp
- tooling/docs-builder
- Commands
- Filters
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
Lines changed: 12 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments