Commit Graph
15 Commits
Author SHA1 Message Date
Ashish Kolheandgithub-actions[bot] ed1b8de97e feat: two-way Slack app (ask OpenObserve from Slack, instance workspace) (#15553)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-21 16:07:27 +00:00
Ashish Kolhe 636c0aa9fe fix(mcp): expose database monitoring and anomaly detection APIs as MCP tools (#15485) 2026-10-17 16:20:23 +00:00
Huaijin cc9fc300b0 chore: remove dead Rust code in leaf crates and unused dependencies (#15337) 2026-10-16 06:29:26 +00:00
c31d86b291 feat(mcp): add ZO_MCP_ENABLED and stop cloning every tool schema (#14885)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2026-09-29 22:14:01 +08:00
Prabhat Sharma e59c056c5e fix(auth): only honour the MCP audience exemption on /{org}/mcp and internal loopback calls (#14947) 2026-09-29 04:42:44 +00:00
udev 0555b6c020 fix(mcp): bind tool calls to URL organization (#14448) 2026-09-15 09:16:30 +00:00
5379dbf644 fix: Derive MCP base URL scheme from the HTTP listener TLS setting (#14211)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Hengfei Yang <hengfei.yang@gmail.com>
2026-09-15 04:10:37 +00:00
Hengfei Yang 17a7102ba7 fix(mcp): stop truncating tool results in summary mode (#14221) 2026-09-07 12:01:56 +00:00
6c65fa2b23 fix: MCP SearchSQL drops agent_options output_format rows, and its cap ignores payload size (#14208)
Co-authored-by: Prabhat Sharma <hi.prabhat@gmail.com>
Co-authored-by: hengfeiyang <hengfei.yang@gmail.com>
2026-09-07 04:28:33 +00:00
Hengfei Yang eedc773cd7 chore: remove action scripts / action server (#14000) 2026-08-28 01:57:53 +00:00
Hengfei Yang 6ca0eec107 fix: MCP tool calls return 404 when ZO_BASE_URI is set (#13844)
Fixes #13845

## What changed

The MCP shared HTTP client (used to execute tool calls against the local
REST API) now includes `ZO_BASE_URI` in its base URL:
`http://localhost:{port}{base_uri}` instead of
`http://localhost:{port}`.

## Why

When `ZO_BASE_URI` is set (e.g. `/abc`), all HTTP routes are mounted
under that prefix. The MCP endpoint itself was reachable (`POST
/abc/api/default/mcp` → 200), but every tool execution failed: the
internal client sent requests to the unprefixed path and got a 404.

```
INFO rmcp_openapi::http_client: Final URL: http://localhost:5080/api/default/streams
INFO config::axum::middlewares::access_log: 127.0.0.1 "GET /api/default/streams HTTP/1.1" 404 ...
```

## Notes for reviewers

- `cfg.common.base_uri` is already normalized at config load to have no
trailing slash (empty when unset), so the empty-prefix behavior is
unchanged.
- The join semantics are safe for path-prefixed base URLs:
rmcp-openapi's `with_base_url` appends a trailing slash and `build_url`
strips the tool path's leading slash before `Url::join`, covered by the
crate's `test_build_url_with_base_url_containing_path`. So `/abc` +
`/api/{org}/streams` → `/abc/api/{org}/streams`.
- The other `localhost:5080` occurrence in `tools.rs` is a test-only
mock client; the OAuth protected-resource metadata handler already
includes `base_uri`.
- `cargo check -p openobserve-mcp` and `cargo test -p openobserve-mcp`
pass.
2026-08-17 11:44:34 +00:00
Huaijin 3d96c9670c chore: regenerate Rust CycloneDX SBOMs (#13534)
## Summary

- regenerate Rust CycloneDX SBOMs with cargo-cyclonedx cyclonedx
- update 9 existing SBOMs and add 32 workspace crate SBOMs
- exclude all generated files under src/enterprise

## Validation

- cargo-cyclonedx version: 0.5.9
- all 41 retained XML files pass xmllint --noout
- malformed vcs_url PURL pattern from 0.5.7 is absent
- git diff --check passes
- src/enterprise has no changes
2026-07-29 09:23:25 +00:00
Hengfei Yang 2bf19b2b44 feat(mcp): support MCP spec revision 2026-07-28 (stateless, dual-era server) (#13527)
Design at: #13526

## Summary

Implements MCP specification revision **2026-07-28** (stateless
protocol) alongside the existing 2025-11-25 behavior on the same
endpoint, following the spec's dual-era server model: requests carrying
modern per-request `_meta` are served per 2026-07-28, while `initialize`
selects legacy semantics. Legacy clients are unaffected.

## Changes

- **Version negotiation** (`src/api/http/.../mcp/mod.rs`,
`src/mcp/src/protocol.rs`): the `MCP-Protocol-Version` header is now
validated against a supported-version set (`2026-07-28`, `2025-11-25`)
instead of strict equality — the old check would have rejected every
client that upgrades to the new revision. Unsupported versions (header
or body `_meta`) get `400` + JSON-RPC `-32022`
(`UnsupportedProtocolVersionError`) listing the supported versions so
clients can retry.
- **`server/discover`** (`src/mcp/src/protocol.rs`): new RPC required by
2026-07-28, returning `supportedVersions`, `capabilities`, server
identity in `_meta`, `instructions`, and `ttlMs`/`cacheScope` cache
fields.
- **Modern result decoration** (`src/mcp/src/protocol.rs`): requests
declaring `io.modelcontextprotocol/protocolVersion: 2026-07-28` in
`_meta` get `resultType: "complete"` and `_meta` server identity on
results, plus `ttlMs`/`cacheScope` on `tools/list`. Legacy responses
carry none of these fields — byte-for-byte unchanged.
- **Request metadata headers** (`src/api/http/.../mcp/mod.rs`): modern
requests must mirror body fields into `Mcp-Method` / `Mcp-Name` headers
(including the Base64 sentinel encoding for `Mcp-Name`); missing or
mismatched headers are rejected with `400` + JSON-RPC `-32020`
(`HeaderMismatch`), per the transport's server-validation rules.
- **HTTP status mapping**: unknown methods on modern requests return
`404` + `-32601` so dual-era clients can distinguish a modern server
from a legacy one; version errors return `400`. Legacy requests keep
errors in-band with `200` as before.
- **Legacy paths untouched**: `initialize`, `ping`, the GET SSE
keepalive channel, DELETE no-op, and notification → `202` handling are
unchanged.

Tool ordering was already deterministic (sorted at init), satisfying the
new caching guidance.

## Testing

- `cargo test -p openobserve-mcp` — 94 tests pass (new coverage:
`server/discover` shape, unsupported-version error payload, modern
decoration, legacy non-decoration, sentinel decoding, version set).
- `cargo test -p openobserve-api-http --lib handler::http::request::mcp`
— 13 tests pass (new coverage: modern happy path, missing/mismatched
`Mcp-Method`/`Mcp-Name`, header↔body version mismatch, missing version
header on modern requests, modern unknown method → 404, legacy header
accepted).
- `cargo clippy` clean on both crates.
2026-07-29 04:14:14 +00:00
Ashish Kolhe 260d3bb634 feat(mcp): OAuth 2.0 sign-in (RFC 9728) + fix cross-org RBAC bypass and expired-JWT acceptance (#13344)
## What

Adds **MCP OAuth 2.0 sign-in** support (RFC 9728 Protected Resource
Metadata) so MCP clients — `claude mcp add`, Cursor, etc. — can discover
the Dex authorization server and complete an OAuth flow against an
OpenObserve MCP endpoint. While wiring this up, a security review of the
shared auth path found **two authentication/authorization defects**,
both fixed here.

All changes are in OSS; the auth code paths are `#[cfg(feature =
"enterprise")]` (Dex JWT validation + OpenFGA authorization), so the
security impact is on the enterprise build. Tracking issue:
**openobserve/o2-enterprise#2232**.

## Why

- MCP clients had no way to discover the auth server, so OAuth sign-in
couldn't complete.


## Changes

### MCP OAuth (RFC 9728)
- `OAuthProtectedResourceMetadata` type + handler; public
`.well-known/oauth-protected-resource` routes registered before auth
nesting so discovery stays unauthenticated.
- `WWW-Authenticate: resource_metadata=...` advertised on MCP 401
(mcp-path only), pointing clients at the per-org protected-resource
metadata.
- Return 404 for protected-resource metadata when Dex is disabled (don't
advertise an unreachable auth server).
- Header-injection hardening: the org id reflected into the
`WWW-Authenticate` challenge is charset-allowlisted and **rejected**
(not escaped), so a crafted org id can't append a second challenge.
- MCP-path detection tightened (matches the org/`mcp` path segment, so a
stream literally named `mcp` doesn't false-positive) and base_uri
duplication fixed.
2026-07-22 06:40:27 +00:00
Hengfei Yang 33d1da9b6e feat: move MCP server to OSS (#13272)
## Summary

- move the MCP protocol, tool discovery, schema simplification,
execution, and response filtering implementation into a new OSS
`openobserve-mcp` workspace crate
- enable the real MCP POST, GET, and DELETE handlers in community builds
- initialize the MCP tool catalog from the OpenAPI document for every
edition
- keep OAuth authorization-server discovery enterprise-only because it
depends on Dex
- add OSS handler and OpenAPI initialization coverage

Closes #13266
Design at: #13266

## Impact

Community users can connect MCP clients directly to OpenObserve and use
the OpenAPI-backed tool catalog. Enterprise builds continue to use the
same MCP implementation from the OSS workspace crate.

Companion PR openobserve/o2-enterprise#2206 removes the old private copy
and updates the enterprise workspace overlay.
2026-07-20 09:21:05 +00:00