{"_id":"@amr.manojkumar/test-project","_rev":"3-1f0010ebc9af0c674ac4e4ca170e2842","name":"@amr.manojkumar/test-project","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@amr.manojkumar/test-project","version":"1.0.0","keywords":["mcp","github","ai","openai","model-context-protocol","client","test-project"],"author":"","license":"MIT","_id":"@amr.manojkumar/test-project@1.0.0","maintainers":[{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"}],"homepage":"https://github.com/yourusername/test-project#readme","bugs":{"url":"https://github.com/yourusername/test-project/issues"},"bin":{"test-project":"bin/cli.js"},"dist":{"shasum":"af49e50b277f7420e41d6c75651138404cbc1e41","tarball":"https://registry.npmjs.org/@amr.manojkumar/test-project/-/test-project-1.0.0.tgz","fileCount":82,"integrity":"sha512-lqXsIC527K/fff1vdqrapu4StfrsuD7MxrsuSYpc1UnT5g+a3XFB+mHinUqhyeNDnymrlBF1X2FOT1Gtk7Zwqg==","signatures":[{"sig":"MEUCIQD0E8/E75ctCTmxb/LLLcgdpUVDe9eZIp5YnIpEuBNyMAIgVzrOCX0qNGkKvXcoXw2H5uIyaVmLMt7Dmr9WBUx8sqE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":209383},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=16"},"scripts":{"cli":"node bin/cli.js","test":"jest","build":"tsc","clean":"rimraf dist","prepare":"npm run clean && npm run build","postinstall":"node -e \"try { require('fs').chmodSync('./bin/cli.js', '0755') } catch (e) { console.error('Failed to make CLI executable:', e) }\"","prepublishOnly":"npm run prepare","prepare-package":"node package-scripts.js","start:examples:basic":"node examples/basic-usage.js","start:examples:express":"node examples/express-middleware.js"},"_npmUser":{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"},"repository":{"url":"git+https://github.com/yourusername/test-project.git","type":"git"},"_npmVersion":"10.8.2","description":"A client library for Model Context Protocol (MCP) with GitHub integration","directories":{},"_nodeVersion":"20.19.0","dependencies":{"zod":"^3.22.4","dotenv":"^16.3.1","openai":"^4.95.1","@modelcontextprotocol/sdk":"^1.10.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rimraf":"^5.0.10","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.8.3","@types/jest":"^29.5.11","@types/node":"^20.17.30"},"peerDependencies":{"@open-rpc/client-js":"^1.8.1"},"_npmOperationalInternal":{"tmp":"tmp/test-project_1.0.0_1745149371171_0.580914306349988","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@amr.manojkumar/test-project","version":"1.0.2","keywords":["mcp","github","ai","openai","model-context-protocol","client","test-project"],"author":"","license":"MIT","_id":"@amr.manojkumar/test-project@1.0.2","maintainers":[{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"}],"homepage":"https://github.com/amr.manojkumar/test-project#readme","bugs":{"url":"https://github.com/amr.manojkumar/test-project/issues"},"bin":{"test-project":"bin/cli.js"},"dist":{"shasum":"833dd7f6928ce2ffa9e5c4e17b39daccbdce85df","tarball":"https://registry.npmjs.org/@amr.manojkumar/test-project/-/test-project-1.0.2.tgz","fileCount":82,"integrity":"sha512-B4YE4T8pnMKq+Cw7vKXGy63ptyRhN+35ApGxQ3zPHQboB/g5eBODPsMbcIHQ51JXBhcOijsp3Ovj+f4wIvdvVg==","signatures":[{"sig":"MEQCIE5Yh4WnYne1IKP0tEi3kHR/D1U4Iuj2LMcBhnrW9gT+AiBRo9knBg/dPS5SqL+yKp2xesq/zd21qnAiVX7kGq9NSw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":209496},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","module":"dist/index.js","engines":{"node":">=16"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"scripts":{"cli":"node bin/cli.js","test":"jest","build":"tsc","clean":"rimraf dist","prepare":"npm run clean && npm run build","postinstall":"node -e \"try { require('fs').chmodSync('./bin/cli.js', '0755') } catch (e) { console.error('Failed to make CLI executable:', e) }\"","prepublishOnly":"npm run prepare","prepare-package":"node package-scripts.js","start:examples:basic":"node examples/basic-usage.js","start:examples:express":"node examples/express-middleware.js"},"_npmUser":{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"},"repository":{"url":"git+https://github.com/amr.manojkumar/test-project.git","type":"git"},"_npmVersion":"10.8.2","description":"A client library for Model Context Protocol (MCP) with GitHub integration","directories":{},"_nodeVersion":"20.19.0","dependencies":{"zod":"^3.22.4","dotenv":"^16.3.1","openai":"^4.95.1","@modelcontextprotocol/sdk":"^1.10.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","rimraf":"^5.0.10","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.8.3","@types/jest":"^29.5.11","@types/node":"^20.17.30"},"peerDependencies":{"@open-rpc/client-js":"^1.8.1"},"_npmOperationalInternal":{"tmp":"tmp/test-project_1.0.2_1745157032872_0.643775723425625","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@amr.manojkumar/test-project","version":"1.0.3","description":"A client library for Model Context Protocol (MCP) with GitHub integration","main":"dist/index.js","module":"dist/index.js","types":"dist/index.d.ts","type":"module","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"bin":{"test-project":"bin/cli.js"},"scripts":{"build":"tsc","clean":"rimraf dist","prepare":"npm run clean && npm run build","prepublishOnly":"npm run prepare","postinstall":"node -e \"try { require('fs').chmodSync('./bin/cli.js', '0755') } catch (e) { console.error('Failed to make CLI executable:', e) }\"","test":"jest","prepare-package":"node package-scripts.js","start:examples:basic":"node examples/basic-usage.js","start:examples:express":"node examples/express-middleware.js","cli":"node bin/cli.js"},"keywords":["mcp","github","ai","openai","model-context-protocol","client","test-project"],"author":"","license":"MIT","dependencies":{"@modelcontextprotocol/sdk":"^1.10.1","dotenv":"^16.3.1","openai":"^4.95.1","zod":"^3.22.4"},"peerDependencies":{"@open-rpc/client-js":"^1.8.1"},"devDependencies":{"@types/jest":"^29.5.11","@types/node":"^20.17.30","jest":"^29.7.0","rimraf":"^5.0.10","ts-jest":"^29.1.1","ts-node":"^10.9.2","typescript":"^5.8.3"},"engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/amr.manojkumar/test-project.git"},"bugs":{"url":"https://github.com/amr.manojkumar/test-project/issues"},"homepage":"https://github.com/amr.manojkumar/test-project#readme","_id":"@amr.manojkumar/test-project@1.0.3","_nodeVersion":"20.19.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Bw6cawov2QukwNAYjsrAL6YrtZZGNxJBtNfcpyZ1uIRBIOSMtU/E0eUf7ll12SRY3EwFFEWnWm/xzhqMR2BxoQ==","shasum":"45c48c95039a356d6a0bd4769f8dfb075a22fd8f","tarball":"https://registry.npmjs.org/@amr.manojkumar/test-project/-/test-project-1.0.3.tgz","fileCount":82,"unpackedSize":209496,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAy58DafTSCvnQGLXJdbm+fZUb0a7T0Zsrd2IEOUxIG+AiEA6M0Ke/by0th9JXLaG+Nhs5l5eHSgei4o4a+TX81NCn0="}]},"_npmUser":{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"},"directories":{},"maintainers":[{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/test-project_1.0.3_1745157596745_0.6331138650551074"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-20T11:42:51.080Z","modified":"2025-04-20T13:59:57.149Z","1.0.0":"2025-04-20T11:42:51.366Z","1.0.2":"2025-04-20T13:50:33.102Z","1.0.3":"2025-04-20T13:59:56.949Z"},"bugs":{"url":"https://github.com/amr.manojkumar/test-project/issues"},"license":"MIT","homepage":"https://github.com/amr.manojkumar/test-project#readme","keywords":["mcp","github","ai","openai","model-context-protocol","client","test-project"],"repository":{"type":"git","url":"git+https://github.com/amr.manojkumar/test-project.git"},"description":"A client library for Model Context Protocol (MCP) with GitHub integration","maintainers":[{"name":"amr.manojkumar","email":"amr.manojkumar44@gmail.com"}],"readme":"# GitHub MCP Client\r\n\r\nA Node.js client library for Model Context Protocol (MCP) with GitHub integration. This package allows you to build AI-powered applications that can interact with GitHub repositories, pull requests, issues, and more through the Model Context Protocol.\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install github-mcp-client\r\n```\r\n\r\n## Features\r\n\r\n- Seamless integration with GitHub API via MCP\r\n- Support for various GitHub operations (repositories, branches, PRs, issues, etc.)\r\n- Multiple client classes for different use cases\r\n- TypeScript support with full type definitions\r\n- Context-aware AI interactions\r\n- Customizable tool registry for extending functionality\r\n\r\n## Quick Start\r\n\r\n```javascript\r\nimport { MCPHost } from 'github-mcp-client';\r\nimport dotenv from 'dotenv';\r\n\r\n// Load environment variables\r\ndotenv.config();\r\n\r\nasync function main() {\r\n  // Create an instance of MCPHost\r\n  const host = MCPHost.getInstance({\r\n    serverUrl: process.env.MCP_SERVER_URL || 'http://localhost:3005/mcp',\r\n    openaiApiKey: process.env.OPENAI_API_KEY,\r\n    model: 'gpt-4o-mini',\r\n    temperature: 0.7,\r\n    maxTokens: 1500\r\n  });\r\n\r\n  // Initialize the host\r\n  await host.initialize();\r\n\r\n  // Define system context for the AI\r\n  const systemContext = `You are a GitHub automation assistant.\r\n  You can help with various GitHub tasks like creating repositories,\r\n  branches, and pull requests.`;\r\n\r\n  // Execute a task\r\n  const result = await host.executeTask(\r\n    \"Create a new branch called 'feature/add-login' in the repository 'owner/repo'\",\r\n    systemContext\r\n  );\r\n\r\n  console.log('Task executed:', result);\r\n\r\n  // Disconnect when done\r\n  await host.disconnect();\r\n}\r\n\r\nmain().catch(console.error);\r\n```\r\n\r\n## Integration with Express.js\r\n\r\nHere's how to use the GitHub MCP Client in an Express.js middleware:\r\n\r\n```javascript\r\nimport express from 'express';\r\nimport { MCPHost } from 'github-mcp-client';\r\nimport dotenv from 'dotenv';\r\n\r\ndotenv.config();\r\n\r\nconst app = express();\r\napp.use(express.json());\r\n\r\n// Create and initialize the MCP host\r\nconst host = MCPHost.getInstance({\r\n  serverUrl: process.env.MCP_SERVER_URL,\r\n  openaiApiKey: process.env.OPENAI_API_KEY,\r\n  model: 'gpt-4o-mini',\r\n  temperature: 0.7,\r\n  maxTokens: 1500\r\n});\r\n\r\n// Initialize host when the server starts\r\n(async () => {\r\n  try {\r\n    await host.initialize();\r\n    console.log('MCP Host initialized successfully');\r\n  } catch (error) {\r\n    console.error('Failed to initialize MCP Host:', error);\r\n    process.exit(1);\r\n  }\r\n})();\r\n\r\n// Example middleware for GitHub automation\r\napp.post('/api/github/automate', async (req, res) => {\r\n  try {\r\n    const { task, context } = req.body;\r\n    \r\n    if (!task) {\r\n      return res.status(400).json({ error: 'Task is required' });\r\n    }\r\n    \r\n    const defaultContext = `You are a GitHub automation assistant helping with repository tasks.`;\r\n    const result = await host.executeTask(task, context || defaultContext);\r\n    \r\n    res.json(result);\r\n  } catch (error) {\r\n    console.error('Error executing task:', error);\r\n    res.status(500).json({ error: 'Failed to execute task' });\r\n  }\r\n});\r\n\r\n// Integration with React frontend\r\napp.post('/api/github/analyze', async (req, res) => {\r\n  try {\r\n    const { repositoryUrl, question } = req.body;\r\n    \r\n    if (!repositoryUrl || !question) {\r\n      return res.status(400).json({ error: 'Repository URL and question are required' });\r\n    }\r\n    \r\n    // Extract owner and repo from URL\r\n    const urlParts = repositoryUrl.split('/');\r\n    const owner = urlParts[urlParts.length - 2];\r\n    const repo = urlParts[urlParts.length - 1];\r\n    \r\n    const context = `You are analyzing the GitHub repository ${owner}/${repo}.\r\n    Answer the following question based on the repository contents.`;\r\n    \r\n    const result = await host.executeTask(question, context);\r\n    \r\n    res.json(result);\r\n  } catch (error) {\r\n    console.error('Error analyzing repository:', error);\r\n    res.status(500).json({ error: 'Failed to analyze repository' });\r\n  }\r\n});\r\n\r\nconst PORT = process.env.PORT || 3000;\r\napp.listen(PORT, () => {\r\n  console.log(`Server running on port ${PORT}`);\r\n});\r\n```\r\n\r\n## React.js Integration Example\r\n\r\nHere's a simple React component that interacts with the Express middleware:\r\n\r\n```jsx\r\nimport React, { useState } from 'react';\r\nimport axios from 'axios';\r\n\r\nfunction GitHubAutomation() {\r\n  const [task, setTask] = useState('');\r\n  const [result, setResult] = useState(null);\r\n  const [loading, setLoading] = useState(false);\r\n  const [error, setError] = useState('');\r\n\r\n  const handleSubmit = async (e) => {\r\n    e.preventDefault();\r\n    setLoading(true);\r\n    setError('');\r\n    \r\n    try {\r\n      const response = await axios.post('/api/github/automate', { \r\n        task,\r\n        context: 'You are helping to automate GitHub tasks efficiently and accurately.'\r\n      });\r\n      \r\n      setResult(response.data);\r\n    } catch (err) {\r\n      setError(err.response?.data?.error || 'An error occurred');\r\n    } finally {\r\n      setLoading(false);\r\n    }\r\n  };\r\n\r\n  return (\r\n    <div className=\"github-automation\">\r\n      <h2>GitHub Automation</h2>\r\n      <form onSubmit={handleSubmit}>\r\n        <div className=\"form-group\">\r\n          <label htmlFor=\"task\">Describe your GitHub task:</label>\r\n          <textarea\r\n            id=\"task\"\r\n            value={task}\r\n            onChange={(e) => setTask(e.target.value)}\r\n            rows={4}\r\n            className=\"form-control\"\r\n            placeholder=\"E.g., Create a branch named 'feature/user-auth' in repository 'myorg/myrepo'\"\r\n            required\r\n          />\r\n        </div>\r\n        <button type=\"submit\" className=\"btn btn-primary\" disabled={loading}>\r\n          {loading ? 'Processing...' : 'Execute Task'}\r\n        </button>\r\n      </form>\r\n      \r\n      {error && <div className=\"alert alert-danger mt-3\">{error}</div>}\r\n      \r\n      {result && (\r\n        <div className=\"result mt-4\">\r\n          <h3>Task Results:</h3>\r\n          <pre>{JSON.stringify(result, null, 2)}</pre>\r\n        </div>\r\n      )}\r\n    </div>\r\n  );\r\n}\r\n\r\nexport default GitHubAutomation;\r\n```\r\n\r\n## Advanced Usage\r\n\r\nFor more advanced use cases, the library provides specialized host classes:\r\n\r\n### EnhancedMCPHost\r\n\r\n```javascript\r\nimport { EnhancedMCPHost } from 'github-mcp-client';\r\n\r\nconst host = EnhancedMCPHost.getInstance({\r\n  serverUrl: process.env.MCP_SERVER_URL,\r\n  openaiApiKey: process.env.OPENAI_API_KEY,\r\n  model: 'gpt-4o-mini',\r\n  temperature: 0.7,\r\n  maxTokens: 1500\r\n});\r\n\r\nawait host.initialize();\r\n\r\n// Execute with base context and additional task-specific context\r\nconst result = await host.executeTask(\r\n  \"Update the README.md file\",\r\n  \"You are a technical writer assisting with documentation.\",\r\n  \"The README should include installation instructions and usage examples.\"\r\n);\r\n```\r\n\r\n### ContextAwareMcpHost\r\n\r\n```javascript\r\nimport { ContextAwareMcpHost, ContextPriority } from 'github-mcp-client';\r\n\r\nconst host = ContextAwareMcpHost.getInstance({\r\n  serverUrl: process.env.MCP_SERVER_URL,\r\n  openaiApiKey: process.env.OPENAI_API_KEY,\r\n  model: 'gpt-4o-mini',\r\n  temperature: 0.7,\r\n  maxTokens: 1500,\r\n  maxContextSize: 90000,\r\n  includePreviousResults: true\r\n});\r\n\r\nawait host.initialize();\r\n\r\n// Set system context\r\nhost.setSystemContext(\"You are a code review assistant.\");\r\n\r\n// Add file context\r\nhost.addFileContext(\r\n  \"src/components/Button.tsx\",\r\n  \"// Button component code...\",\r\n  ContextPriority.HIGH\r\n);\r\n\r\n// Execute a task with the accumulated context\r\nconst result = await host.executeTask(\r\n  \"Review the Button component and suggest improvements.\"\r\n);\r\n```\r\n\r\n## MCP Server\r\n\r\nThis client library requires an MCP server to function. You can set up your own MCP server or use a hosted solution. Refer to the MCP documentation for more details on server setup.\r\n\r\n## Environment Variables\r\n\r\nThe library uses the following environment variables:\r\n\r\n- `MCP_SERVER_URL`: URL of the MCP server\r\n- `OPENAI_API_KEY`: API key for OpenAI\r\n\r\n## License\r\n\r\nMIT ","readmeFilename":"README.md"}