Skip to content

MCP: stacked improvements (5 commits for upstream PRs)#15

Draft
endolith wants to merge 6 commits into
mainfrom
cursor/mcp-consolidated-9269
Draft

MCP: stacked improvements (5 commits for upstream PRs)#15
endolith wants to merge 6 commits into
mainfrom
cursor/mcp-consolidated-9269

Conversation

@endolith

@endolith endolith commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Five independent commits on main, each suitable for a separate upstream PR. This PR is the full stack (commit 5 of 5); merge in order or review commit-by-commit.

Commit stack (oldest → newest)

# Commit Branch tip Upstream PR topic
1 098a7fe split/mcp1-get-message-paging Windowed get_message body reading (+ max_chars clamp)
2 d819d71 split/mcp2-search-in-message search_in_message tool
3 cc0b70b split/mcp3-search-message-bodies Split search_message_bodies; metadata-only search_messages; hybrid bulk hydration
4 b9f1ef6 split/mcp4-vector-chunk-matches Vector chunk matches[]; unified match shape across search tools
5 994be4a split/mcp5-tool-schema-docs Tool schema docs + contract tests

Pagination (search_messages / list_messages limits) is already on upstream main (kenn-io#388).

Supersedes

Closes the scattered fork PRs #8#12, #14 in favor of this stack.

Usage

  • Metadata: search_messages (omit mode)
  • Body keyword: search_message_bodiesmatches[]
  • Semantic: search_messages mode=vector|hybridmatches[] with scores
  • Within message: search_in_message (mode=keyword or mode=vector)
  • Read body: get_message with offset / center_at
Open in Web Open in Cursor 

@cursor cursor Bot changed the title MCP: consolidated search, body paging, and vector chunk matches MCP: stacked improvements (5 commits for upstream PRs) Jun 25, 2026
@cursor cursor Bot force-pushed the cursor/mcp-consolidated-9269 branch from f178e1d to 994be4a Compare June 25, 2026 23:47
@cursor cursor Bot force-pushed the cursor/mcp-consolidated-9269 branch from 994be4a to 1918da5 Compare June 25, 2026 23:56
Return body_text as a paginated slice instead of the full message body.
Adds offset, center_at, max_chars (default 2000, max 4000), body_length,
body_returned, and has_more so agents can page through long messages or
jump to a match via center_at (byte offset from search_in_message).

Values above maxBodyChars clamp to 4000; zero or negative max_chars use
the default.

Guard against Engine.GetMessage returning (nil, nil) for not-found.
Return UTF-8-adjusted offset, body_returned, and has_more so sequential
paging (offset += body_returned) does not skip multibyte characters.

Co-authored-by: endolith <endolith@gmail.com>
@cursor cursor Bot force-pushed the cursor/mcp-consolidated-9269 branch from 1918da5 to 6482bda Compare June 26, 2026 14:07
cursoragent and others added 5 commits June 26, 2026 14:07
New tool finds all occurrences of a term in one message body, returning
char_offset, line, and a centered snippet per match. Adds extractContextChar
helper (used by search results in a follow-up PR) with UTF-8-safe windows.

Co-authored-by: endolith <endolith@gmail.com>
search_messages (no mode) searches metadata only via SearchFast — subject,
snippet, sender, labels, dates. Full-body keyword search moves to the new
search_message_bodies tool with context excerpts around matched terms.

Vector/hybrid modes stay on search_messages; hybrid results hydrate via
GetMessageSummariesByIDs (no per-hit GetMessage) matching upstream kenn-io#388.

Co-authored-by: endolith <endolith@gmail.com>
Add ChunkScoringBackend.ScoreMessageChunks to score every embedded chunk
within a message against the query vector.

- search_messages mode=vector|hybrid: each hit includes matches[] (up to 5
  chunks, best similarity first; optional min_score)
- search_in_message mode=vector: paginated semantic chunk matches
- search_message_bodies: context_snippets renamed to matches[] with
  char_offset and line for consistency across search tools

Hybrid engine returns QueryVector in ResultMeta to avoid re-embedding when
enriching search results.

Co-authored-by: endolith <endolith@gmail.com>
Document supported search_messages query operators (subset of Gmail syntax),
metadata-only default search vs search_message_bodies for body FTS, body
query syntax (ANDed terms, quoted phrases, filter vs free-text), and
matches_truncated on capped excerpt lists.

Clarify aggregate group_by=time buckets by calendar year. Add schema
contract tests and toolPropertyDescription helper for mcp-go map schemas.
Update docs/usage/chat.md.

Co-authored-by: endolith <endolith@gmail.com>
Rebase left duplicate bodyByteSlice/contextWindow helpers; keep a single
bodyByteSliceRange-based implementation. Use local assert helpers in new
tests for testify-helper-check.

Co-authored-by: endolith <endolith@gmail.com>
@cursor cursor Bot force-pushed the cursor/mcp-consolidated-9269 branch from 6482bda to 9c1f7d3 Compare June 26, 2026 14:07
@endolith

Copy link
Copy Markdown
Owner Author

(See kenn-io#388 and kenn-io#421)

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