GitHub Stars
0
User Rating
Not Rated
Forks
0
Issues
0
Views
1
Favorites
0
MCP CLI Project (TypeScript)
A comprehensive Command Line Interface (CLI) project demonstrating Model Context Protocol (MCP) integration with multiple tools and servers, built in TypeScript.
๐ Features
This CLI application showcases five main functionalities:
- ๐ Todo Management: Add, list, mark done, and manage tasks
- ๐งฎ Calculator: Perform basic and advanced mathematical calculations
- ๐ค๏ธ Weather: Get weather information with MCP server integration
- ๐ GitHub Integration: Comprehensive GitHub analysis, search, and discovery tools
- ๐ MCP Integration: Test and explore multiple MCP servers with real-time tool discovery
๐ Prerequisites
- Node.js: v18.x or higher
- npm: v8 or higher
- TypeScript: v5.x (installed as dev dependency)
- GitHub Personal Access Token (optional): For enhanced GitHub functionality
๐ Installation
Clone the repository:
git clone <your-repo-url> cd mcp-cli-project-ts
Install dependencies:
npm install
Build the project:
npm run build
Set up GitHub token (optional but recommended):
npm run github:setup
๐ ๏ธ Usage
Todo Management
# List all tasks
npm run todo -- --list
# Add a new task
npm run todo -- --add "Learn MCP protocol"
# Mark a task as done (use task ID from list)
npm run todo -- --done 1
# Clear completed tasks
npm run todo -- --clear
# Show todo statistics
npm run todo -- --stats
Calculator
# Basic calculation
npm run calc "2 + 3 * 4"
# Advanced calculations with functions
npm run calc -- --advanced "sin(pi/2) + cos(0)"
# Examples of supported functions: sin, cos, tan, sqrt, log, exp, abs
npm run calc -- --advanced "sqrt(16) + log(10)"
Weather
# Get weather for default city (San Francisco)
npm run weather
# Get weather for specific city
npm run weather -- --city "New York"
# Test with real MCP weather server
npm run weather -- --real --city "London"
# Test multiple MCP weather servers
npm run weather -- --test --city "Tokyo"
๐ GitHub Integration (NEW!)
Quick Start
# Test GitHub MCP server connection
npm run github connect
# Discover all available GitHub tools
npm run github tools
# Run comprehensive GitHub experiments
npm run github experiments
Search & Discovery
# Search repositories
npm run github search --repos "typescript"
npm run github search --repos "machine-learning" --limit 10
# Search users
npm run github search --users "developer-name"
# Search code patterns
npm run github search --code "async function" --lang typescript
Analysis & Insights
# Analyze trending repositories
npm run github trending
# Get developer insights
npm run github developer octocat
npm run github developer microsoft
# Explore technology communities
npm run github community "machine-learning"
npm run github community "typescript"
# Analyze code patterns across GitHub
npm run github pattern "interface"
npm run github pattern "async/await"
Comprehensive Experiments
# Run all experiments for a topic
npm run github experiments --topic "python"
npm run github experiments --topic "react"
# Run GitHub test suite
npm run github:test
MCP Server Testing
# Test weather MCP server
npm run build && node dist/src/index.js mcp --server weather --list
# Test filesystem MCP server
npm run build && node dist/src/index.js mcp --server filesystem --path ./data --list
# Test GitHub MCP server
npm run build && node dist/src/index.js mcp --server github --list
# Test specific MCP tool
npm run build && node dist/src/index.js mcp --server weather --test get_weather
Development Commands
# Development mode with auto-reload
npm run dev
# Watch mode (auto-rebuild on changes)
npm run watch
# Type checking without compilation
npm run type-check
# Clean build artifacts
npm run clean
# GitHub setup helper
npm run github:setup
# GitHub testing suite
npm run github:test
๐๏ธ Project Structure
mcp-cli-project-ts/
โโโ src/
โ โโโ index.ts # Main CLI entry point
โ โโโ mcp-client.ts # MCP client implementation
โ โโโ github-cli.ts # GitHub CLI interface (NEW!)
โโโ tools/
โ โโโ todo.ts # Todo management functionality
โ โโโ calculator.ts # Calculator operations
โ โโโ weather.ts # Weather tools with MCP integration
โ โโโ github.ts # GitHub analysis tools (NEW!)
โโโ types/
โ โโโ todo-types.ts # Todo-related type definitions
โ โโโ calculator-types.ts # Calculator type definitions
โ โโโ weather-types.ts # Weather type definitions
โ โโโ mcp-types.ts # MCP protocol types
โ โโโ cli-types.ts # CLI-specific types
โ โโโ config-types.ts # Configuration types (NEW!)
โ โโโ errors.ts # Error handling types (NEW!)
โโโ config/
โ โโโ mcp-config.json # MCP server configurations
โ โโโ github-experiments.json # GitHub experiment presets (NEW!)
โโโ scripts/
โ โโโ setup-github.sh # GitHub setup script (NEW!)
โ โโโ test-github-experiments.sh # GitHub test suite (NEW!)
โโโ data/ # Data storage (todos.json, etc.)
โโโ dist/ # Compiled JavaScript output
โโโ package.json # Project configuration and dependencies
โโโ tsconfig.json # TypeScript configuration
โโโ README.md # This file
๐ง Architecture
Core Components
- CLI Framework: Built with Commander.js for command parsing
- MCP Integration: Uses @modelcontextprotocol/sdk for protocol communication
- Type Safety: Full TypeScript implementation with strict type checking
- Modular Design: Separate tools for different functionalities
- GitHub Integration: Advanced GitHub analysis and discovery capabilities
MCP Integration
The project demonstrates real Model Context Protocol integration with multiple servers:
- MCP Client: Connects to various MCP servers (weather, filesystem, git, github)
- Tool Discovery: Dynamically lists available tools from connected servers
- Resource Access: Reads resources exposed by MCP servers
- Error Handling: Graceful fallbacks when MCP servers are unavailable
- Multi-Server Support: Manages connections to multiple MCP servers simultaneously
๐ Model Context Protocol (MCP)
This project showcases MCP, an open protocol for connecting AI applications with external data sources and tools. Key MCP concepts demonstrated:
- Servers: Provide tools, resources, and prompts
- Clients: Connect to servers and make requests
- Transports: Communication channels (stdio, HTTP, SSE)
- Tools: Executable functions (like GitHub API calls, weather data)
- Resources: Data sources (like file contents, repository data)
MCP Servers Used
- Weather Server:
@modelcontextprotocol/server-weather
- Real weather data - Filesystem Server:
@modelcontextprotocol/server-filesystem
- File operations - Git Server:
@modelcontextprotocol/server-git
- Git repository access - GitHub Server:
@modelcontextprotocol/server-github
- GitHub API integration (NEW!)
๐ GitHub MCP Integration
Features
The GitHub integration provides comprehensive analysis and discovery capabilities:
๐ Search & Discovery
- Repository Search: Find repositories by topic, language, stars, creation date
- User Search: Discover developers and organizations
- Code Search: Find code patterns across GitHub (requires authentication)
- Advanced Filtering: Date ranges, star counts, language filters
๐ Analysis & Insights
- Trending Analysis: Discover trending repositories and technologies
- Developer Insights: Analyze developer profiles, repositories, and activity
- Community Explorer: Explore technology communities and ecosystems
- Code Pattern Analysis: Analyze usage patterns of programming constructs
- Language Distribution: Statistical analysis of programming languages
๐งช Experiments
- Technology Trends: Comprehensive analysis of technology adoption
- Ecosystem Exploration: Deep dive into technology communities
- Developer Profiling: Detailed analysis of developer contributions
- Pattern Discovery: Find interesting code patterns and practices
GitHub Tools Available (26 total)
The GitHub MCP server provides access to 26 powerful tools:
Repository Management:
search_repositories
- Search GitHub repositoriescreate_repository
- Create new repositoriesfork_repository
- Fork repositoriesget_file_contents
- Read file contentscreate_or_update_file
- Create/update filespush_files
- Batch file operations
Issue & PR Management:
list_issues
- List repository issuescreate_issue
- Create new issuesupdate_issue
- Update existing issuesadd_issue_comment
- Comment on issueslist_pull_requests
- List pull requestscreate_pull_request
- Create pull requestsmerge_pull_request
- Merge pull requests
Search & Discovery:
search_code
- Search code across GitHubsearch_issues
- Search issues and PRssearch_users
- Search GitHub users
And many more advanced tools for repository analysis and management
Authentication
For full GitHub functionality, set up a GitHub Personal Access Token:
- Generate token: Visit https://github.com/settings/tokens
- Required scopes:
repo
(for repository access) - Set environment variable:
export GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here
- Verify setup:
npm run github connect
Without token: Basic search works with rate limits With token: Full API access (5000 requests/hour) + private repositories
๐งช Testing
Basic Functionality Tests
# Test todo functionality
npm run todo -- --add "Test task" && npm run todo -- --list
# Test calculator
npm run calc "sqrt(25)" && npm run calc -- --advanced "sin(pi/4)"
# Test weather (local simulation)
npm run weather -- --city "Paris"
# Test MCP integration
npm run build && node dist/src/index.js mcp --list
GitHub Integration Tests
# Quick connectivity test
npm run github connect
# Test repository search
npm run github search --repos "typescript"
# Test trending analysis
npm run github trending
# Test developer analysis
npm run github developer octocat
# Run comprehensive test suite
npm run github:test
# Test specific experiments
npm run github experiments --topic "machine-learning"
๐ Security Considerations
- Data Privacy: Todo data stored locally in
data/todos.json
- MCP Safety: All MCP server connections require explicit user consent
- Input Validation: Calculator expressions are sanitized for safety
- Environment Variables: Secure handling of API keys and credentials
- GitHub Token: Store securely, never commit to version control
- Rate Limiting: Respects GitHub API rate limits and provides graceful degradation
๐ Deployment
Local Development
npm run dev # Start in development mode
Production Build
npm run build
npm start
Docker (Optional)
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY dist/ ./dist/
CMD ["node", "dist/src/index.js"]
๐ Examples
Adding and Managing Todos
$ npm run todo -- --add "Learn TypeScript"
โ
Added task: "Learn TypeScript"
$ npm run todo -- --add "Build MCP client"
โ
Added task: "Build MCP client"
$ npm run todo -- --list
๐ Your tasks:
โณ 1698123456789: Learn TypeScript (10/24/2023)
โณ 1698123456790: Build MCP client (10/24/2023)
$ npm run todo -- --done 1698123456789
โ
Marked task "Learn TypeScript" as done
$ npm run todo -- --stats
๐ Todo Statistics:
Total tasks: 2
Completed: 1
Pending: 1
Completion rate: 50.0%
Calculator Examples
$ npm run calc "2 + 3 * 4"
๐งฎ Calculating: 2 + 3 * 4
Result: 14
$ npm run calc -- --advanced "sqrt(16) + sin(pi/2)"
๐งฎ Calculating: sqrt(16) + sin(pi/2)
Result: 5
Processed: Math.sqrt(16) + Math.sin(Math.PI/2)
Weather with MCP
$ npm run weather -- --city "London" --real
๐ค๏ธ Getting weather for London...
๐ก Connecting to real MCP weather server...
โ
Connected to weather MCP server
๐ค๏ธ London: Partly cloudy, 18ยฐC, Humidity: 65%, Wind: 12 km/h
GitHub Analysis Examples
$ npm run github trending
๐ === TRENDING ANALYSIS EXPERIMENT === ๐
๐ Top Trending Repositories:
1. deepseek-ai/DeepSeek-V3
โญ 15,234 stars | ๐ป Python
๐ Advanced AI reasoning model
2. cline/cline
โญ 8,567 stars | ๐ป TypeScript
๐ Autonomous coding agent right in your IDE
$ npm run github developer microsoft
๐จโ๐ป === DEVELOPER INSIGHTS: microsoft === ๐จโ๐ป
๐ Repository Statistics:
๐ Total Repositories: 1,247
โญ Total Stars: 2,847,392
๐ Average Stars per Repo: 2,284.5
๐ป Programming Languages:
TypeScript: 234 repos (18.8%)
Python: 187 repos (15.0%)
JavaScript: 156 repos (12.5%)
$ npm run github community "machine-learning"
๐ === COMMUNITY EXPLORER: "machine-learning" === ๐
๐ Top Repositories:
1. josephmisiti/awesome-machine-learning
โญ 67,234 stars | ๐ป Python
๐ A curated list of awesome Machine Learning frameworks
๐ฅ Community Members:
1. Machine-Learning-Tokyo
๐ฅ 1,234 followers | ๐ 45 repos
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Related Links
- Model Context Protocol Specification
- MCP TypeScript SDK
- MCP Community Servers
- GitHub MCP Server
- Anthropic MCP Documentation
๐ฏ What's New
v1.1.0 - GitHub Integration
- โจ New: Complete GitHub MCP server integration
- ๐ New: Advanced repository search and analysis
- ๐ New: Developer insights and community exploration
- ๐งช New: Technology trend analysis experiments
- ๐ ๏ธ New: 26 GitHub API tools via MCP
- ๐ New: Comprehensive testing suite
- ๐ New: Setup automation scripts
Previous Features
- ๐ Todo management system
- ๐งฎ Advanced calculator with mathematical functions
- ๐ค๏ธ Weather information with MCP integration
- ๐ Multi-server MCP client support
Built with โค๏ธ using TypeScript and the Model Context Protocol
Explore the power of MCP with real GitHub integration, advanced analysis tools, and comprehensive development workflows.
0
Followers
18
Repositories
0
Gists
2
Total Contributions