From 325e16ffd8ca1d82b6c9eab3bf35a9e71b1855e6 Mon Sep 17 00:00:00 2001 From: Jan Hartman Date: Wed, 29 Oct 2025 10:42:04 +0100 Subject: [PATCH 1/2] Document result limits for MCP tools --- docs/api/mcp/index.mdx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/api/mcp/index.mdx b/docs/api/mcp/index.mdx index 973dc55af..217b78859 100644 --- a/docs/api/mcp/index.mdx +++ b/docs/api/mcp/index.mdx @@ -5,7 +5,7 @@ Supported on [Enterprise](/pricing/enterprise) plans. -Available in version 6.8 and above +Available in version 6.8 and above. This feature is [experimental](admin/beta_and_experimental_features#experimental-features) and might change or be removed in the future. The Sourcegraph Model Context Protocol (MCP) Server provides AI agents and applications with programmatic access to your Sourcegraph instance's code search, navigation, and analysis capabilities through a standardized interface. @@ -134,6 +134,10 @@ Locally-scoped servers take precedence over project-scoped servers with the same ## Available Tools + +All MCP tools implement result limits to ensure efficient operation and prevent context window overflow. These limits are designed to return the most relevant results while maintaining optimal performance. For large result sets, use pagination parameters (`after`/`before` cursors) where available, or refine your search with more specific filters. + + The MCP server provides these tools for code exploration and analysis: ### File & Repository Operations @@ -152,8 +156,6 @@ Read file contents with line numbers and support for specific ranges and revisio **Use cases:** Reading specific files, examining code sections, reviewing different versions -File size limit is 128KB. Use line ranges for larger files. - #### `sg_list_files` List files and directories in a repository path. @@ -188,10 +190,6 @@ Perform exact keyword searches with boolean operators and filters. **Features:** Boolean AND/OR operators, regex patterns - -The `sg_keyword_search` MCP tool currently returns structured content wrapped in an extra content field. This mismatch can trigger validation errors in strict MCP clients, such as the Python MCP client. A fix is planned for a future release; for now, affected clients can manually unwrap the content field as a workaround. - - #### `sg_nls_search` Semantic search with flexible linguistic matching. From a22dbb34bf6db621789c0e781ed2c08f1ee363c1 Mon Sep 17 00:00:00 2001 From: Jan Hartman Date: Wed, 29 Oct 2025 10:43:00 +0100 Subject: [PATCH 2/2] Revert accidental change --- docs/api/mcp/index.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/api/mcp/index.mdx b/docs/api/mcp/index.mdx index 217b78859..cfa418b0d 100644 --- a/docs/api/mcp/index.mdx +++ b/docs/api/mcp/index.mdx @@ -156,6 +156,8 @@ Read file contents with line numbers and support for specific ranges and revisio **Use cases:** Reading specific files, examining code sections, reviewing different versions +File size limit is 128KB. Use line ranges for larger files. + #### `sg_list_files` List files and directories in a repository path.