feat: add ECS MCP server#2623
Conversation
Introduce `ecs-mcp`, a Go-based Model Context Protocol server that loads
every tagged ECS release (>= v1.12.0) from a local or cloned ECS repo into
a SQLite database and exposes it to MCP clients over stdio or HTTP.
The server provides four tools backed by per-version field, fieldset, and
expected-event-type tables:
- ecs_get_sql_tables return the SQLite schema
- ecs_match_fields check whether dotted field names exist in a
given ECS version
- ecs_search_fields FTS search over field definitions, with
camelCase / dotted-path tokenization
- ecs_execute_sql_query run arbitrary read-only SQLite queries
An embedded guide (ecs_guide.md) is served as an MCP prompt to teach
clients the version-scoped query workflow used for mapping package
fields to ECS.
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
ECS PR Triage (automated)PR Triage ReportPR: #2623 — feat: add ECS MCP server SummaryThis PR introduces a new Go-based MCP (Model Context Protocol) server under Files changed
Routing decisionThis PR is classified as Needs Discussion rather than a straightforward Direct PR for the following reasons:
Risk notes
Completeness checklist
Recommended next actions
Posted by PR Triage workflow |
| //2. Split camelCase tokens (e.g. "ProcessTTYAttached" → "Process TTY Attached") | ||
| //3. Join plain terms with OR for additive discovery ranking | ||
| sanitized := sanitizeFTSQuery(query) | ||
| sanitized = splitCamelCase(query) |
There was a problem hiding this comment.
@taylor-swanson should you be feeding in the sanitized result back into the splitCamelCase
Similarly for the line below implicitOR(sanitized)
There was a problem hiding this comment.
Good catch, I'll fix that.
| results = append(results, result) | ||
| } | ||
| if rows.Err() != nil { | ||
| return nil, err |
There was a problem hiding this comment.
should it be
if err = rows.Err(); err != nil {
return nil, err
}
?
qcorporation
left a comment
There was a problem hiding this comment.
Two fundamental questions:
-
should we have any CI tests for future contributions?
-
ecs predominately is generally written in python - this is a new toolchain. I know this is a bit late but do we want to introduce this toolchain into the ecs repo?
-
Should we be adding changelog
Yeah this was an oversight on my part... can certainly add tests and getting that running in CI is trivial.
I suppose this is tooling, but it's not used in the process of ECS itself... so it sits somewhere else I feel. More on this below.
This isn't related to the tools in Would something like an |
|
I think having it separate is a better idea anyway, since while the tool itself consumes ECS, it is not ECS nor does it build ECS (if that makes sense). |
|
New PR here in the elastic/ecs-tools repo: elastic/ecs-tools#1 |
go-ecs