chore(sample-code): replace deprecated GitHub MCP server with native-fetch tools - #2153
chore(sample-code): replace deprecated GitHub MCP server with native-fetch tools#2153InjunPark-sap wants to merge 17 commits into
Conversation
|
Deprecated Guardrail: repo scope enforced at the API call — repo hardcoded in every URL, |
| function scopedQuery(term: string): string { | ||
| const stripped = (term ?? '') | ||
| .replace(/(?:^|\s)(?:repo|org|user):[^\s]*/gi, '') | ||
| .replace(/\b(?:OR|AND|NOT)\b/g, '') |
There was a problem hiding this comment.
Verify this, but it might also be possible to add 5 AND/NOT/OR instead, any more and searches are rejected. (e.g. AND repo:sap/ai-sdk-js).
There was a problem hiding this comment.
Verified. The 5-operator cap is real (422 on the 6th). But the only actual scope-bypass is an injected repo:/org:/user: qualifier — repo:SAP/ai-sdk-js foo OR repo:golang/go bar leaks the other repo (9754 hits in my test).
Bare OR/AND/NOT never widen scope; the leading repo: binds the whole query. So I dropped the OR/AND/NOT strip and kept only the qualifier strip — boolean search works now, GitHub's 5-op limit handles the rest.
Co-authored-by: David Knaack <david.knaack@sap.com>
context7 → hosted HTTP transportPer David's review: switched context7 from local stdio spawn to the hosted HTTP endpoint (
Verified: |
|
Widened the issue-reply trigger to all opened issues (was It's an open-source repo — most support questions are from external users, exactly who the old filter skipped. Abuse surface stays bounded: Slack-only, no auto issue reply, so a spam filing costs one model call + one Slack line. Per-issue concurrency guard unchanged. |
… preamble, chore(sample-code): use claude-4.6-sonnet for the support bot for reliable tool use
… temperature:0, and a self-verify pass
SummaryThe following content is AI-generated and provides a summary of the pull request: Replace Deprecated GitHub MCP Server with Native-Fetch ToolsContextCloses SAP/ai-sdk-js-backlog#641. What this PR does and why it is neededReplaces the deprecated Key changes
PR Bot InformationVersion:
|
…ture:0, verify rules, and a self-verify pass
| import { z } from 'zod'; | ||
| import type { StructuredToolInterface } from '@langchain/core/tools'; | ||
|
|
||
| // Native-fetch GitHub tools — replaces the deprecated @modelcontextprotocol/server-github. |
There was a problem hiding this comment.
[q] This seems odd to me. The deprecation note states that there seems to be a replacement: https://www.npmjs.com/package/@modelcontextprotocol/server-github can't we use that somehow? (=>https://github.com/github/github-mcp-server)
There was a problem hiding this comment.
The successor is github/github-mcp-server which is a Go binary + hosted endpoint, not a Node drop-in.
The hosted /readonly URL fits our transport but has no single-repo scoping (only toolset/token), whereas this module hardcodes repo:SAP/ai-sdk-js so the model can't reach other repos.
Keeping that would need a fine-grained single-repo PAT — for a read-only Slack-only bot the 166-LOC module is the smaller bet.
KavithaSiva
left a comment
There was a problem hiding this comment.
I would like to try out alternate implementation with opencode that could simplify the agent loop and uses github mcp server instead. I will open another PR, and then we can evaluate.
| "text": ("Support Issue: " + $url + "\n\n" + $answer) | ||
| }' > /tmp/slack-payload.json | ||
|
|
||
| - name: Notify Slack |
There was a problem hiding this comment.
[q] Which slack channel does this get posted to?
There was a problem hiding this comment.
#ai-sdk-js-support
Context
Closes SAP/ai-sdk-js-backlog#641.
What this PR does and why it is needed
Replaces the deprecated
@modelcontextprotocol/server-githubMCP with four native-fetchtools (github-tools.ts), reusing the same tool names so the agent loop is untouched.Repo scope is enforced in the URL — the model only passes a term / issue number / path, never
owner,repo, or a raw query, so scope-widening tricks can't work. No new dependency.Also folds in the post-merge follow-ups:
throwOnLoadError: false+ context7 libraryId allowlist (agent.ts), head+tail code-block truncation (reply.ts), and knowledge entries for prompt-registry / document-grounding / llm-batch (knowledge.ts).No Changeset (private package), no REUSE header (wildcard), no public API change.