Skip to content

Latest commit

 

History

History
841 lines (678 loc) · 39.1 KB

File metadata and controls

841 lines (678 loc) · 39.1 KB

ਕਮਿਊਨਿਟੀ ਅਤੇ ਯੋਗਦਾਨ

MCP ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣ ਦਾ ਤਰੀਕਾ: ਟੂਲ, ਦਸਤਾਵੇਜ਼, ਕੋਡ ਅਤੇ ਹੋਰ

(ਉਪਰ ਦਿੱਤੀ ਤਸਵੀਰ 'ਤੇ ਕਲਿਕ ਕਰਕੇ ਇਸ ਪਾਠ ਦਾ ਵੀਡੀਓ ਵੇਖੋ)

ਝਲਕ

ਇਹ ਪਾਠ MCP ਕਮਿਊਨਿਟੀ ਨਾਲ ਜੁੜਨ, MCP ਇਕੋਸਿਸਟਮ ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣ ਅਤੇ ਸਹਿਯੋਗੀ ਵਿਕਾਸ ਲਈ ਸ੍ਰੇਸ਼ਠ ਅਭਿਆਸਾਂ ਦੀ ਪਾਲਣਾ ਕਰਨ 'ਤੇ ਧਿਆਨ ਕੇਂਦਰਿਤ ਕਰਦਾ ਹੈ। ਖੁੱਲੇ-ਸਰੋਤ MCP ਪ੍ਰੋਜੈਕਟਾਂ ਵਿੱਚ ਹਿੱਸਾ ਲੈਣ ਦਾ ਸਮਝਣਾ ਉਹਨਾਂ ਲਈ ਜ਼ਰੂਰੀ ਹੈ ਜੋ ਇਸ ਤਕਨਾਲੋਜੀ ਦੇ ਭਵਿੱਖ ਨੂੰ ਰੂਪ ਦੇਣਾ ਚਾਹੁੰਦੇ ਹਨ।

ਸਿੱਖਣ ਦੇ ਉਦੇਸ਼

ਇਸ ਪਾਠ ਦੇ ਅੰਤ ਤੱਕ, ਤੁਸੀਂ ਸਮਰੱਥ ਹੋਵੋਗੇ:

  • MCP ਕਮਿਊਨਿਟੀ ਅਤੇ ਇਕੋਸਿਸਟਮ ਦੀ ਬਣਤਰ ਨੂੰ ਸਮਝਣਾ
  • MCP ਕਮਿਊਨਿਟੀ ਫੋਰਮਾਂ ਅਤੇ ਚਰਚਾਵਾਂ ਵਿੱਚ ਪ੍ਰਭਾਵਸ਼ਾਲੀ ਤਰੀਕੇ ਨਾਲ ਹਿੱਸਾ ਲੈਣਾ
  • MCP ਖੁੱਲੇ-ਸਰੋਤ ਰਿਪੋਜ਼ਿਟਰੀਜ਼ ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣਾ
  • ਕਸਟਮ MCP ਟੂਲ ਅਤੇ ਸਰਵਰ ਬਣਾਉਣਾ ਅਤੇ ਸਾਂਝੇ ਕਰਨਾ
  • MCP ਵਿਕਾਸ ਅਤੇ ਸਹਿਯੋਗ ਲਈ ਸ੍ਰੇਸ਼ਠ ਅਭਿਆਸਾਂ ਦੀ ਪਾਲਣਾ ਕਰਨਾ
  • MCP ਵਿਕਾਸ ਲਈ ਕਮਿਊਨਿਟੀ ਸਰੋਤ ਅਤੇ ਫਰੇਮਵਰਕ ਖੋਜਣਾ

MCP ਕਮਿਊਨਿਟੀ ਇਕੋਸਿਸਟਮ

MCP ਇਕੋਸਿਸਟਮ ਵਿੱਚ ਵੱਖ-ਵੱਖ ਘਟਕ ਅਤੇ ਭਾਗੀਦਾਰ ਸ਼ਾਮਲ ਹਨ ਜੋ ਪ੍ਰੋਟੋਕੋਲ ਨੂੰ ਅੱਗੇ ਵਧਾਉਣ ਲਈ ਇਕੱਠੇ ਕੰਮ ਕਰਦੇ ਹਨ।

ਮੁੱਖ ਕਮਿਊਨਿਟੀ ਘਟਕ

  1. ਕੋਰ ਪ੍ਰੋਟੋਕੋਲ ਮੇਂਟੇਨਰ: ਅਧਿਕਾਰਕ Model Context Protocol GitHub organization ਕੋਰ MCP ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ ਅਤੇ ਰਿਫਰੈਂਸ ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ ਨੂੰ ਸੰਭਾਲਦਾ ਹੈ।
  2. ਟੂਲ ਡਿਵੈਲਪਰ: ਵਿਅਕਤੀ ਅਤੇ ਟੀਮਾਂ ਜੋ MCP ਟੂਲ ਅਤੇ ਸਰਵਰ ਬਣਾਉਂਦੀਆਂ ਹਨ।
  3. ਇੰਟੀਗ੍ਰੇਸ਼ਨ ਪ੍ਰੋਵਾਈਡਰ: ਕੰਪਨੀਆਂ ਜੋ ਆਪਣੇ ਉਤਪਾਦਾਂ ਅਤੇ ਸੇਵਾਵਾਂ ਵਿੱਚ MCP ਨੂੰ ਸ਼ਾਮਲ ਕਰਦੀਆਂ ਹਨ।
  4. ਐਂਡ ਯੂਜ਼ਰ: ਡਿਵੈਲਪਰ ਅਤੇ ਸੰਗਠਨ ਜੋ ਆਪਣੇ ਐਪਲੀਕੇਸ਼ਨਾਂ ਵਿੱਚ MCP ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਨ।
  5. ਯੋਗਦਾਨਕਰਤਾ: ਕਮਿਊਨਿਟੀ ਮੈਂਬਰ ਜੋ ਕੋਡ, ਦਸਤਾਵੇਜ਼ ਜਾਂ ਹੋਰ ਸਰੋਤਾਂ ਵਿੱਚ ਯੋਗਦਾਨ ਪਾਉਂਦੇ ਹਨ।

ਕਮਿਊਨਿਟੀ ਸਰੋਤ

ਅਧਿਕਾਰਕ ਚੈਨਲ

ਕਮਿਊਨਿਟੀ-ਚਲਿਤ ਸਰੋਤ

  • MCP Clients - ਉਹ ਕਲਾਇੰਟਾਂ ਦੀ ਸੂਚੀ ਜੋ MCP ਇੰਟੀਗ੍ਰੇਸ਼ਨ ਨੂੰ ਸਹਾਰਾ ਦਿੰਦੇ ਹਨ।
  • Community MCP Servers - ਕਮਿਊਨਿਟੀ ਦੁਆਰਾ ਵਿਕਸਿਤ MCP ਸਰਵਰਾਂ ਦੀ ਵਧ ਰਹੀ ਸੂਚੀ।
  • Awesome MCP Servers - ਚੁਣੇ ਹੋਏ MCP ਸਰਵਰਾਂ ਦੀ ਸੂਚੀ।
  • PulseMCP - MCP ਸਰੋਤਾਂ ਦੀ ਖੋਜ ਲਈ ਕਮਿਊਨਿਟੀ ਹੱਬ ਅਤੇ ਨਿਊਜ਼ਲੈਟਰ।
  • Discord Server - MCP ਡਿਵੈਲਪਰਾਂ ਨਾਲ ਜੁੜੋ।
  • ਭਾਸ਼ਾ-ਵਿਸ਼ੇਸ਼ SDK ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ।
  • ਬਲੌਗ ਪੋਸਟ ਅਤੇ ਟਿਊਟੋਰਿਅਲ।

MCP ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣਾ

ਯੋਗਦਾਨ ਦੇਣ ਦੇ ਕਿਸਮਾਂ

MCP ਇਕੋਸਿਸਟਮ ਵੱਖ-ਵੱਖ ਕਿਸਮਾਂ ਦੇ ਯੋਗਦਾਨਾਂ ਦਾ ਸਵਾਗਤ ਕਰਦਾ ਹੈ:

  1. ਕੋਡ ਯੋਗਦਾਨ:

    • ਕੋਰ ਪ੍ਰੋਟੋਕੋਲ ਵਿੱਚ ਸੁਧਾਰ
    • ਬੱਗ ਫਿਕਸ
    • ਟੂਲ ਅਤੇ ਸਰਵਰ ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ
    • ਵੱਖ-ਵੱਖ ਭਾਸ਼ਾਵਾਂ ਵਿੱਚ ਕਲਾਇੰਟ/ਸਰਵਰ ਲਾਇਬ੍ਰੇਰੀਜ਼
  2. ਦਸਤਾਵੇਜ਼:

    • ਮੌਜੂਦਾ ਦਸਤਾਵੇਜ਼ ਵਿੱਚ ਸੁਧਾਰ
    • ਟਿਊਟੋਰਿਅਲ ਅਤੇ ਗਾਈਡ ਬਣਾਉਣਾ
    • ਦਸਤਾਵੇਜ਼ ਦਾ ਅਨੁਵਾਦ ਕਰਨਾ
    • ਉਦਾਹਰਨਾਂ ਅਤੇ ਸੈਂਪਲ ਐਪਲੀਕੇਸ਼ਨ ਬਣਾਉਣਾ
  3. ਕਮਿਊਨਿਟੀ ਸਹਾਇਤਾ:

    • ਫੋਰਮਾਂ ਅਤੇ ਚਰਚਾਵਾਂ 'ਤੇ ਸਵਾਲਾਂ ਦੇ ਜਵਾਬ ਦੇਣਾ
    • ਟੈਸਟਿੰਗ ਅਤੇ ਮੁੱਦਿਆਂ ਦੀ ਰਿਪੋਰਟਿੰਗ
    • ਕਮਿਊਨਿਟੀ ਇਵੈਂਟ ਆਯੋਜਿਤ ਕਰਨਾ
    • ਨਵੇਂ ਯੋਗਦਾਨਕਰਤਾਵਾਂ ਨੂੰ ਮਦਦ ਦੇਣਾ

ਕੋਰ ਪ੍ਰੋਟੋਕੋਲ ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣ ਦੀ ਪ੍ਰਕਿਰਿਆ

ਕੋਰ MCP ਪ੍ਰੋਟੋਕੋਲ ਜਾਂ ਅਧਿਕਾਰਕ ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣ ਲਈ, ਅਧਿਕਾਰਕ ਯੋਗਦਾਨ ਦੇਣ ਦੇ ਨਿਯਮ ਦੇ ਇਹ ਸਿਧਾਂਤਾਂ ਦੀ ਪਾਲਣਾ ਕਰੋ:

  1. ਸਾਦਗੀ ਅਤੇ ਘੱਟਪਣ: MCP ਵਿਸ਼ੇਸ਼ਤਾ ਨਵੇਂ ਸੰਕਲਪਾਂ ਨੂੰ ਸ਼ਾਮਲ ਕਰਨ ਲਈ ਉੱਚ ਮਾਪਦੰਡ ਰੱਖਦੀ ਹੈ। ਵਿਸ਼ੇਸ਼ਤਾ ਵਿੱਚ ਚੀਜ਼ਾਂ ਸ਼ਾਮਲ ਕਰਨਾ ਹਟਾਉਣ ਨਾਲ ਆਸਾਨ ਹੁੰਦਾ ਹੈ।

  2. ਠੋਸ ਦ੍ਰਿਸ਼ਟੀਕੋਣ: ਵਿਸ਼ੇਸ਼ਤਾ ਵਿੱਚ ਬਦਲਾਅ ਵਿਸ਼ੇਸ਼ ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ ਚੁਣੌਤੀਆਂ 'ਤੇ ਆਧਾਰਿਤ ਹੋਣੇ ਚਾਹੀਦੇ ਹਨ, ਨਾ ਕਿ ਅਨੁਮਾਨਿਤ ਵਿਚਾਰਾਂ 'ਤੇ।

  3. ਪ੍ਰਸਤਾਵ ਦੇ ਪੜਾਅ:

    • ਪਰਿਭਾਸ਼ਿਤ ਕਰੋ: ਸਮੱਸਿਆ ਦੇ ਖੇਤਰ ਦੀ ਜਾਂਚ ਕਰੋ, ਪੁਸ਼ਟੀ ਕਰੋ ਕਿ ਹੋਰ MCP ਯੂਜ਼ਰ ਵੀ ਇਸੇ ਸਮੱਸਿਆ ਦਾ ਸਾਹਮਣਾ ਕਰਦੇ ਹਨ।
    • ਪ੍ਰੋਟੋਟਾਈਪ ਬਣਾਓ: ਇੱਕ ਉਦਾਹਰਨ ਹੱਲ ਬਣਾਓ ਅਤੇ ਇਸਦੀ ਵਿਵਹਾਰਕ ਲਾਗੂ ਕਰਨ ਦੀ ਪ੍ਰਦਰਸ਼ਨ ਕਰੋ।
    • ਲਿਖੋ: ਪ੍ਰੋਟੋਟਾਈਪ ਦੇ ਆਧਾਰ 'ਤੇ, ਵਿਸ਼ੇਸ਼ਤਾ ਪ੍ਰਸਤਾਵ ਲਿਖੋ।

ਵਿਕਾਸ ਵਾਤਾਵਰਣ ਸੈਟਅਪ

# Fork the repository
git clone https://github.com/YOUR-USERNAME/modelcontextprotocol.git
cd modelcontextprotocol

# Install dependencies
npm install

# For schema changes, validate and generate schema.json:
npm run check:schema:ts
npm run generate:schema

# For documentation changes
npm run check:docs
npm run format

# Preview documentation locally (optional):
npm run serve:docs

ਉਦਾਹਰਨ: ਬੱਗ ਫਿਕਸ ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣਾ

// Original code with bug in the typescript-sdk
export function validateResource(resource: unknown): resource is MCPResource {
  if (!resource || typeof resource !== 'object') {
    return false;
  }
  
  // Bug: Missing property validation
  // Current implementation:
  const hasName = 'name' in resource;
  const hasSchema = 'schema' in resource;
  
  return hasName && hasSchema;
}

// Fixed implementation in a contribution
export function validateResource(resource: unknown): resource is MCPResource {
  if (!resource || typeof resource !== 'object') {
    return false;
  }
  
  // Improved validation
  const hasName = 'name' in resource && typeof (resource as MCPResource).name === 'string';
  const hasSchema = 'schema' in resource && typeof (resource as MCPResource).schema === 'object';
  const hasDescription = !('description' in resource) || typeof (resource as MCPResource).description === 'string';
  
  return hasName && hasSchema && hasDescription;
}

ਉਦਾਹਰਨ: ਸਟੈਂਡਰਡ ਲਾਇਬ੍ਰੇਰੀ ਵਿੱਚ ਨਵਾਂ ਟੂਲ ਸ਼ਾਮਲ ਕਰਨਾ

# Example contribution: A CSV data processing tool for the MCP standard library

from mcp_tools import Tool, ToolRequest, ToolResponse, ToolExecutionException
import pandas as pd
import io
import json
from typing import Dict, Any, List, Optional

class CsvProcessingTool(Tool):
    """
    Tool for processing and analyzing CSV data.
    
    This tool allows models to extract information from CSV files,
    run basic analysis, and convert data between formats.
    """
    
    def get_name(self):
        return "csvProcessor"
        
    def get_description(self):
        return "Processes and analyzes CSV data"
    
    def get_schema(self):
        return {
            "type": "object",
            "properties": {
                "csvData": {
                    "type": "string", 
                    "description": "CSV data as a string"
                },
                "csvUrl": {
                    "type": "string",
                    "description": "URL to a CSV file (alternative to csvData)"
                },
                "operation": {
                    "type": "string",
                    "enum": ["summary", "filter", "transform", "convert"],
                    "description": "Operation to perform on the CSV data"
                },
                "filterColumn": {
                    "type": "string",
                    "description": "Column to filter by (for filter operation)"
                },
                "filterValue": {
                    "type": "string",
                    "description": "Value to filter for (for filter operation)"
                },
                "outputFormat": {
                    "type": "string",
                    "enum": ["json", "csv", "markdown"],
                    "default": "json",
                    "description": "Output format for the processed data"
                }
            },
            "oneOf": [
                {"required": ["csvData", "operation"]},
                {"required": ["csvUrl", "operation"]}
            ]
        }
    
    async def execute_async(self, request: ToolRequest) -> ToolResponse:
        try:
            # Extract parameters
            operation = request.parameters.get("operation")
            output_format = request.parameters.get("outputFormat", "json")
            
            # Get CSV data from either direct data or URL
            df = await self._get_dataframe(request)
            
            # Process based on requested operation
            result = {}
            
            if operation == "summary":
                result = self._generate_summary(df)
            elif operation == "filter":
                column = request.parameters.get("filterColumn")
                value = request.parameters.get("filterValue")
                if not column:
                    raise ToolExecutionException("filterColumn is required for filter operation")
                result = self._filter_data(df, column, value)
            elif operation == "transform":
                result = self._transform_data(df, request.parameters)
            elif operation == "convert":
                result = self._convert_format(df, output_format)
            else:
                raise ToolExecutionException(f"Unknown operation: {operation}")
            
            return ToolResponse(result=result)
        
        except Exception as e:
            raise ToolExecutionException(f"CSV processing failed: {str(e)}")
    
    async def _get_dataframe(self, request: ToolRequest) -> pd.DataFrame:
        """Gets a pandas DataFrame from either CSV data or URL"""
        if "csvData" in request.parameters:
            csv_data = request.parameters.get("csvData")
            return pd.read_csv(io.StringIO(csv_data))
        elif "csvUrl" in request.parameters:
            csv_url = request.parameters.get("csvUrl")
            return pd.read_csv(csv_url)
        else:
            raise ToolExecutionException("Either csvData or csvUrl must be provided")
    
    def _generate_summary(self, df: pd.DataFrame) -> Dict[str, Any]:
        """Generates a summary of the CSV data"""
        return {
            "columns": df.columns.tolist(),
            "rowCount": len(df),
            "columnCount": len(df.columns),
            "numericColumns": df.select_dtypes(include=['number']).columns.tolist(),
            "categoricalColumns": df.select_dtypes(include=['object']).columns.tolist(),
            "sampleRows": json.loads(df.head(5).to_json(orient="records")),
            "statistics": json.loads(df.describe().to_json())
        }
    
    def _filter_data(self, df: pd.DataFrame, column: str, value: str) -> Dict[str, Any]:
        """Filters the DataFrame by a column value"""
        if column not in df.columns:
            raise ToolExecutionException(f"Column '{column}' not found")
            
        filtered_df = df[df[column].astype(str).str.contains(value)]
        
        return {
            "originalRowCount": len(df),
            "filteredRowCount": len(filtered_df),
            "data": json.loads(filtered_df.to_json(orient="records"))
        }
    
    def _transform_data(self, df: pd.DataFrame, params: Dict[str, Any]) -> Dict[str, Any]:
        """Transforms the data based on parameters"""
        # Implementation would include various transformations
        return {
            "status": "success",
            "message": "Transformation applied"
        }
    
    def _convert_format(self, df: pd.DataFrame, format: str) -> Dict[str, Any]:
        """Converts the DataFrame to different formats"""
        if format == "json":
            return {
                "data": json.loads(df.to_json(orient="records")),
                "format": "json"
            }
        elif format == "csv":
            return {
                "data": df.to_csv(index=False),
                "format": "csv"
            }
        elif format == "markdown":
            return {
                "data": df.to_markdown(),
                "format": "markdown"
            }
        else:
            raise ToolExecutionException(f"Unsupported output format: {format}")

ਯੋਗਦਾਨ ਦੇਣ ਦੇ ਨਿਯਮ

MCP ਪ੍ਰੋਜੈਕਟਾਂ ਵਿੱਚ ਸਫਲ ਯੋਗਦਾਨ ਦੇਣ ਲਈ:

  1. ਛੋਟੇ ਤੋਂ ਸ਼ੁਰੂ ਕਰੋ: ਦਸਤਾਵੇਜ਼, ਬੱਗ ਫਿਕਸ ਜਾਂ ਛੋਟੇ ਸੁਧਾਰਾਂ ਨਾਲ ਸ਼ੁਰੂ ਕਰੋ।
  2. ਸਟਾਈਲ ਗਾਈਡ ਦੀ ਪਾਲਣਾ ਕਰੋ: ਪ੍ਰੋਜੈਕਟ ਦੇ ਕੋਡਿੰਗ ਸਟਾਈਲ ਅਤੇ ਰਿਵਾਜਾਂ ਦੀ ਪਾਲਣਾ ਕਰੋ।
  3. ਟੈਸਟ ਲਿਖੋ: ਆਪਣੇ ਕੋਡ ਯੋਗਦਾਨਾਂ ਲਈ ਯੂਨਿਟ ਟੈਸਟ ਸ਼ਾਮਲ ਕਰੋ।
  4. ਆਪਣੇ ਕੰਮ ਨੂੰ ਦਸਤਾਵੇਜ਼ ਬਣਾਓ: ਨਵੀਆਂ ਵਿਸ਼ੇਸ਼ਤਾਵਾਂ ਜਾਂ ਬਦਲਾਅ ਲਈ ਸਪਸ਼ਟ ਦਸਤਾਵੇਜ਼ ਸ਼ਾਮਲ ਕਰੋ।
  5. ਟਾਰਗਟ ਕੀਤੇ PRs ਸਬਮਿਟ ਕਰੋ: ਪੂਲ ਰਿਕਵੇਸਟ ਨੂੰ ਇੱਕ ਹੀ ਮੁੱਦੇ ਜਾਂ ਵਿਸ਼ੇਸ਼ਤਾ 'ਤੇ ਕੇਂਦਰਿਤ ਰੱਖੋ।
  6. ਫੀਡਬੈਕ ਨਾਲ ਜੁੜੋ: ਆਪਣੇ ਯੋਗਦਾਨਾਂ 'ਤੇ ਫੀਡਬੈਕ ਲਈ ਜਵਾਬਦੇਹ ਰਹੋ।

ਯੋਗਦਾਨ ਦੇਣ ਦਾ ਵਰਕਫਲੋ

# Clone the repository
git clone https://github.com/modelcontextprotocol/typescript-sdk.git
cd typescript-sdk

# Create a new branch for your contribution
git checkout -b feature/my-contribution

# Make your changes
# ...

# Run tests to ensure your changes don't break existing functionality
npm test

# Commit your changes with a descriptive message
git commit -am "Fix validation in resource handler"

# Push your branch to your fork
git push origin feature/my-contribution

# Create a pull request from your branch to the main repository
# Then engage with feedback and iterate on your PR as needed

MCP ਸਰਵਰ ਬਣਾਉਣਾ ਅਤੇ ਸਾਂਝੇ ਕਰਨਾ

MCP ਇਕੋਸਿਸਟਮ ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣ ਦੇ ਸਭ ਤੋਂ ਕੀਮਤੀ ਤਰੀਕਿਆਂ ਵਿੱਚੋਂ ਇੱਕ ਹੈ ਕਸਟਮ MCP ਸਰਵਰ ਬਣਾਉਣਾ ਅਤੇ ਸਾਂਝੇ ਕਰਨਾ। ਕਮਿਊਨਿਟੀ ਨੇ ਪਹਿਲਾਂ ਹੀ ਵੱਖ-ਵੱਖ ਸੇਵਾਵਾਂ ਅਤੇ ਵਰਤੋਂ ਦੇ ਕੇਸਾਂ ਲਈ ਸੈਂਕੜੇ ਸਰਵਰ ਵਿਕਸਿਤ ਕੀਤੇ ਹਨ।

MCP ਸਰਵਰ ਵਿਕਾਸ ਫਰੇਮਵਰਕ

MCP ਸਰਵਰ ਵਿਕਾਸ ਨੂੰ ਆਸਾਨ ਬਣਾਉਣ ਲਈ ਕਈ ਫਰੇਮਵਰਕ ਉਪਲਬਧ ਹਨ:

  1. ਅਧਿਕਾਰਕ SDKs:

  2. ਕਮਿਊਨਿਟੀ ਫਰੇਮਵਰਕ:

    • MCP-Framework - TypeScript ਵਿੱਚ MCP ਸਰਵਰ ਬਣਾਉਣ ਲਈ ਤੇਜ਼ ਅਤੇ ਸੁੰਦਰ ਤਰੀਕਾ।
    • MCP Declarative Java SDK - ਜਾਵਾ ਵਿੱਚ ਐਨੋਟੇਸ਼ਨ-ਚਲਿਤ MCP ਸਰਵਰ।
    • Quarkus MCP Server SDK - ਜਾਵਾ ਫਰੇਮਵਰਕ MCP ਸਰਵਰਾਂ ਲਈ।
    • Next.js MCP Server Template - MCP ਸਰਵਰਾਂ ਲਈ ਸ਼ੁਰੂਆਤੀ Next.js ਪ੍ਰੋਜੈਕਟ।

ਸਾਂਝੇ ਕਰਨ ਯੋਗ ਟੂਲ ਵਿਕਸਿਤ ਕਰਨਾ

.NET ਉਦਾਹਰਨ: ਸਾਂਝੇ ਕਰਨ ਯੋਗ ਟੂਲ ਪੈਕੇਜ ਬਣਾਉਣਾ

// Create a new .NET library project
// dotnet new classlib -n McpFinanceTools

using Microsoft.Mcp.Tools;
using System.Threading.Tasks;
using System.Net.Http;
using System.Text.Json;

namespace McpFinanceTools
{
    // Stock quote tool
    public class StockQuoteTool : IMcpTool
    {
        private readonly HttpClient _httpClient;
        
        public StockQuoteTool(HttpClient httpClient = null)
        {
            _httpClient = httpClient ?? new HttpClient();
        }
        
        public string Name => "stockQuote";
        public string Description => "Gets current stock quotes for specified symbols";
        
        public object GetSchema()
        {
            return new {
                type = "object",
                properties = new {
                    symbol = new { 
                        type = "string",
                        description = "Stock symbol (e.g., MSFT, AAPL)" 
                    },
                    includeHistory = new { 
                        type = "boolean",
                        description = "Whether to include historical data",
                        default = false
                    }
                },
                required = new[] { "symbol" }
            };
        }
        
        public async Task<ToolResponse> ExecuteAsync(ToolRequest request)
        {
            // Extract parameters
            string symbol = request.Parameters.GetProperty("symbol").GetString();
            bool includeHistory = false;
            
            if (request.Parameters.TryGetProperty("includeHistory", out var historyProp))
            {
                includeHistory = historyProp.GetBoolean();
            }
            
            // Call external API (example)
            var quoteResult = await GetStockQuoteAsync(symbol);
            
            // Add historical data if requested
            if (includeHistory)
            {
                var historyData = await GetStockHistoryAsync(symbol);
                quoteResult.Add("history", historyData);
            }
            
            // Return formatted result
            return new ToolResponse {
                Result = JsonSerializer.SerializeToElement(quoteResult)
            };
        }
        
        private async Task<Dictionary<string, object>> GetStockQuoteAsync(string symbol)
        {
            // Implementation would call a real stock API
            // This is a simplified example
            return new Dictionary<string, object>
            {
                ["symbol"] = symbol,
                ["price"] = 123.45,
                ["change"] = 2.5,
                ["percentChange"] = 1.2,
                ["lastUpdated"] = DateTime.UtcNow
            };
        }
        
        private async Task<object> GetStockHistoryAsync(string symbol)
        {
            // Implementation would get historical data
            // Simplified example
            return new[]
            {
                new { date = DateTime.Now.AddDays(-7).Date, price = 120.25 },
                new { date = DateTime.Now.AddDays(-6).Date, price = 122.50 },
                new { date = DateTime.Now.AddDays(-5).Date, price = 121.75 }
                // More historical data...
            };
        }
    }
}

// Create package and publish to NuGet
// dotnet pack -c Release
// dotnet nuget push bin/Release/McpFinanceTools.1.0.0.nupkg -s https://api.nuget.org/v3/index.json -k YOUR_API_KEY

Java ਉਦਾਹਰਨ: ਟੂਲ ਲਈ Maven ਪੈਕੇਜ ਬਣਾਉਣਾ

// pom.xml configuration for a shareable MCP tool package
<!-- 
<project>
    <groupId>com.example</groupId>
    <artifactId>mcp-weather-tools</artifactId>
    <version>1.0.0</version>
    
    <dependencies>
        <dependency>
            <groupId>com.mcp</groupId>
            <artifactId>mcp-server</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    
    <distributionManagement>
        <repository>
            <id>github</id>
            <name>GitHub Packages</name>
            <url>https://maven.pkg.github.com/username/mcp-weather-tools</url>
        </repository>
    </distributionManagement>
</project>
-->

package com.example.mcp.weather;

import com.mcp.tools.Tool;
import com.mcp.tools.ToolRequest;
import com.mcp.tools.ToolResponse;
import com.mcp.tools.ToolExecutionException;

import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;

public class WeatherForecastTool implements Tool {
    private final HttpClient httpClient;
    private final String apiKey;
    
    public WeatherForecastTool(String apiKey) {
        this.httpClient = HttpClient.newHttpClient();
        this.apiKey = apiKey;
    }
    
    @Override
    public String getName() {
        return "weatherForecast";
    }
    
    @Override
    public String getDescription() {
        return "Gets weather forecast for a specified location";
    }
    
    @Override
    public Object getSchema() {
        Map<String, Object> schema = new HashMap<>();
        // Schema definition...
        return schema;
    }
    
    @Override
    public ToolResponse execute(ToolRequest request) {
        try {
            String location = request.getParameters().get("location").asText();
            int days = request.getParameters().has("days") ? 
                request.getParameters().get("days").asInt() : 3;
            
            // Call weather API
            Map<String, Object> forecast = getForecast(location, days);
            
            // Build response
            return new ToolResponse.Builder()
                .setResult(forecast)
                .build();
        } catch (Exception ex) {
            throw new ToolExecutionException("Weather forecast failed: " + ex.getMessage(), ex);
        }
    }
    
    private Map<String, Object> getForecast(String location, int days) {
        // Implementation would call weather API
        // Simplified example
        Map<String, Object> result = new HashMap<>();
        // Add forecast data...
        return result;
    }
}

// Build and publish using Maven
// mvn clean package
// mvn deploy

Python ਉਦਾਹਰਨ: PyPI ਪੈਕੇਜ ਪ੍ਰਕਾਸ਼ਿਤ ਕਰਨਾ

# Directory structure for a PyPI package:
# mcp_nlp_tools/
# ├── LICENSE
# ├── README.md
# ├── setup.py
# ├── mcp_nlp_tools/
# │   ├── __init__.py
# │   ├── sentiment_tool.py
# │   └── translation_tool.py

# Example setup.py
"""
from setuptools import setup, find_packages

setup(
    name="mcp_nlp_tools",
    version="0.1.0",
    packages=find_packages(),
    install_requires=[
        "mcp_server>=1.0.0",
        "transformers>=4.0.0",
        "torch>=1.8.0"
    ],
    author="Your Name",
    author_email="your.email@example.com",
    description="MCP tools for natural language processing tasks",
    long_description=open("README.md").read(),
    long_description_content_type="text/markdown",
    url="https://github.com/username/mcp_nlp_tools",
    classifiers=[
        "Programming Language :: Python :: 3",
        "License :: OSI Approved :: MIT License",
        "Operating System :: OS Independent",
    ],
    python_requires=">=3.8",
)
"""

# Example NLP tool implementation (sentiment_tool.py)
from mcp_tools import Tool, ToolRequest, ToolResponse, ToolExecutionException
from transformers import pipeline
import torch

class SentimentAnalysisTool(Tool):
    """MCP tool for sentiment analysis of text"""
    
    def __init__(self, model_name="distilbert-base-uncased-finetuned-sst-2-english"):
        # Load the sentiment analysis model
        self.sentiment_analyzer = pipeline("sentiment-analysis", model=model_name)
    
    def get_name(self):
        return "sentimentAnalysis"
        
    def get_description(self):
        return "Analyzes the sentiment of text, classifying it as positive or negative"
    
    def get_schema(self):
        return {
            "type": "object",
            "properties": {
                "text": {
                    "type": "string", 
                    "description": "The text to analyze for sentiment"
                },
                "includeScore": {
                    "type": "boolean",
                    "description": "Whether to include confidence scores",
                    "default": True
                }
            },
            "required": ["text"]
        }
    
    async def execute_async(self, request: ToolRequest) -> ToolResponse:
        try:
            # Extract parameters
            text = request.parameters.get("text")
            include_score = request.parameters.get("includeScore", True)
            
            # Analyze sentiment
            sentiment_result = self.sentiment_analyzer(text)[0]
            
            # Format result
            result = {
                "sentiment": sentiment_result["label"],
                "text": text
            }
            
            if include_score:
                result["score"] = sentiment_result["score"]
            
            # Return result
            return ToolResponse(result=result)
            
        except Exception as e:
            raise ToolExecutionException(f"Sentiment analysis failed: {str(e)}")

# To publish:
# python setup.py sdist bdist_wheel
# python -m twine upload dist/*

ਸ੍ਰੇਸ਼ਠ ਅਭਿਆਸ ਸਾਂਝੇ ਕਰਨਾ

ਕਮਿਊਨਿਟੀ ਨਾਲ MCP ਟੂਲ ਸਾਂਝੇ ਕਰਦੇ ਸਮੇਂ:

  1. ਪੂਰੀ ਦਸਤਾਵੇਜ਼:

    • ਉਦੇਸ਼, ਵਰਤੋਂ ਅਤੇ ਉਦਾਹਰਨਾਂ ਨੂੰ ਦਸਤਾਵੇਜ਼ ਬਣਾਓ।
    • ਪੈਰਾਮੀਟਰ ਅਤੇ ਵਾਪਸੀ ਮੁੱਲਾਂ ਨੂੰ ਸਮਝਾਓ।
    • ਕਿਸੇ ਵੀ ਬਾਹਰੀ ਨਿਰਭਰਤਾਵਾਂ ਨੂੰ ਦਸਤਾਵੇਜ਼ ਬਣਾਓ।
  2. ਗਲਤੀ ਸੰਭਾਲ:

    • ਮਜ਼ਬੂਤ ਗਲਤੀ ਸੰਭਾਲ ਲਾਗੂ ਕਰੋ।
    • ਉਪਯੋਗੀ ਗਲਤੀ ਸੁਨੇਹੇ ਪ੍ਰਦਾਨ ਕਰੋ।
    • ਐਜ ਕੇਸਾਂ ਨੂੰ ਸੁਚਾਰੂ ਤਰੀਕੇ ਨਾਲ ਸੰਭਾਲੋ।
  3. ਕਾਰਗੁਜ਼ਾਰੀ ਦੇ ਵਿਚਾਰ:

    • ਗਤੀ ਅਤੇ ਸਰੋਤ ਦੀ ਵਰਤੋਂ ਦੋਵਾਂ ਲਈ ਅਨੁਕੂਲ ਬਣਾਓ।
    • ਜਿੱਥੇ ਜ਼ਰੂਰੀ ਹੋਵੇ, ਕੈਸ਼ਿੰਗ ਲਾਗੂ ਕਰੋ।
    • ਸਕੇਲਬਿਲਟੀ 'ਤੇ ਧਿਆਨ ਦਿਓ।
  4. ਸੁਰੱਖਿਆ:

    • ਸੁਰੱਖਿਅਤ API ਕੁੰਜੀਆਂ ਅਤੇ ਪ੍ਰਮਾਣਿਕਤਾ ਦੀ ਵਰਤੋਂ ਕਰੋ।
    • ਇਨਪੁਟ ਨੂੰ ਵੈਧ ਅਤੇ ਸਾਫ਼ ਕਰੋ।
    • ਬਾਹਰੀ API ਕਾਲਾਂ ਲਈ ਦਰ ਰੋਕਣ ਲਾਗੂ ਕਰੋ।
  5. ਟੈਸਟਿੰਗ:

    • ਵਿਸਤ੍ਰਿਤ ਟੈਸਟ ਕਵਰੇਜ ਸ਼ਾਮਲ ਕਰੋ।
    • ਵੱਖ-ਵੱਖ ਇਨਪੁਟ ਕਿਸਮਾਂ ਅਤੇ ਐਜ ਕੇਸਾਂ ਨਾਲ ਟੈਸਟ ਕਰੋ।
    • ਟੈਸਟ ਪ੍ਰਕਿਰਿਆਵਾਂ ਨੂੰ ਦਸਤਾਵੇਜ਼ ਬਣਾਓ।

ਕਮਿਊਨਿਟੀ ਸਹਿਯੋਗ ਅਤੇ ਸ੍ਰੇਸ਼ਠ ਅਭਿਆਸ

ਪ੍ਰਭਾਵਸ਼ਾਲੀ ਸਹਿਯੋਗ MCP ਇਕੋਸਿਸਟਮ ਦੀ ਤਰੱਕੀ ਲਈ ਮਹੱਤਵਪੂਰਨ ਹੈ।

ਸੰਚਾਰ ਚੈਨਲ

  • GitHub Issues ਅਤੇ Discussions
  • Microsoft Tech Community
  • Discord ਅਤੇ Slack ਚੈਨਲ
  • Stack Overflow (ਟੈਗ: model-context-protocol ਜਾਂ mcp)

ਕੋਡ ਰਿਵਿਊ

MCP ਯੋਗਦਾਨਾਂ ਦੀ ਸਮੀਖਿਆ ਕਰਦੇ ਸਮੇਂ:

  1. ਸਪਸ਼ਟਤਾ: ਕੀ ਕੋਡ ਸਪਸ਼ਟ ਅਤੇ ਚੰਗੀ ਤਰ੍ਹਾਂ ਦਸਤਾਵੇਜ਼ ਬਣਾਇਆ ਗਿਆ ਹੈ?
  2. ਸਹੀਪਨ: ਕੀ ਇਹ ਉਮੀਦਾਂ ਅਨੁਸਾਰ ਕੰਮ ਕਰਦਾ ਹੈ?
  3. ਸਥਿਰਤਾ: ਕੀ ਇਹ ਪ੍ਰੋਜੈਕਟ ਦੇ ਰਿਵਾਜਾਂ ਦੀ ਪਾਲਣਾ ਕਰਦਾ ਹੈ?
  4. ਪੂਰਨਤਾ: ਕੀ ਟੈਸਟ ਅਤੇ ਦਸਤਾਵੇਜ਼ ਸ਼ਾਮਲ ਹਨ?
  5. ਸੁਰੱਖਿਆ: ਕੀ ਕੋਈ ਸੁਰੱਖਿਆ ਸੰਬੰਧੀ ਚਿੰਤਾਵਾਂ ਹਨ?

ਵਰਜਨ ਅਨੁਕੂਲਤਾ

MCP ਲਈ ਵਿਕਾਸ ਕਰਦੇ ਸਮੇਂ:

  1. ਪ੍ਰੋਟੋਕੋਲ ਵਰਜਨਿੰਗ: ਉਸ MCP ਪ੍ਰੋਟੋਕੋਲ ਵਰਜਨ ਦੀ ਪਾਲਣਾ ਕਰੋ ਜਿਸਨੂੰ ਤੁਹਾਡਾ ਟੂਲ ਸਹਾਰਾ ਦਿੰਦਾ ਹੈ।
  2. ਕਲਾਇੰਟ ਅਨੁਕੂਲਤਾ: ਪਿਛਲੇ ਵਰਜਨ ਨਾਲ ਅਨੁਕੂਲਤਾ 'ਤੇ ਵਿਚਾਰ ਕਰੋ।
  3. ਸਰਵਰ ਅਨੁਕੂਲਤਾ: ਸਰਵਰ ਇੰਪਲੀਮੈਂਟੇਸ਼ਨ ਦੇ ਨਿਯਮਾਂ ਦੀ ਪਾਲਣਾ ਕਰੋ।
  4. ਤੋੜਨ ਵਾਲੇ ਬਦਲਾਅ: ਕਿਸੇ ਵੀ ਤੋੜਨ ਵਾਲੇ ਬਦਲਾਅ ਨੂੰ ਸਪਸ਼ਟ ਤੌਰ 'ਤੇ ਦਸਤਾਵੇਜ਼ ਬਣਾਓ।

ਉਦਾਹਰਨ ਕਮਿਊਨਿਟੀ ਪ੍ਰੋਜੈਕਟ: MCP ਟੂਲ ਰਜਿਸਟਰੀ

# Example schema for a community tool registry API

from fastapi import FastAPI, HTTPException, Depends
from pydantic import BaseModel, Field, HttpUrl
from typing import List, Optional
import datetime
import uuid

# Models for the tool registry
class ToolSchema(BaseModel):
    """JSON Schema for a tool"""
    type: str
    properties: dict
    required: List[str] = []

class ToolRegistration(BaseModel):
    """Information for registering a tool"""
    name: str = Field(..., description="Unique name for the tool")
    description: str = Field(..., description="Description of what the tool does")
    version: str = Field(..., description="Semantic version of the tool")
    schema: ToolSchema = Field(..., description="JSON Schema for tool parameters")
    author: str = Field(..., description="Author of the tool")
    repository: Optional[HttpUrl] = Field(None, description="Repository URL")
    documentation: Optional[HttpUrl] = Field(None, description="Documentation URL")
    package: Optional[HttpUrl] = Field(None, description="Package URL")
    tags: List[str] = Field(default_factory=list, description="Tags for categorization")
    examples: List[dict] = Field(default_factory=list, description="Example usage")

class Tool(ToolRegistration):
    """Tool with registry metadata"""
    id: uuid.UUID = Field(default_factory=uuid.uuid4)
    created_at: datetime.datetime = Field(default_factory=datetime.datetime.now)
    updated_at: datetime.datetime = Field(default_factory=datetime.datetime.now)
    downloads: int = Field(default=0)
    rating: float = Field(default=0.0)
    ratings_count: int = Field(default=0)

# FastAPI application for the registry
app = FastAPI(title="MCP Tool Registry")

# In-memory database for this example
tools_db = {}

@app.post("/tools", response_model=Tool)
async def register_tool(tool: ToolRegistration):
    """Register a new tool in the registry"""
    if tool.name in tools_db:
        raise HTTPException(status_code=400, detail=f"Tool '{tool.name}' already exists")
    
    new_tool = Tool(**tool.dict())
    tools_db[tool.name] = new_tool
    return new_tool

@app.get("/tools", response_model=List[Tool])
async def list_tools(tag: Optional[str] = None):
    """List all registered tools, optionally filtered by tag"""
    if tag:
        return [tool for tool in tools_db.values() if tag in tool.tags]
    return list(tools_db.values())

@app.get("/tools/{tool_name}", response_model=Tool)
async def get_tool(tool_name: str):
    """Get information about a specific tool"""
    if tool_name not in tools_db:
        raise HTTPException(status_code=404, detail=f"Tool '{tool_name}' not found")
    return tools_db[tool_name]

@app.delete("/tools/{tool_name}")
async def delete_tool(tool_name: str):
    """Delete a tool from the registry"""
    if tool_name not in tools_db:
        raise HTTPException(status_code=404, detail=f"Tool '{tool_name}' not found")
    del tools_db[tool_name]
    return {"message": f"Tool '{tool_name}' deleted"}

ਮੁੱਖ ਗੱਲਾਂ

  • MCP ਕਮਿਊਨਿਟੀ ਵਿਭਿੰਨ ਹੈ ਅਤੇ ਵੱਖ-ਵੱਖ ਕਿਸਮਾਂ ਦੇ ਯੋਗਦਾਨਾਂ ਦਾ ਸਵਾਗਤ ਕਰਦੀ ਹੈ।
  • MCP ਵਿੱਚ ਯੋਗਦਾਨ ਦੇਣਾ ਕੋਰ ਪ੍ਰੋਟੋਕੋਲ ਸੁਧਾਰ ਤੋਂ ਕਸਟਮ ਟੂਲ ਤੱਕ ਹੋ ਸਕਦਾ ਹੈ।
  • ਯੋਗਦਾਨ ਦੇਣ ਦੇ ਨਿਯਮਾਂ ਦੀ ਪਾਲਣਾ ਕਰਨ ਨਾਲ ਤੁਹਾਡਾ PR ਸਵੀਕਾਰ ਹੋਣ ਦੇ ਚਾਂਸ ਵਧਦੇ ਹਨ।
  • MCP ਟੂਲ ਬਣਾਉਣਾ ਅਤੇ ਸਾਂਝੇ ਕਰਨਾ ਇਕੋਸਿਸਟਮ ਨੂੰ ਵਧਾਉਣ ਦਾ ਕੀਮਤੀ ਤਰੀਕਾ ਹੈ।
  • ਕਮਿਊਨਿਟੀ ਸਹਿਯੋਗ MCP ਦੀ ਵਾਧੇ ਅਤੇ ਸੁਧਾਰ ਲਈ ਜ਼ਰੂਰੀ ਹੈ।

ਅਭਿਆਸ

  1. MCP ਇਕੋਸਿਸਟਮ ਵਿੱਚ ਇੱਕ ਖੇਤਰ ਦੀ ਪਛਾਣ ਕਰੋ ਜਿੱਥੇ ਤੁਸੀਂ ਆਪਣੇ ਹੁਨਰ ਅਤੇ ਰੁਚੀਆਂ ਦੇ ਆਧਾਰ 'ਤੇ ਯੋਗਦਾਨ ਦੇ ਸਕਦੇ ਹੋ।
  2. MCP ਰਿਪੋਜ਼ਿਟਰੀ ਨੂੰ ਫੋਰਕ ਕਰੋ ਅਤੇ ਇੱਕ ਸਥਾਨਕ ਵਿਕਾਸ ਵਾਤਾਵਰਣ ਸੈਟਅਪ ਕਰੋ।
  3. ਇੱਕ ਛੋਟਾ ਸੁਧਾਰ, ਬੱਗ ਫਿਕਸ ਜਾਂ ਟੂਲ ਬਣਾਓ ਜੋ ਕਮਿਊਨਿਟੀ ਲਈ ਲਾਭਦਾਇਕ ਹੋਵੇ।
  4. ਆਪਣੇ ਯੋਗਦਾਨ ਨੂੰ ਸਹੀ ਟੈਸਟ ਅਤੇ ਦਸਤਾਵੇਜ਼ ਨਾਲ ਦਸਤਾਵ

ਅਸਵੀਕਾਰਨਾ:
ਇਹ ਦਸਤਾਵੇਜ਼ AI ਅਨੁਵਾਦ ਸੇਵਾ Co-op Translator ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਅਨੁਵਾਦ ਕੀਤਾ ਗਿਆ ਹੈ। ਜਦੋਂ ਕਿ ਅਸੀਂ ਸਹੀਤਾ ਲਈ ਯਤਨਸ਼ੀਲ ਹਾਂ, ਕਿਰਪਾ ਕਰਕੇ ਧਿਆਨ ਦਿਓ ਕਿ ਸਵੈਚਾਲਿਤ ਅਨੁਵਾਦਾਂ ਵਿੱਚ ਗਲਤੀਆਂ ਜਾਂ ਅਸੁਣੀਕਤਾਵਾਂ ਹੋ ਸਕਦੀਆਂ ਹਨ। ਮੂਲ ਦਸਤਾਵੇਜ਼ ਨੂੰ ਇਸਦੀ ਮੂਲ ਭਾਸ਼ਾ ਵਿੱਚ ਅਧਿਕਾਰਤ ਸਰੋਤ ਮੰਨਿਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ। ਮਹੱਤਵਪੂਰਨ ਜਾਣਕਾਰੀ ਲਈ, ਪੇਸ਼ੇਵਰ ਮਨੁੱਖੀ ਅਨੁਵਾਦ ਦੀ ਸਿਫਾਰਸ਼ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। ਇਸ ਅਨੁਵਾਦ ਦੀ ਵਰਤੋਂ ਤੋਂ ਪੈਦਾ ਹੋਣ ਵਾਲੇ ਕਿਸੇ ਵੀ ਗਲਤਫਹਿਮੀ ਜਾਂ ਗਲਤ ਵਿਆਖਿਆ ਲਈ ਅਸੀਂ ਜ਼ਿੰਮੇਵਾਰ ਨਹੀਂ ਹਾਂ।