Commit 5400bf8
Add MCP server support to Graylog (#23462)
* initial, manual, mcp server support
* suppress audit events for testing and add changelog
* made Tool pluggable
the mcp service now uses a tool map (name to instance) to declare and call tools
the implemenation of list_streams should be replaced with resources (currently stubbed but not implemented)
basic support for json schema declaration is available but untested
* add missing license header
* add resources and generate jsonschema from input parameters
* add missing license headers
* fix: replace Nullable annotation import
* check MCP-Protocol-Version header
* fix: resources/read method implementation
* add dashboard and eventdefinitions as resources
* fix: wrong logic in MCP-Protocol-Version check
* WIP: resources-as-tools
* fix: use the right access modifier for params
* chore: specify locale
* feat(ListResourceTool): add support for pagination
* update list_resource tool description
* add systeminfo tool
* chore(ListStreamsTool): use the same format as overlord
* add list_inputs tool
* add list_indices tool
* use the same formats as overlord
* add list_index_sets tool
* add search tool
* add missing Locale
* fix: use IndexSetResponse instead of IndexSetSummary
* support prompts/list to make claude happy, it calls it even though we don't advertise supporting it. add some logging
* add prompt support and mcp proxy to use with claude desktop
* add getUser method to permission helper
* add markdown builder
* support for structured content responses
* remove unnecessary test
* fix missing license headers
* remove unused helper method
* support listing resource templates
* add kv md item from builder-like objects
* emit audit events for mcp protocol messages
* add audit events to remaining mcp protocol handlers
* revise MarkdownBuilder
* added role and permission for MCP access
users now need to have the mcp_server:access permission to be able to access the mcp endpoint
all other permission checks remain as always, this is just to selectively allow access to mcp in graylog
renamed McpResource to McpRestResource as the name was a bit ambiguous
* cannot have a public constant, make it private and add comment
* pull up PermissionHelper and hand it the current user instead of reloading it everywhere
added better exception handling to produce the correct audit event
* add test for McpService
* add SystemInfoFormattedTool for output formatting comparisons
* add MarkdownBuilderTest
* Add MCP configuration panel and storage
* remove exception from signatures
* hook up cluster config to allow disabling MCP access entirely
add minimal test (injection is a pain unfortunately)
fix in memory cluster config service to work with AutoValue classes
* Remove disclaimers
* Remove unused import
* add jakarta jsonschema module and include default values in tool schema
* include searchuser from resource context and migrate search tool to scripting api
* convert to junit5
* simplify test, for some unknown reason the injector fails on CI
* remove unused subject in scripting api signatures, add field list to tool, refactor to fit test
* add aggregate_messages tool
* adjust jsonschema generator to avoid creating () suffix for field-derived properties
* add list_fields tool
* add response trace log for debugging purposes
* make schema generators customizable from plugins
* Add tool for getting current time
* honor @jsonvalue annotations
some enums have a value annotation to serialize as lower-case
not looking at this when creating the output schema leads to validation failures with strict clients
fix #23880
* remove static prompt, we don't have a good mechanism to ship these for now
* fix prompt call tests
* add permission checks to ResourceProviders, also used by the corresponding tools for resources
* fix inverted permission check
* move permission check to viewService call
* lower log levels and remove mcp library logger config
* remove mcp proxy implementation, there are better prebuilt versions out there
* move mcp related dependencies into top level pom
* address review comments for mcp rest resource
* replace NotFoundException in resources with Optional return value, adapt call sites and tests
* address review comments, remove hardcoded product name, remove commented code
* Set enable_remote_access to false by default
* Switch log statement in McpService to DEBUG
* Remove traces of org.graylog2.database.NotFoundException
Especially from the ResourceProvider interface Javadoc.
* Remove product name from DashboardResourceProvider
* Use content-type constants in McpRestResource
* Use CustomizationConfig#productName instead of hardcoding "Graylog"
* Inject GRNRegistry instead of using a static creator
Otherwise, we will miss some types from plugins.
* Cleanup variable definition in McpService
* Remove commented code from PaginatedList
* More product name removal
* Remove product name from and cleanup ListIndexSetsTool
* Add missing permission check to and cleanup ListIndicesTool
* Fix whitespace in output
* Remove product name and mention of pagination
* Remove product name and commented code from ListStreamsTool
* Fix warnings in PermissionHelper
* Remove product name from ReadResourceTool
* simplify tool, pagination isn't supported, so we take it out. use explicit return records instead of paginated list of lists
* Remove product name from SearchMessagesTool and document limit parameter
* Use customized product name instead of hardcoded "Graylog"
Bind SystemInfoFormattedTool.
* remove paginatedlist, we can't reasonably support pagination right now
* Get cluster ID from ServerStatus
* Return a result if tool call failed in McpService
* Adjust McpConfig.tsx
- Remove telemetry comment as we apparently don't need it
- Use "MCP Server" for clarification
- Remove obsolete permission comment
* Re-add customized product name to doc strings
* Fix McpServiceTest
* be extra cautious and add markdown escaping in case this ever gets presented with user input
* Fix string format argument in McpService to return error message
* Add Javadoc to CurrentTimeTool
---------
Co-authored-by: Ramon Marquez <[email protected]>
Co-authored-by: robfromboulder <[email protected]>
Co-authored-by: Bernd Ahlers <[email protected]>
Co-authored-by: Bernd Ahlers <[email protected]>1 parent ac3f307 commit 5400bf8
File tree
49 files changed
+4840
-17
lines changed- changelog/unreleased
- graylog2-server
- src
- main/java/org
- graylog2
- audit
- commands
- migrations
- plugin
- graylog
- jsonschema
- mcp
- config
- resources
- server
- tools
- plugins/views/search/rest/scriptingapi
- mapping
- test/java/org/graylog
- mcp/server
- security/certutil
- graylog2-web-interface/src
- components/configurations
- pages
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
49 files changed
+4840
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
797 | 797 | | |
798 | 798 | | |
799 | 799 | | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
800 | 816 | | |
801 | 817 | | |
802 | 818 | | |
| |||
Lines changed: 61 additions & 0 deletions
| 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 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
Lines changed: 36 additions & 0 deletions
| 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 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
Lines changed: 114 additions & 0 deletions
| 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 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
Lines changed: 108 additions & 0 deletions
| 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 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
0 commit comments