This project implements a Model Context Protocol (MCP) server designed to provide context about the modelcontextprotocol/typescript-sdk repository and its documentation.
Features
- Fetches File Content: Retrieves the content of specific files directly from the
modelcontextprotocol/typescript-sdkGitHub repository (latest version on the default branch). - Searches Repository: Allows searching for code within the
modelcontextprotocol/typescript-sdkrepository using the GitHub API. - Searches Documentation (Placeholder): Includes a placeholder for searching the official
modelcontextprotocol.iodocumentation website (requires integration with an external search tool like Bing Search).
Setup
- Install Dependencies:
npm install - Configure Environment:
- Create a
.envfile in the project root. - Add your GitHub Personal Access Token:
(Ensure the token has permissions to read public repositories)GITHUB_TOKEN=YOUR_GITHUB_TOKEN_HERE
- Create a
- Build the Server:
npm run build
Running the Server
- Directly:
npm start - Via MCP Client (e.g., VS Code):
Configure your MCP client to use the settings in
.vscode/mcp.json. This typically involves specifying the server name (typescript-sdk-context) and the launch command (node dist/index.js).
How it Works
The server listens for MCP requests over standard input/output (stdio). When a client requests a tool execution:
- The server identifies the requested tool (
getGithubFileContent,searchGithubRepo,searchDocumentationWebsite). - It uses the
@octokit/restlibrary (authenticated with yourGITHUB_TOKEN) to interact with the GitHub API for file fetching and code search. - For website search, it currently returns a placeholder message (integration with a search API like Bing is needed for full functionality).
- The results are formatted as MCP content and sent back to the client.