🚀 GitHub to MCP
GitHub to MCP is a powerful tool that enables you to convert any GitHub repository into an MCP server within seconds. This allows AI assistants such as Claude, ChatGPT, Cursor, Windsurf, Cline, and others to instantly access any codebase, eliminating the need for manual API description or code snippet copying.
🚀 Quick Start
🌐 Web UI (Easiest)
Visit github-to-mcp.vercel.app, paste any GitHub URL, click "Generate", and then 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
- Automatically classify repository types (API, library, CLI tool, MCP server, documentation).
- Detect and parse OpenAPI/Swagger specifications.
- Extract GraphQL schemas and generate query/mutation tools.
- Parse gRPC/Protobuf service definitions.
- Support AsyncAPI specifications for event-driven APIs.
- Analyze source code to extract functions.
🌍 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
- Convert OpenAPI endpoints into callable tools with typed parameters.
- Transform GraphQL queries and mutations into tools with input validation.
- Preserve Python functions decorated with
@mcp.tool.
- Turn CLI commands documented in READMEs into executable tools.
- Detect HTTP route handlers from popular frameworks.
⚡ Code Generation
- Generate complete and runnable MCP server code with all dependencies.
- Create configuration files for Claude Desktop, Cursor, and other clients.
- Provide Docker deployment templates.
- Generate 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. You can use the browser-based interface without any local installation.
💻 Usage
🌐 Web Interface
The web interface offers 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:
node packages/core/dist/cli.mjs https://github.com/owner/repo
node packages/core/dist/cli.mjs https://github.com/owner/repo --output ./my-mcp-server
node packages/core/dist/cli.mjs https://github.com/owner/repo --language python
node packages/core/dist/cli.mjs https://github.com/owner/repo --sources openapi,readme
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', 'graphql', 'grpc', 'mcp'],
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`);
console.log(result.code);
await result.save('./output-directory');
📋 Generator Options Interface
interface GithubToMcpOptions {
githubToken?: string;
sources?: Array<'openapi' | 'readme' | 'code' | 'graphql' | 'grpc' | 'mcp'>;
outputLanguage?: 'typescript' | 'python' | 'go';
includeUniversalTools?: boolean;
maxTools?: number;
branch?: string;
}
🔧 How It Works
🏷️ 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 the following:
| Classification |
Description |
mcp-server |
An existing MCP server implementation |
api-sdk |
A client library for an API |
cli-tool |
A command-line application |
library |
A general-purpose code library |
documentation |
Primarily documentation content |
data |
Data files or datasets |
unknown |
Unclassified repository |
The classification influences which extraction strategies are prioritized and how tools are named.
🔍 Tool Extraction
Tools are extracted from multiple sources within the repository:
📄 OpenAPI/Swagger Extraction
When an OpenAPI specification is found:
- 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.
🔷 GraphQL Extraction
When GraphQL schemas are found:
- 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.
📖 README Extraction
The README is analyzed for:
- Code blocks showing CLI usage patterns.
- API endpoint examples with curl or fetch.
- Function call examples with parameters.
- Installation and usage instructions.
The extracted examples become tools with inferred parameter schemas.
💻 Source Code Extraction
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.
🔌 MCP Server Introspection
If the repository is already an MCP server:
- Detect
server.tool() definitions.
- Extract tool names, descriptions, and schemas.
- Preserve existing tool implementations where possible.
🏗️ Code Generation
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.
🛠️ Generated Tools
🌐 Universal Tools
Every generated MCP server includes these baseline tools for repository exploration:
| Tool |
Description |
Parameters |
get_readme |
Retrieve the repository's README content |
None |
list_files |
List files and directories at a given path |
path (optional, defaults to root) |
read_file |
Read the contents of a specific file |
path (required) |
search_code |
Search for patterns across the repository |
query (required), path (optional) |
These tools ensure that even if no APIs or functions are detected, the AI assistant can still explore and understand the repository.
🔧 Extracted Tools
Additional tools are generated based on repository contents:
From OpenAPI Specifications
Each API endpoint becomes a tool:
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)
From GraphQL Schemas
Queries and mutations become tools:
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)
}
From Python Code
@server.tool()
async def analyze_sentiment(text: str) -> str:
"""Analyze the sentiment of the given text."""
Becomes: analyze_sentiment(text: string) → "Analyze the sentiment of the given text."
From README Examples
CLI commands documented in READMEs:
mycli create --name myproject --template typescript
Becomes: mycli_create(name: string, template?: string)
⚙️ Configuration
🔐 Environment Variables
| Variable |
Description |
Required |
GITHUB_TOKEN |
GitHub personal access token for API access |
No (but recommended) |
GITHUB_API_URL |
Custom GitHub API URL for Enterprise |
No |
GitHub Token
Without a token, GitHub API requests are limited to 60 per hour. With a token, the limit increases to 5,000 per hour. For private repositories, a token with appropriate access is required.
Create a token at: https://github.com/settings/tokens
Required scopes:
repo (for private repositories)
public_repo (for public repositories only)
🎛️ Generator Options
When using the programmatic API, you can configure:
const generator = new GithubToMcpGenerator({
githubToken: process.env.GITHUB_TOKEN,
sources: ['openapi', 'readme', 'code', 'graphql', 'grpc', 'mcp'],
outputLanguage: 'typescript',
includeUniversalTools: true,
maxTools: 100,
branch: 'main',
});
🤖 Integrating with AI Assistants
Claude Desktop
Add the generated server to your Claude Desktop configuration:
| Platform |
Config Path |
| macOS |
~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows |
%APPDATA%\Claude\claude_desktop_config.json |
{
"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
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"]
}
}
}
}
💻 VS Code with Continue
If using the Continue extension for VS Code:
{
"models": [...],
"mcpServers": {
"my-repo": {
"command": "node",
"args": ["/path/to/server.mjs"]
}
}
}
🔌 Other MCP Clients
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.
To run manually:
node server.mjs
The server will wait for MCP protocol messages on stdin.
🎮 Interactive Playground
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.
🔗 Sharing Playground Sessions
You can share your generated tools with others:
| Parameter |
Description |
?code=<base64> |
Base64-encoded TypeScript server code |
?gist=<id> |
GitHub Gist ID containing server code |
?name=<name> |
Display name for the server |
Example:
https://github-to-mcp.vercel.app/playground?gist=abc123&name=My%20API
📁 Project Structure
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
🔨 Development
Prerequisites
| Requirement |
Version |
| Node.js |
22.x or later |
| pnpm |
10.x or later |
| Git |
2.x or later |
Local Setup
git clone https://github.com/nirholas/github-to-mcp.git
cd github-to-mcp
pnpm install
pnpm build
pnpm dev
The web application will be available at http://localhost:3000.
Building
pnpm build
pnpm --filter @nirholas/github-to-mcp build
pnpm --filter @github-to-mcp/openapi-parser build
pnpm --filter web build
Testing
pnpm test
pnpm test:watch
pnpm test:coverage
pnpm test -- tests/integration/openapi-conversion.test.ts
Code Quality
pnpm lint
pnpm typecheck
🏗️ Architecture Overview
The system follows a pipeline architecture:
Input (GitHub URL)
│
▼
┌──────────────────┐
│ GitHub Client │ Fetches repository metadata, files, and README
└──────────────────┘
│
▼
┌──────────────────┐
│ Classifier │ Determines repository type and structure
└──────────────────┘
│
▼
┌──────────────────┐
│ Extractors │ Multiple extractors run in parallel:
│ ├─ OpenAPI │ • Parse API specifications
│ ├─ GraphQL │ • Parse GraphQL schemas
│ ├─ README │ • Extract examples from documentation
│ ├─ Code │ • Analyze source code
│ └─ MCP │ • Detect existing MCP tools
└──────────────────┘
│
▼
┌──────────────────┐
│ Deduplicator │ Removes duplicate tools, merges similar ones
└──────────────────┘
│
▼
┌──────────────────┐
│ Validator │ Validates tool schemas, adds confidence scores
└──────────────────┘
│
▼
┌──────────────────┐
│ Generator │ Produces output code in target language
└──────────────────┘
│
▼
Output (MCP Server Code + Configuration)
Each extractor produces a list of ExtractedTool objects with a standardized schema. The deduplicator and validator ensure consistency before the generator produces the final output.
📥 Supported Input Formats
API Specifications
| Format |
File Patterns |
Version Support |
| OpenAPI |
openapi.json, openapi.yaml, swagger.json, swagger.yaml, api.json, api.yaml |
2.0, 3.0.x, 3.1.x |
| GraphQL |
schema.graphql, *.gql, schema.json |
June 2018 spec |
| gRPC |
*.proto |
proto3 |
| AsyncAPI |
asyncapi.json, asyncapi.yaml |
2.x |
Source Code Languages
| Language |
Framework Detection |
| TypeScript/JavaScript |
Express, Fastify, Hono, Next.js API routes |
| Python |
FastAPI, Flask, Django REST, MCP SDK decorators |
| Go |
Gin, Echo, Chi, Fiber, Gorilla Mux |
| Java |
Spring Boot, JAX-RS, Micronaut |
| Kotlin |
Ktor, Spring Boot |
| Rust |
Actix-web, Axum, Rocket |
| Ruby |
Rails, Sinatra, Grape |
📤 Output Formats
TypeScript Server
The default output is a TypeScript MCP server using the official @modelcontextprotocol/sdk package:
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const server = new Server({
name: 'generated-server',
version: '1.0.0',
}, {
capabilities: {
tools: {},
},
});
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [],
}));
server.setRequestHandler(CallToolRequestSchema, async (request) => {
});
const transport = new StdioServerTransport();
await server.connect(transport);
Python Server
Python output uses the MCP Python SDK:
from mcp.server import Server
from mcp.server.stdio import stdio_server
server = Server("generated-server")
@server.tool()
async def example_tool(param: str) -> str:
"""Tool description."""
async def main():
async with stdio_server() as (read_stream, write_stream):
await server.run(read_stream, write_stream)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Configuration Files
Each generated server includes:
| File |
Description |
claude_desktop_config.json |
Claude Desktop configuration snippet |
cursor_config.json |
Cursor editor configuration |
package.json or requirements.txt |
Dependencies |
Dockerfile (optional) |
Container deployment |
⚠️ Limitations
🔄 GitHub API Rate Limits
- Unauthenticated requests: 60 per hour
- Authenticated requests: 5,000 per hour
- Large repositories may require multiple API calls
Provide a GITHUB_TOKEN to increase rate limits.
📦 Repository Size
- Very large repositories (>1GB) may time out during analysis
- Repositories with thousands of files may hit API limits
- Consider analyzing specific subdirectories for monorepos
🎯 Tool Extraction Accuracy
- OpenAPI specs produce the most accurate tools
- README extraction relies on consistent documentation formatting
- Source code analysis may miss dynamically defined routes
- Confidence scores indicate extraction reliability
🌍 Language Support
- TypeScript output is the most mature
- Python output is functional but may require minor edits
- Go output is experimental
🔧 Troubleshooting
❌ "Rate limit exceeded" errors
Provide a GitHub token:
export GITHUB_TOKEN=ghp_xxxxxxxxxxxx
❌ "Repository not found" errors
- Verify the URL is correct
- For private repositories, ensure your token has
repo scope
- Check that the repository exists and is accessible
❌ "No tools extracted" results
- Verify the repository contains API definitions or documented endpoints
- Try enabling all extraction sources:
--sources openapi,readme,code,graphql,mcp
- Check that specification files follow standard naming conventions
❌ Generated server fails to start
- Ensure Node.js 22+ is installed
- Run
npm install in the generated directory
- Check for TypeScript compilation errors with
npx tsc --noEmit
❌ Claude Desktop does not show the server
- Verify the path in
claude_desktop_config.json is absolute
- Restart Claude Desktop after configuration changes
- Check Claude Desktop logs for connection errors
🤝 Contributing
Contributions are welcome! Please see CONTRIBUTING.md for detailed guidelines on:
- Setting up the development environment
- Code style and formatting requirements
- Testing requirements
- Pull request process
🐛 Reporting Issues
When reporting issues, please include:
- Repository URL that caused the issue (if public)
- Error messages or unexpected behavior
- Node.js and pnpm versions
- Operating system
📄 License
Apache 2.0. See LICENSE for details.
🔗 Links
🌐 Live HTTP Deployment
GitHub to MCP is deployed and accessible over HTTP via MCP Streamable HTTP transport — no local installation required.
Endpoint:
https://modelcontextprotocol.name/mcp/github-to-mcp
Connect from any MCP Client
Add to your MCP client configuration (Claude Desktop, Cursor, SperaxOS, etc.):
{
"mcpServers": {
"github-to-mcp": {
"type": "http",
"url": "https://modelcontextprotocol.name/mcp/github-to-mcp"
}
}
}
Available Tools (2)
| Tool |
Description |
get_repo_info |
Get repository info |
search_repos |
Search repositories |
Example Requests
Get repository info:
curl -X POST https://modelcontextprotocol.name/mcp/github-to-mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_repo_info","arguments":{"owner":"nirholas","repo":"universal-crypto-mcp"}}}'
Search repositories:
curl -X POST https://modelcontextprotocol.name/mcp/github-to-mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search_repos","arguments":{"query":"mcp server crypto"}}}'
List All Tools
curl -X POST https://modelcontextprotocol.name/mcp/github-to-mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Also Available On
Powered by modelcontextprotocol.name — the open MCP HTTP gateway