GitHub to MCP
Convert any GitHub repository into an MCP server in seconds
Give Claude, ChatGPT, Cursor, Windsurf, Cline, and any AI assistant instant access to any codebase.
๐ Web App โข
๐ Quick Start โข
โจ Features โข
๐ Docs
๐ Table of Contents
๐ Introduction
GitHub to MCP bridges the gap between code repositories and AI assistants. Instead of manually describing APIs or copying code snippets into chat windows, this tool generates a standardized interface that allows AI systems to programmatically explore, read, and interact with any GitHub repository.
The generated MCP servers provide tools that AI assistants can invoke to read files, search code, list directory structures, and call API endpoints discovered within the repository. This enables AI assistants to have deep, structured access to codebases without requiring manual context management.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GitHub Repository โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 1. Fetch & Classify โ Detect repo type (API/CLI/Lib) โ
โ 2. Extract Tools โ OpenAPI, GraphQL, Code, README โ
โ 3. Generate Server โ TypeScript or Python MCP server โ
โ 4. Bundle Output โ Complete package with dependencies โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Ready-to-use MCP Server + Config โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ What is MCP
The Model Context Protocol (MCP) is an open standard developed by Anthropic that defines how AI assistants communicate with external tools and data sources. MCP servers expose "tools" that AI models can invoke, along with "resources" that provide context and "prompts" that guide interactions.
When you connect an MCP server to an AI assistant like Claude Desktop, the assistant gains the ability to call the tools defined by that server. For example, a GitHub MCP server might expose tools like read_file, search_code, or list_pull_requests, which the AI can invoke to gather information needed to answer questions or complete tasks.
This project generates MCP servers from GitHub repositories, automatically creating tools based on the repository's contents, APIs, and documentation.
๐ Quick Start
๐ Web UI (Easiest)
Visit github-to-mcp.vercel.app โ Paste any GitHub URL, click Generate, download your MCP server.
๐ป CLI (One Command)
npx @nirholas/github-to-mcp https://github.com/stripe/stripe-node
๐ฆ Programmatic (For Automation)
import { generateFromGithub } from '@nirholas/github-to-mcp';
const result = await generateFromGithub('https://github.com/stripe/stripe-node');
console.log(`Generated ${result.tools.length} tools`);
await result.save('./my-mcp-server');
โจ Features
๐ฌ Repository Analysis
- Automatic repository type classification (API, library, CLI tool, MCP server, documentation)
- Detection and parsing of OpenAPI/Swagger specifications
- GraphQL schema extraction and query/mutation tool generation
- gRPC/Protobuf service definition parsing
- AsyncAPI specification support for event-driven APIs
- Source code analysis for function extraction
|
๐ Multi-Language Support
Input repositories:
- TypeScript and JavaScript
- Python
- Go
- Java and Kotlin
- Rust
- Ruby
- C# and F#
Output MCP servers:
- TypeScript (using the official MCP SDK)
- Python (using the MCP Python SDK)
- Go (using community MCP libraries)
|
๐ง Tool Extraction
- OpenAPI endpoints become callable tools with typed parameters
- GraphQL queries and mutations become tools with input validation
- Python functions decorated with
@mcp.tool are preserved
- CLI commands documented in READMEs become executable tools
- HTTP route handlers from popular frameworks are detected
|
โก Code Generation
- Complete, runnable MCP server code with all dependencies
- Configuration files for Claude Desktop, Cursor, and other clients
- Docker deployment templates
- TypeScript type definitions for all generated tools
|
๐ฅ Installation
From Source
Clone the repository and install dependencies:
git clone https://github.com/nirholas/github-to-mcp.git
cd github-to-mcp
pnpm install
pnpm build
Using the Web Interface
The web application is deployed at github-to-mcp.vercel.app. Use the browser-based interface without any local installation.
๐ Usage
๐ Web Interface
The web interface provides the simplest way to convert repositories:
- Navigate to the web application
- Enter a GitHub repository URL (e.g.,
https://github.com/owner/repo)
- Optionally configure extraction options
- Click "Generate" to analyze the repository
- Review the generated tools and code
- Download the MCP server package or copy the configuration
The web interface also provides an interactive playground where you can test generated tools before downloading.
๐ป Command Line Interface
After building the project locally, you can use the CLI:
# Basic usage
node packages/core/dist/cli.mjs https://github.com/owner/repo
# Specify output directory
node packages/core/dist/cli.mjs https://github.com/owner/repo --output ./my-mcp-server
# Generate Python instead of TypeScript
node packages/core/dist/cli.mjs https://github.com/owner/repo --language python
# Include only specific extraction sources
node packages/core/dist/cli.mjs https://github.com/owner/repo --sources openapi,readme
# Use a GitHub token for private repos or higher rate limits
GITHUB_TOKEN=ghp_xxx node packages/core/dist/cli.mjs https://github.com/owner/repo
๐ฆ Programmatic API
Import the generator in your own TypeScript or JavaScript code:
import { GithubToMcpGenerator } from '@nirholas/github-to-mcp';
const generator = new GithubToMcpGenerator({
githubToken: process.env.GITHUB_TOKEN,
sources: ['openapi', 'readme', 'code'],
outputLanguage: 'typescript'
});
const result = await generator.generate('https://github.com/owner/repo');
console.log(`Repository: ${result.name}`);
console.log(`Classification: ${result.classification.type}`);
console.log(`Generated ${result.tools.length} tools`);
// Access the generated code
console.log(result.code);
// Save to disk
await result.save('./output-directory');
๐ Generator Options Interface
interface GithubToMcpOptions {
// GitHub personal access token for API authentication
githubToken?: string;
// Which sources to extract tools from
// Default: ['openapi', 'readme', 'code', 'graphql', 'mcp']
sources?: Array<'openapi' | 'readme' | 'code' | 'graphql' | 'grpc' | 'mcp'>;
// Output language for generated server
// Default: 'typescript'
outputLanguage?: 'typescript' | 'python' | 'go';
// Include universal tools (read_file, list_files, etc.)
// Default: true
includeUniversalTools?: boolean;
// Maximum number of tools to generate
// Default: 100
maxTools?: number;
// Specific branch to analyze
// Default: repository's default branch
branch?: string;
}
โ๏ธ How It Works
The conversion process follows these stages:
๐ท๏ธ Repository Classification
The generator first analyzes the repository to determine its type and structure:
- Fetch repository metadata from the GitHub API
- Download and parse the README file
- Examine package.json, setup.py, go.mod, or other manifest files
- Scan for API specification files (openapi.json, schema.graphql, etc.)
- Classify the repository as one of: