Skip to content

pb4gv95sfw-coder/github-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

GitHub Agent - Model Context Protocol Demo

Welcome to the github-agent repository! This project demonstrates the Model Context Protocol (MCP), a powerful standard for connecting AI assistants to external data sources and tools.

What is the Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is an open protocol that standardizes how AI applications interact with external systems. It provides a unified way for AI assistants like Claude, ChatGPT, and others to access data and tools from various sources.

Key Concepts

  • MCP Servers: Programs that expose data and functionality through the MCP protocol
  • MCP Clients: AI applications (like Cursor, Claude Desktop) that connect to MCP servers
  • Resources: Data sources that can be read by the AI (files, databases, APIs)
  • Tools: Functions that the AI can execute (create files, run queries, interact with services)
  • Prompts: Templated interactions that can be invoked by users

Why Use MCP?

Benefits

  1. Standardization: One protocol for all integrations, reducing complexity
  2. Security: Controlled access to external resources with proper authentication
  3. Flexibility: Connect to databases, APIs, file systems, and more
  4. Composability: Mix and match different MCP servers for your needs
  5. Developer-Friendly: Simple to implement both servers and clients

Use Cases

  • Database Access: Query and update databases directly from your AI assistant
  • File Management: Read, write, and organize files across your system
  • API Integration: Connect to GitHub, Slack, Jira, and other services
  • Custom Tools: Build specialized tools for your specific workflows
  • Knowledge Bases: Access documentation, wikis, and internal knowledge

How MCP Works

┌─────────────┐         ┌─────────────┐         ┌─────────────┐
│             │         │             │         │             │
│  AI Client  │◄───────►│ MCP Server  │◄───────►│  External   │
│  (Cursor)   │   MCP   │  (GitHub)   │         │  Resources  │
│             │         │             │         │  (GitHub)   │
└─────────────┘         └─────────────┘         └─────────────┘
  1. Client: Your AI application (e.g., Cursor, Claude Desktop)
  2. MCP Server: Middleware that implements the MCP protocol
  3. Resources: External systems (GitHub, databases, file systems, etc.)

Getting Started with MCP

1. Install an MCP Server

For GitHub integration (as used in this demo):

npm install -g @modelcontextprotocol/server-github

2. Configure Your AI Client

Add the MCP server to your configuration file (e.g., ~/.cursor/mcp.json):

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here"
      }
    }
  }
}

3. Generate GitHub Token

  1. Go to https://github.com/settings/tokens
  2. Create a new Personal Access Token (Classic or Fine-grained)
  3. Grant necessary permissions:
    • Classic Token: repo (Full control of repositories)
    • Fine-grained Token: Contents (Read and write), Metadata (Read-only)

4. Restart Your AI Client

After configuring, restart your AI application to load the MCP server.

Available MCP Servers

Official Servers

  • @modelcontextprotocol/server-github: GitHub integration
  • @modelcontextprotocol/server-filesystem: Local file access
  • @modelcontextprotocol/server-postgres: PostgreSQL database
  • @modelcontextprotocol/server-sqlite: SQLite database
  • @modelcontextprotocol/server-slack: Slack integration

Community Servers

Many community-built servers are available for services like:

  • Google Drive
  • AWS S3
  • MongoDB
  • Redis
  • And many more!

Example Use Cases

1. Repository Management

"Create a new repository called 'my-project' and add a README"

2. Issue Tracking

"List all open issues in my repository and summarize them"

3. Code Search

"Find all instances of the function 'processData' across my repositories"

4. Pull Request Workflow

"Create a pull request from the feature branch to main"

Building Your Own MCP Server

You can create custom MCP servers to integrate with any system:

import { Server } from '@modelcontextprotocol/sdk/server/index.js';

const server = new Server({
  name: 'my-custom-server',
  version: '1.0.0',
});

// Define resources
server.setRequestHandler('resources/list', async () => {
  return {
    resources: [
      { uri: 'custom://data', name: 'My Data', mimeType: 'application/json' }
    ]
  };
});

// Define tools
server.setRequestHandler('tools/list', async () => {
  return {
    tools: [
      { name: 'my_tool', description: 'Does something useful', inputSchema: {...} }
    ]
  };
});

Resources

This Repository

This repository was created using the Model Context Protocol! It demonstrates:

  • ✅ Creating a repository via MCP
  • ✅ Managing files through MCP
  • ✅ Authenticating with GitHub using MCP
  • ✅ Automated workflows with AI assistance

Contributing

Feel free to explore MCP and contribute examples of how you're using it! The protocol is open-source and designed for the community.

License

This project is open source and available under the MIT License.


Built with ❤️ using the Model Context Protocol

About

A repository demonstrating the Model Context Protocol (MCP)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors