Sponsored by Deepsite.site

Mcp_client_server

Created By
devmadni7 months ago
his is a Node.js command-line application that integrates with GitHub via the Model Context Protocol (MCP) server and OpenAI's API.
Content

OpenAI MCP Client for GitHub This is a Node.js command-line application that integrates with GitHub via the Model Context Protocol (MCP) server and OpenAI's API. It allows users to perform GitHub operations (e.g., creating repositories, listing repositories) and query OpenAI for GitHub-related information using context from an MCP server. Features

GitHub Operations: Create new repositories. List all repositories. List GitHub API endpoints.

OpenAI Integration: Query OpenAI with GitHub context from an MCP server for detailed answers (e.g., "How to create a pull request").

Interactive CLI: Simple command-line interface for entering commands.

Secure Configuration: Uses environment variables for API keys.

Prerequisites

Node.js: Version 14 or higher (recommended: latest LTS). npm: Comes with Node.js. GitHub Personal Access Token: Required for GitHub API access. OpenAI API Key: Required for OpenAI queries. Git: For version control and pushing to GitHub.

Installation

Clone the Repository: git clone https://github.com/[your-username]/tessst.git cd tessst

Install Dependencies: npm install

This installs axios and dotenv (added below).

Set Up Environment Variables:

Create a .env file in the project root:touch .env

Add your API keys:OPENAI_API_KEY=your_openai_api_key GITHUB_PERSONAL_ACCESS_TOKEN=your_github_personal_access_token

Note: Never commit .env to GitHub. It’s ignored by .gitignore.

Install MCP Server:

The script uses @modelcontextprotocol/server-github. It’s installed on-demand via npx, so no additional setup is needed.

Usage

Run the Application: node openai-mcp-client.js

This starts the interactive CLI.

Available Commands:

Create a new repository:create new repo named my-repo

List all repositories:list all repositories

List GitHub API endpoints:list github api

Query OpenAI:how to create a pull request

Exit:exit

Example Interaction:

create new repo named test-repo Successfully created new repository: https://github.com/[your-username]/test-repo list all repositories Your repositories:

how to create a pull request OpenAI's response: To create a pull request on GitHub:

  1. Push your changes to a branch...

Project Structure

openai-mcp-client.js: Main script with CLI and GitHub/OpenAI logic. .gitignore: Ignores node_modules/, .env, logs, and system files. .env: Stores API keys (not tracked by Git). package.json: Defines dependencies and scripts.

Dependencies

axios: For HTTP requests to GitHub and OpenAI APIs. dotenv: For loading environment variables from .env.

To update package.json with dotenv: npm install dotenv

Security Notes

API Keys: Store OPENAI_API_KEY and GITHUB_PERSONAL_ACCESS_TOKEN in .env, not in the code. GitHub Token: Generate a token at https://github.com/settings/tokens with repo scope. OpenAI Key: Obtain from https://platform.openai.com/account/api-keys.

Troubleshooting

"Failed to start GitHub MCP server": Ensure GITHUB_PERSONAL_ACCESS_TOKEN is valid and has repo scope. Check internet connectivity.

"Error querying OpenAI": Verify OPENAI_API_KEY is correct.

node_modules in Git: Ensure .gitignore includes node_modules/ and run:git rm -r --cached node_modules git commit -m "Remove node_modules"

Command not recognized: Use exact phrasing (e.g., "create new repo named my-repo") or check the script’s handleGitHubOperation function.

Contributing

Fork the repository. Create a feature branch (git checkout -b feature/your-feature). Commit changes (git commit -m "Add your feature"). Push to the branch (git push origin feature/your-feature). Open a pull request.

License MIT License. See LICENSE for details. Contact For issues or suggestions, open an issue on GitHub or contact [your-username].

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Tavily Mcp
ChatWiseThe second fastest AI chatbot™
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
WindsurfThe new purpose-built IDE to harness magic
Serper MCP ServerA Serper MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
DeepChatYour AI Partner on Desktop
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Playwright McpPlaywright MCP server
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server