Skip to content

Conversation

@sergical
Copy link
Member

@sergical sergical commented Jan 31, 2026

Summary

Adds a Model Context Protocol (MCP) server to expose Sentry documentation to AI assistants, plus vitest-evals based evaluation tests to verify tool selection quality.

MCP Server

Endpoint: /mcp (HTTP Streamable transport)

Tools

Tool Description
search_docs Search Sentry documentation with optional platform filtering
get_doc Fetch full markdown content of a documentation page
list_platforms List available SDK platforms and their guides
get_doc_tree Get documentation structure for navigation

Evaluation Tests

Uses Claude Sonnet 4.5 as the scoring model to verify AI assistants correctly select MCP tools.

Test Coverage

Tool Test Cases Description
search_docs 6 SDK setup queries, configuration questions, feature lookups
get_doc 5 Direct path requests, follow-up after search
list_platforms 6 Platform discovery, guide enumeration
get_doc_tree 6 Navigation queries, structure exploration

Score Results

All 23 tests pass with scores between 0.85 - 1.0:

  • 17 tests: 1.00 (perfect match)
  • 2 tests: 0.95 (excellent match)
  • 4 tests: 0.85 (good match)

Threshold is 0.6 for passing.

Usage

# Run evals in watch mode
yarn eval

# Run evals once
yarn eval:run

Requires ANTHROPIC_API_KEY in .env.local for evals.

Test plan

  • yarn lint:ts passes
  • yarn eval:run passes (23/23 tests)

🤖 Generated with Claude Code

Add vitest-evals based testing to verify AI assistants correctly select
MCP tools. Uses Claude Sonnet 4.5 as the scoring model to predict which
tools would be called for given user queries.

Test coverage:
- search-docs: 6 test cases for documentation search
- get-doc: 5 test cases for fetching doc content
- list-platforms: 6 test cases for platform discovery
- get-doc-tree: 6 test cases for navigation structure

All 23 tests pass with scores ranging from 0.85 to 1.0.

Usage:
- yarn eval: Run evals in watch mode
- yarn eval:run: Run evals once

Requires ANTHROPIC_API_KEY in .env.local

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
develop-docs Ready Ready Preview, Comment Jan 31, 2026 10:23pm
sentry-docs Ready Ready Preview, Comment Jan 31, 2026 10:23pm

Request Review

Add Model Context Protocol server exposing Sentry documentation to AI
assistants. Provides 4 tools:

- search_docs: Search documentation with optional platform filtering
- get_doc: Fetch full markdown content of a documentation page
- list_platforms: List available SDK platforms and their guides
- get_doc_tree: Get documentation structure for navigation

Endpoint: /mcp (HTTP Streamable transport)

Co-Authored-By: Claude <noreply@anthropic.com>
@sergical sergical changed the title feat(mcp): Add AI-powered evaluation tests for MCP server tools feat(mcp): Add MCP server for Sentry docs with AI-powered evals Jan 31, 2026
…tization

Fixes GitHub Advanced Security alert for incomplete multi-character
sanitization. The regex `/<[^>]*>/g` can leave partial tags when input
contains nested angle brackets (e.g., `<<script>` → `<script>`).

The new `stripHtmlTags()` helper applies the regex iteratively until
no more tags remain, preventing XSS vulnerabilities from malformed HTML.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
sergical and others added 2 commits January 31, 2026 17:11
…ait errors

- Add try/catch to search_docs tool matching pattern used by other MCP tools
- Fix require-await ESLint errors in eval files by using Promise.resolve()
  instead of unnecessary async functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

// Skip trailing slash redirect for MCP and API routes
if (pathname.startsWith('/mcp') || pathname.startsWith('/api')) {
return NextResponse.next();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overly broad path check skips trailing slashes incorrectly

Low Severity

The condition pathname.startsWith('/mcp') is too broad and would match any path beginning with those characters (e.g., /mcp-guide, /mcpfoo), not just the actual MCP endpoint at /mcp. Such paths would incorrectly skip the trailing slash redirect that all other documentation pages receive. The check for pathname.startsWith('/api') is also redundant since the middleware matcher already excludes /api paths via the negative lookahead regex.

Fix in Cursor Fix in Web

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