Github to MCP
Description
Convert GitHub repositories to MCP servers automatically. Extract tools from OpenAPI, GraphQL & REST APIs for Claude Desktop, Cursor, Windsurf, Cline & VS Code. AI-powered code generation creates type-safe TypeScript/Python MCP servers. Zero config setup - just paste a repo URL…
About
Convert GitHub repositories to MCP servers automatically. Extract tools from OpenAPI, GraphQL & REST APIs for Claude Desktop, Cursor, Windsurf, Cline & VS Code. AI-powered code generation creates type-safe TypeScript/Python MCP servers. Zero config setup - just paste a repo URL. Built for AI assistants & LLM tool…
Details
- Author
- nirholas
- Categories
- Web Scraping, Other, API, Developer Tools, Automation
Jump to
Setup
Install Github to MCP in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/nirholas/github-to-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
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
- Introduction
- What is MCP
- Quick Start
- Features
- Installation
- Usage
- How It Works
- Generated Tools
- Configuration
- Integrating with AI Assistants
- Interactive Playground
- Project Structure
- Development
- Architecture Overview
- Supported Input Formats
- Output Formats
- Limitations
- Troubleshooting
- Contributing
- License
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 │ └─────────────────────────────────────────────────────────────┘
TheModel 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 likeread_file,search_code, orlist_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.
Visitgithub-to-mcp.vercel.app— Paste any GitHub URL, click Generate, download your MCP server.
npx @nirholas/github-to-mcp https://github.com/stripe/stripe-node
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');
- 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
- TypeScript and JavaScript
- Python
- Go
- Java and Kotlin
- Rust
- Ruby
- C# and F#
- TypeScript (using the official MCP SDK)
- Python (using the MCP Python SDK)
- Go (using community MCP libraries)
- OpenAPI endpoints become callable tools with typed parameters
- GraphQL queries and mutations become tools with input validation
- Python functions decorated with@mcp.toolare preserved
- CLI commands documented in READMEs become executable tools
- HTTP route handlers from popular frameworks are detected
- 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
Clone the repository and install dependencies:
git clone https://github.com/nirholas/github-to-mcp.git cd github-to-mcp pnpm install pnpm build
The web application is deployed atgithub-to-mcp.vercel.app. Use the browser-based interface without any local installation.
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.
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
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');
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; }
The conversion process follows these stages:
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:
Classification influences which extraction strategies are prioritized and how tools are named.
Tools are extracted from multiple sources within the repository:
- Parse the specification (JSON or YAML, v2 or v3)
- Extract each endpoint as a potential tool
- Convert path parameters, query parameters, and request bodies to tool input schemas
- Generate descriptions from operation summaries and descriptions
- Map HTTP methods to appropriate tool semantics
- Parse .graphql or .gql schema files
- Extract Query type fields as read-only tools
- Extract Mutation type fields as write tools
- Convert GraphQL input types to JSON Schema for tool inputs
- Handle nested types and custom scalars
- Code blocks showing CLI usage patterns
- API endpoint examples with curl or fetch
- Function call examples with parameters
- Installation and usage instructions
Extracted examples become tools with inferred parameter schemas.
For supported languages, the source code is analyzed:
- Python: Functions decorated with@mcp.tool,@server.tool, or similar
- TypeScript: Exported functions with JSDoc annotations
- Go: HTTP handlers from Gin, Echo, Chi, Fiber, or Gorilla Mux
- Java/Kotlin: Methods annotated with@GetMapping,@PostMapping, etc.
- Rust: Route handlers from Actix-web, Axum, or Rocket
If the repository is already an MCP server:
- Detectserver.tool()definitions
- Extract tool names, descriptions, and schemas
- Preserve existing tool implementations where possible
After tools are extracted, the generator produces:
- A main server file implementing the MCP protocol
- Tool handler functions for each extracted tool
- Type definitions for all input and output schemas
- A package.json or equivalent with required dependencies
- Configuration files for popular MCP clients
- Optional Docker deployment files
The generated code is complete and runnable without modification.
Every generated MCP server includes these baseline tools for repository exploration:
These tools ensure that even if no APIs or functions are detected, the AI assistant can still explore and understand the repository.
Additional tools are generated based on repository contents:
POST /users → create_user(name: string, email: string) GET /users/{id} → get_user(id: string) PUT /users/{id} → update_user(id: string, name?: string, email?: string) DELETE /users/{id} → delete_user(id: string) GET /users → list_users(page?: number, limit?: number)
type Query { user(id: ID!): User → get_user(id: string) users(first: Int): [User] → list_users(first?: number) } type Mutation { createUser(input: CreateUserInput!): User → create_user(input: object) }
@server.tool() async def analyze_sentiment(text: str) -> str: """Analyze the sentiment of the given text.""" # Implementation
Becomes:analyze_sentiment(text: string)→ "Analyze the sentiment of the given text."
# Create a new project mycli create --name myproject --template typescript
Becomes:mycli_create(name: string, template?: string)
Without a token, GitHub API requests are limited to60 per hour. With a token, the limit increases to5,000 per hour. For private repositories, a token with appropriate access is required.
Create a token at:https://github.com/settings/tokens
- repo(for private repositories)
- public_repo(for public repositories only)
When using the programmatic API, you can configure:
const generator = new GithubToMcpGenerator({ // Authentication githubToken: process.env.GITHUB_TOKEN, // Extraction sources to enable sources: ['openapi', 'readme', 'code', 'graphql', 'grpc', 'mcp'], // Output configuration outputLanguage: 'typescript', // or 'python', 'go' // Tool filtering includeUniversalTools: true, maxTools: 100, // Repository options branch: 'main', // specific branch to analyze });
Add the generated server to your Claude Desktop configuration:
{ "mcpServers": { "my-repo": { "command": "node", "args": ["/absolute/path/to/generated/server.mjs"], "env": { "GITHUB_TOKEN": "ghp_xxxx" } } } }
⚠️ Restart Claude Desktop after modifying the configuration.
Cursor supports MCP servers through its settings. Add the server path in Cursor's MCP configuration panel, or edit the configuration file directly:
{ "mcp": { "servers": { "my-repo": { "command": "node", "args": ["/path/to/server.mjs"] } } } }
If using the Continue extension for VS Code:
{ "models": [...], "mcpServers": { "my-repo": { "command": "node", "args": ["/path/to/server.mjs"] } } }
Any MCP-compatible client can use the generated servers. The server communicates over stdio by default, accepting JSON-RPC messages on stdin and responding on stdout.
The server will wait for MCP protocol messages on stdin.
The web application includes an interactive playground for testing generated tools:
- After generating tools from a repository, click"Open in Playground"
- Select a tool from the list
- Fill in the required parameters
- Click"Execute"to run the tool
- View the JSON response
The playground executes tools in a sandboxed environment and displays results in real-time.
You can share your generated tools with others:
https://github-to-mcp-web-lp642k3kpa-uc.a.run.app/playground?gist=abc123&name=My%20API
github-to-mcp/ ├── 📂 apps/ │ ├── 📂 web/ # Next.js web application │ │ ├── 📂 app/ # Next.js App Router pages │ │ │ ├── 📂 api/ # API routes for conversion │ │ │ ├── 📂 convert/ # Conversion page │ │ │ ├── 📂 playground/ # Interactive playground │ │ │ └── 📂 dashboard/ # User dashboard │ │ ├── 📂 components/ # React components │ │ ├── 📂 hooks/ # Custom React hooks │ │ ├── 📂 lib/ # Utility functions │ │ └── 📂 types/ # TypeScript type definitions │ └── 📂 vscode/ # VS Code extension (in development) │ ├── 📂 packages/ │ ├── 📂 core/ # Main conversion engine │ │ └── 📂 src/ │ │ ├── index.ts # GithubToMcpGenerator class │ │ ├── github-client.ts # GitHub API client │ │ ├── readme-extractor.ts # README parsing │ │ ├── code-extractor.ts # Source code analysis │ │ ├── graphql-extractor.ts # GraphQL schema parsing │ │ ├── mcp-introspector.ts # Existing MCP server detection │ │ ├── python-generator.ts # Python output generation │ │ ├── go-generator.ts # Go output generation │ │ └── types.ts # Type definitions │ │ │ ├── 📂 openapi-parser/ # OpenAPI specification parser │ │ └── 📂 src/ │ │ ├── parser.ts # OpenAPI parsing logic │ │ ├── analyzer.ts # Endpoint analysis │ │ ├── transformer.ts # Schema transformation │ │ └── generator.ts # Tool generation │ │ │ ├── 📂 mcp-server/ # MCP server utilities │ │ └── 📂 src/ │ │ ├── server.ts # Base MCP server implementation │ │ └── tools.ts # Tool registration helpers │ │ │ └── 📂 registry/ # Tool registry management │ └── 📂 src/ │ └── index.ts # Registry operations │ ├── 📂 mkdocs/ # Documentation site (MkDocs) │ ├── 📂 docs/ # Markdown documentation │ └── mkdocs.yml # MkDocs configuration │ ├── 📂 tests/ # Integration tests │ ├── 📂 fixtures/ # Test fixture repositories │ │ ├── 📂 express-app/ # Express.js test app │ │ ├── 📂 fastapi-app/ # FastAPI test app │ │ ├── 📂 graphql/ # GraphQL test schemas │ │ └── 📂 openapi/ # OpenAPI test specs │ └── 📂 integration/ # Integration test files │ ├── 📂 templates/ # Code generation templates │ ├── Dockerfile.python.template │ └── Dockerfile.typescript.template │ ├── package.json # Root package configuration ├── pnpm-workspace.yaml # pnpm workspace configuration ├── tsconfig.json # TypeScript configuration └── vitest.config.ts # Test configuration
# Clone the repository git clone https://github.com/nirholas/github-to-mcp.git cd github-to-mcp # Install dependencies pnpm install # Build all packages pnpm build # Start the development server pnpm dev
The web application will be available athttp://localhost:3000.
# Build all packages pnpm build # Build specific package pnpm --filter @nirholas/github-to-mcp build pnpm --filter @github-to-mcp/openapi-parser build pnpm --filter web build
# Run all tests pnpm test # Run tests in watch mode pnpm test:watch # Run tests with coverage pnpm test:coverage # Run specific test file pnpm test -- tests/integration/openapi-conversion.test.ts
# Run linting pnpm lint # Type checking pnpm typecheck
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




