(ဒီသင်ခန်းစာရဲ့ ဗီဒီယိုကို ကြည့်ရန် အပေါ်မှာ ရုပ်ပုံကို နှိပ်ပါ)
ဒီသင်ခန်းစာသည် MCP အသိုင်းအဝိုင်းနဲ့ ပတ်သက်၍ မည်သို့ ပူးပေါင်းပါဝင်ရမည်၊ MCP စနစ်ပေါ်တွင် မည်သို့ ထောက်ပံ့ရန်၊ နှင့် ပူးပေါင်းဖွံ့ဖြိုးတိုးတက်မှုအတွက် ထိရောက်သောနည်းလမ်းများကို လိုက်နာရမည့် နည်းလမ်းများအပေါ် အာရုံစိုက်သည်။ MCP ကို မူလအရင်းအမြစ်ဖြစ်သည့် ပရောဂျက်များတွင် ပူးပေါင်းပါဝင်သူများအတွက် ဒီနည်းပညာရဲ့ အနာဂတ်ကို ပုံဖော်လိုသူများအတွက် အရေးကြီးသည်။
ဒီသင်ခန်းစာ အဆုံးတွင် သင်သည် အောက်ပါအရာများ ပြုလုပ်နိုင်မည်ဖြစ်သည် -
- MCP အသိုင်းအဝိုင်းနဲ့ စနစ်၏ ဖွဲ့စည်းမှုကို နားလည်
- MCP အသိုင်းအဝိုင်း၏ အခန်းကဏ္ဍများနှင့် ဆွေးနွေးမှုများတွင် ထိရောက်စွာ ပါဝင်
- MCP open-source repository များသို့ ထောက်ပံ့မှု ပေး
- ကိုယ်ပိုင် MCP tools နှင့် ဆာဗာများ ဖန်တီးပြီး မျှဝေ
- MCP ဖွံ့ဖြိုးတိုးတက်ရေး နှင့် ပူးပေါင်းဆောင်ရွက်မှုအတွက် ကောင်းမွန်သော လမ်းစဉ်များလိုက်နာ
- MCP ဖွံ့ဖြိုးတိုးတက်ရေးအတွက် အသိုင်းအဝိုင်းရဲ့ သတင်းအချက်အလက်များနှင့် ဖွဲ့စည်းပုံများ ရှာဖွေ
MCP စနစ်တွင် နည်းပညာကို တိုးတက်အောင်မြင်ရန်အတွက် ပါဝင်သူများနှင့် အစိတ်အပိုင်းတွေ စုစည်းထားသည်။
- Core Protocol Maintainers: တရားဝင် Model Context Protocol GitHub အဖွဲ့အစည်း မှ MCP အခြေခံဖော်ပြချက်များနှင့် ကိုးကားနမူနာများကို ထိန်းသိမ်း
- Tool Developers: MCP tools နှင့် ဆာဗာများကို ဖန်တီးသော လူပုဂ္ဂိုလ်များနှင့် အဖွဲ့များ
- Integration Providers: မိမိတို့ ထုတ်ကုန်များနှင့် ဝန်ဆောင်မှုများတွင် MCP ကို ပေါင်းစပ်အသုံးပြုသော ကုမ္ပဏီများ
- End Users: MCP ကို မိမိတို့ အက်ပ်များ၌ အသုံးပြု၍ ဖန်တီးသူများနှင့် အဖွဲ့အစည်းများ
- Contributors: ကုဒ်များ၊ စာရွက်စာတမ်းများ၊ သတင်းအချက်အလက်များ သို့မဟုတ် အခြား အရင်းအမြစ်များကို ပံ့ပိုးပေးသော အသိုင်းအဝိုင်း အဖွဲ့ဝင်များ
- MCP GitHub Organization
- MCP Documentation
- MCP Specification
- GitHub Discussions
- MCP Examples & Servers Repository
- MCP Clients - MCP ပေါင်းစည်းမှုများကို ဆက်လက်ထောက်ပံ့သည့် client များစာရင်း
- Community MCP Servers - အသိုင်းအဝိုင်း ဖန်တီးသော MCP ဆာဗာများ၏ အလုပ်တိုးနေသည့် စာရင်း
- Awesome MCP Servers - MCP ဆာဗာများအကြောင်း ရွေးချယ်ထားသည့် စာရင်း
- PulseMCP - MCP အရင်းအမြစ်ရှာဖွေရေး အသိုင်းအဝိုင်း ဗဟိုဌာနနှင့် သတင်းလွှာ
- Discord Server - MCP ဖန်တီးသူများနှင့် ချိတ်ဆက်ရန်
- ဘာသာစကား အထူး SDK အကောင်အထည်
- ဘလော့ဂ်ပို့စ်များနှင့် သင်ခန်းစာများ
MCP စနစ်တွင် အမျိုးမျိုးသော ထောက်ပံ့မှုမျိုးစုံကို ကြိုဆိုသည် -
-
ကုဒ် ထောက်ပံ့မှုများ:
- အခြေခံ ပရိုတိုကော တိုးတက်မှုများ
- အမှားပြင်ဆင်ခြင်းများ
- ကိရိယာများ နှင့် ဆာဗာများ တည်ဆောက်ခြင်း
- မတူညီသော ဘာသာစကားထဲ Client/Server စာကြည့်တိုက်များ
-
စာရွက်စာတမ်းများ:
- ရှိပြီးသား စာရွက်စာတမ်းများ တိုးတက်ကောင်းမွန်စေရန်
- သင်ခန်းစာများနှင့် လမ်းညွှန်များ ဖန်တီးခြင်း
- စာရွက်စာတမ်းများ ဘာသာပြန်ခြင်း
- နမူနာများနှင့် သရုပ်ပြ အက်ပ်များ ဖန်တီးခြင်း
-
အသိုင်းအဝိုင်း ထောက်ပံ့မှု:
- ဖိုရမ်များနှင့် ဆွေးနွေးမှုများတွင် မေးခွန်းများဖြေဆိုခြင်း
- စမ်းသပ်ပြီး ပြဿနာများကို တင်ပြခြင်း
- အသိုင်းအဝိုင်း အခမ်းအနားများ စီစဉ်ခြင်း
- အသစ်လာသူများကို မန်တာလုပ်ခြင်း
Core MCP protocol သို့မဟုတ် တရားဝင် အကောင်အထည်ဖော်မှုများ ထောက်ပံ့ရန်အတွက် တရားဝင် ပါဝင်ဆောင်ရွက်မည့် လမ်းညွှန်များ အောက်ပါ အယူအဆများကို လိုက်နာပါ-
-
ရိုးရှင်းပြီး လွယ်ကူမှု: MCP ဖော်ပြချက်တွင် အကြောင်းအရာအသစ်များ ထပ်ထည့်ရာတွင် မြင့်မားသော အဆင့်တန်းရှိသည်။ ဖော်ပြချက်ထဲသို့ ထည့်သွင်းခြင်းသည် ဖယ်ရှားခြင်းထက် ပိုလွယ်ကူသည်။
-
တိကျသောနည်းလမ်း: ဖော်ပြချက်ပြောင်းလဲမှုများသည် ကိုတန်းတရှင်းလင်းသော အကောင်အထည်ဖော်မှု စိန်ခေါ်မှုများအပေါ် အခြေခံရမည်၊ ခန့်မှန်းသုံးသပ်ခြင်း မဟုတ်ပါ။
-
ဂဏန်းအဆင့်များ:
- သတ်မှတ်ပါ: ပြဿနာနယ်ပယ်ကို ရှာဖွေကြည့်ရှု၊ MCP အသုံးပြုသူများမှ တူညီသော ပြဿနာကို ရှိကြောင်း အတည်ပြုပါ
- နမူနာဖော်ဆောင်ပါ: ကိုယ်တိုင် နမူနာဖြေရှင်းချက် တည်ဆောက်ပြီး လက်တွေ့ အသုံးချနိုင်မှုကို ပြပါ
- ရေးသားပါ: နမူနာအပေါ် အခြေခံကာ ဖော်ပြချက် အဆိုပြုချက်ကို ရေးသားပါ
# Repository ကို fork လုပ်ပါ
git clone https://github.com/YOUR-USERNAME/modelcontextprotocol.git
cd modelcontextprotocol
# မူလလိုအပ်သော packages များထည့်သွင်းပါ
npm install
# Schema ပြောင်းလဲမှုများအတွက် schema.json ကို အတည်ပြုနှင့် ဖန်တီးပါ
npm run check:schema:ts
npm run generate:schema
# အတည်ပြုစာတမ်း ပြင်ဆင်မှုများအတွက်
npm run check:docs
npm run format
# နေရာမှာ documenation ကို ကြည့်ရှုရန် (Optional):
npm run serve:docs// typescript-sdk တွင် အမုန်းပါသော မူလကုဒ်
export function validateResource(resource: unknown): resource is MCPResource {
if (!resource || typeof resource !== 'object') {
return false;
}
// အမှား: ပစ္စည်း ရုပ်သိမ်းမှုပြဿနာ ရှိခြင်း
// လက်ရှိ အကောင်အထည်ဖော်မှု:
const hasName = 'name' in resource;
const hasSchema = 'schema' in resource;
return hasName && hasSchema;
}
// လှူဒါန်းမှုတစ်ခုတွင် ပြုပြင်ပြီးသော အကောင်အထည်ဖော်မှု
export function validateResource(resource: unknown): resource is MCPResource {
if (!resource || typeof resource !== 'object') {
return false;
}
// ပိုမို ကောင်းမွန်လာသော ကန့်သတ်ချက် စစ်ဆေးမှု
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;
}# နမူနာအဖြစ် အစီအစဉ်တစ်ခု - MCP စံပြစာကြည့်တိုက်အတွက် CSV ဒေတာကို ကိုင်တွယ်ဖို့ ကိရိယာ
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:
# ပါရမီတာများကိုထုတ်ယူပါ
operation = request.parameters.get("operation")
output_format = request.parameters.get("outputFormat", "json")
# တိုက်ရိုက်ဒေတာ သို့မဟုတ် URL မှ CSV ဒေတာကိုယူပါ
df = await self._get_dataframe(request)
# တောင်းဆိုထားသော လုပ်ဆောင်ချက်အရ ကြိန်းလိုက်လုပ်ဆောင်ပါ
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"""
# အကောင်အထည်ဖော်မှုတွင် မတူညီသော ပြောင်းလဲမှုများပါဝင်ပါမည်
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 ပရောဂျက်များတွင် ထောက်ပံ့မှု ရှိအောင်အောင်လုပ်ရန် -
- သေးငယ်စွာ စတင်ပါ: စာရွက်စာတမ်းများ၊ အမှားပြင်ဆင်မှုများ သို့မဟုတ် သေးငယ်သည့် တိုးတက်မှုများနှင့် စတင်ပါ
- စတိုင်လ်လမ်းညွှန် လိုက်နာပါ: ပရောဂျက်၏ ကုဒ်စနစ် နှင့် သဘောတရားများကို လိုက်နာပါ
- စမ်းသပ်မှုများ ရေးပါ: သင်၏ကုဒ်ထောက်ပံ့မှုများအတွက် ယူနစ်စမ်းသပ်မှုများ ထည့်သွင်းပါ
- အလုပ်များကို စာရွက်စာတမ်း ဖြင့် ဖေါ်ပြပါ: အသစ်မိတ်ဆက်ခြင်း သို့မဟုတ် ပြောင်းလဲမှုများအတွက် ရှင်းလင်းသော စာရွက်စာတမ်းများ ထည့်သွင်းပါ
- အဓိကထား၍ PR ပို့ပါ: ပွဲကူးတင်သွင်းချက်များကို တစ်ခုသော ပြဿနာ သို့မဟုတ် လုပ်ဆောင်ချက်အပေါ် မှီပြီးသာ ကြိုးစားပါ
- တုံ့ပြန်ချက်များနှင့် ပူးပေါင်းပါ: သင်၏ ထောက်ပံ့မှုများအပေါ် တုံ့ပြန်ချက်များကို တုံ့ပြန်၍ ပူးပေါင်းဆောင်ရွက်ပါ
# ကိုဒ်ဘဏ္ဍာကို ကလုန်းလုပ်ပါ
git clone https://github.com/modelcontextprotocol/typescript-sdk.git
cd typescript-sdk
# မိမိ၏ အတွေ့အကြုံအတွက် အသစ်သော ဘရင့်ချ်တစ်ခု ဖန်တီးပါ
git checkout -b feature/my-contribution
# မိမိပြင်ဆင်ချက်များကို ပြုလုပ်ပါ
# ...
# မိမိပြင်ဆင်ထားသောအရာများသည် ရှိပြီးသားလုပ်ဆောင်ချက်များကို ထိခိုက်စေခြင်း မရှိကြောင်း စမ်းသပ်မှုများပြုလုပ်ပါ
npm test
# ဖော်ပြချက်ပါသော သတင်းအချက်အလက်ဖြင့် မိမိပြင်ဆင်ချက်များကို ထည့်သွင်းပါ
git commit -am "Fix validation in resource handler"
# မိမိ၏ ဘရင့်ချ်ကို မိမိဖြန့်ဟမ်းထားသည့် ကော်ပီနှင့် တင်ပို့ပါ
git push origin feature/my-contribution
# မိမိဘရင့်ချ်မှ အဓိကကိုဒ်ဘဏ္ဍာသို့ ပြန်ပေးပို့ရန် တောင်းဆိုမှု တစ်ခုဖန်တီးပါ
# ပြီးလျှင် တုံ့ပြန်ချက်များနှင့် အခြေအနေအရ မိမိ PR ကို ပြန်လည်ဆန်းစစ်ပါMCP စနစ်တွင် အဓိက ထောက်ပံ့မှု အနက် တစ်ခုမှာ ကိုယ်ပိုင် MCP ဆာဗာများ ဖန်တီး၍ မျှဝေရန်ဖြစ်သည်။ အသိုင်းအဝိုင်းသည် ဝန်ဆောင်မှုများနှင့် အသုံးပြုမှု ကိစ္စဦးများအတွက် ရာပြည့်နှင့်ချိုး ဆာဗာများ ဖန်တီးပြီးရှိပါသည်။
MCP ဆာဗာ ဖန်တီးမှုကို လွယ်ကူစေရန် အောက်ပါ ဖရိမ်ဝခ်များရှိသည်-
-
တရားဝင် SDK များ (MCP Specification 2025-11-25 နှင့် ကိုက်ညီသည်):
-
အသိုင်းအဝိုင်း ဖရိမ်ဝခ်များ:
- MCP-Framework - TypeScript ဖြင့် MCP ဆာဗာများကို အလှအပနှင့် အမြန်ဆုံး ဖြင့် တည်ဆောက်ပါ
- MCP Declarative Java SDK - Java ဖြင့် annotation ပေါ်မူတည်၍ MCP ဆာဗာများ ဖန္တီးခြင်း
- Quarkus MCP Server SDK - MCP ဆာဗာများအတွက် Java framework
- Next.js MCP Server Template - MCP ဆာဗာများအတွက် စတင်ရန် Next.js project
// 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// မျှဝေနိုင်သော MCP ကိရိယာ ပက်ကေ့ချ်အတွက် pom.xml ဖိုင် စိတ်ကြိုက်ပြင်ဆင်ခြင်း
<!--
<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<>();
// ဇယားသတ်မှတ်ချက်...
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;
// မိုးလေဝသ API ခေါ်သုံးခြင်း
Map<String, Object> forecast = getForecast(location, days);
// ပြန်လည်ဖြေကြားချက် တည်ဆောက်ခြင်း
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) {
// အကောင်အထည်ဖော်မှုမှာ မိုးလေဝသ API ခေါ်သုံးမည်
// ရိုးရှင်းထားသော ဥပမာ
Map<String, Object> result = new HashMap<>();
// မိုးလေဝသ ခန့်မှန်းချက် ဒေတာ ထည့်သွင်းခြင်း...
return result;
}
}
// Maven ကို အသုံးပြုပြီး ဘီလ်ထုတ်နှင့် ထုတ်ဝေခြင်း
// mvn clean package
// mvn deploy# PyPI ပက်ကေ့ချ်အတွက် ဖိုင်စနစ် ဖွဲ့စည်းမှု:
# mcp_nlp_tools/
# ├── LICENSE
# ├── README.md
# ├── setup.py
# ├── mcp_nlp_tools/
# │ ├── __init__.py
# │ ├── sentiment_tool.py
# │ └── translation_tool.py
# 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",
)
"""
# NLP ကိရိယာ အကောင်အထည်ဖော်ခြင်း ဥပမာ (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"):
# စိတ်နေအခြေအနေခန့်မှန်းမှု မော်ဒယ်ကို ဖွင့်ယူခြင်း
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:
# ပရမစီတာများကို ထုတ်ယူခြင်း
text = request.parameters.get("text")
include_score = request.parameters.get("includeScore", True)
# စိတ်နေစိတ်ထားကို စိစစ်ခြင်း
sentiment_result = self.sentiment_analyzer(text)[0]
# ရလဒ်ကို ပုံသဏ္ဍာန်ဖေါ်ခြင်း
result = {
"sentiment": sentiment_result["label"],
"text": text
}
if include_score:
result["score"] = sentiment_result["score"]
# ရလဒ်ကို ပြန်အပ်လွှင့်ခြင်း
return ToolResponse(result=result)
except Exception as e:
raise ToolExecutionException(f"Sentiment analysis failed: {str(e)}")
# ထုတ်ဝေလိုပါက:
# python setup.py sdist bdist_wheel
# python -m twine upload dist/*MCP ကိရိယာများကို အသိုင်းအဝိုင်းနှင့် မျှဝေနေစဉ် -
-
လုံးဝ စာရွက်စာတမ်း ရှိရေး:
- ရည်ရွယ်ချက်၊ သုံးစွဲမှုနည်းများနှင့် နမူနာများ ဖေါ်ပြရန်
- ပါရာမီတာများနှင့် ပြန်လည်ထုတ်ပေးမှုများ ရှင်းလင်းရေးသားမှု
- အပြင်အဆင် များရှိပါက ပြောပြရန်
-
အမှားကိုင်တွယ်မှု:
- ခိုင်မာတောက်ပသော အမှားကိုင်တွယ်မှု ဆောင်ရွက်ရန်
- အသုံးဝင်သော အမှားစာသားများ ပေးရန်
- ထူးခြားအဖြေများ ဖြစ်စေနိုင်ပါက စိတ်ချမ်းသာစွာ ကိုင်တွယ်ရန်
-
စွမ်းဆောင်ရည် စဉ်းစားချက်များ:
- အမြန်နှုန်းနှင့် အရင်းအမြစ်သုံးစွဲမှုကို တပြိုင်နက်ကောင်းစွာ မြှင့်တင်ရန်
- အချိန်မီ Caching ကို ထည့်သွင်းရန်
- အရွယ်အစားတိုးချဲ့နိုင်မှုကို စဉ်းစားရန်
-
လုံခြုံရေး:
- လုံခြုံသည့် API key များနှင့် 身份验证 အသုံးပြုရန်
- ရိုက်ထည့်ချက်များကို အတိအကျ စစ်ဆေးမှန်ကန်စေရန်
- ပြင်ပ API ခေါ်ဆိုမှုများအတွက် အရေအတွက်ကန့်သတ်မှု ထည့်သွင်းရန်
-
စမ်းသပ်မှု:
- ပြည့်စုံသော စမ်းသပ်မှု များထည့်သွင်းရန်
- မတူညီသောရိုက်ထည့်မှု များနှင့် ထူးခြားသည့် အခြေအနေများတွင် စမ်းသပ်ရန်
- စမ်းသပ်မှုများ လုပ်ဆောင်ပုံ အကြောင်းဖော်ပြရန်
ထိရောက်သော ပူးပေါင်းဆောင်ရွက်မှုသည် MCP စနစ် တိုးတက်ဖွံ့ဖြိုးရန် အဓိက ဖြစ်သည်။
- GitHub Issues နှင့် Discussions
- Microsoft Tech Community
- Discord နှင့် Slack ချန်နယ်များ
- Stack Overflow (အမှတ်တံဆိပ်:
model-context-protocolသို့မဟုတ်mcp)
MCP ထောက်ပံ့မှုများကို ပြန်လည်သုံးသပ်စဉ် -
- ရှင်းလင်းမှု: ကုဒ်သည် ရှင်းလင်းပြီး ကျယ်ပြန့်စွာစာရွက်စာတမ်းများပါသလား?
- မှန်ကန်မှု: မျှော်လင့်ထားသလို လုပ်ဆောင်သလား?
- တပြိုင်နက်ဖြစ်မှု: ပရောဂျက် စည်းကမ်းများနှင့် လိုက်နာမှုရှိပါသလား?
- ပုံသေအပြည့်စုံမှု: စမ်းသပ်မှုနှင့် စာရွက်စာတမ်းများ ပါ၀င်ပါသလား?
- လုံခြုံရေး: လုံခြုံရေး ပြဿနာ မရှိရပါဘူးလား?
MCP အတွက် ဖွံ့ဖြိုးဆဲအခါ -
- ပရိုတိုကော ဗားရှင်း: သင့် ကိရိယာထောက်ပံ့သည့် MCP protocol ဗားရှင်းနှင့် ကိုက်ညီရန်
- Client ကိုက်ညီမှု: နောက်ပြန်ကိုက်ညီမှုကို စဉ်းစားရန်
- Server ကိုက်ညီမှု: ဆာဗာ အကောင်အထည်ဖော်မှုလမ်းညွှန်ချက်များ လိုက်နာရန်
- ဖျက်တောက်မည့် ပြောင်းလဲမှုများ: ဖျက်ထုတ်မည့်ပြောင်းလဲမှုများကို ကောင်းကောင်း ရှင်းလင်းရေးသားရန်
အသိုင်းအဝိုင်းထောက်ပံ့မှု အရေးကြီးသော ပရောဂျက်တစ်ခုမှာ MCP ကိရိယာများအတွက် ပြည်သူ့မှတ်တမ်းတင် စနစ် တည်ဆောက်ခြင်းဖြစ်နိုင်သည်။
# အသိုင်းအဝိုင်းကိရိယာ မှတ်တမ်း API အတွက် နမူနာစီမံကိန်း
from fastapi import FastAPI, HTTPException, Depends
from pydantic import BaseModel, Field, HttpUrl
from typing import List, Optional
import datetime
import uuid
# ကိရိယာမှတ်တမ်းအတွက် အမူအရာများ
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 အက်ပလီကေးရှင်း
app = FastAPI(title="MCP Tool Registry")
# ဤနမူနာအတွက် မှတ်ဉာဏ်သိုလှောင်မှုဒေတာဘေ့စ်
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 tools များ ဖန်တီးပြီး မျှဝေရန် သည် စနစ်တိုးတက်မှုအတွက် အဖိုးတန်သော နည်းလမ်းတစ်ခုဖြစ်သည်
- MCP တိုးတက်မှုနှင့် တိုးချဲ့မှုအတွက် အသိုင်းအဝိုင်း ပူးပေါင်းဆောင်ရွက်မှု အရေးကြီးသည်
- သင့်ကျွမ်းကျင်မှုနှင့် စိတ်ဝင်စားမှုအရ MCP စနစ်တွင် ထောက်ပံ့မှု ပြုလုပ်နိုင်သည့် နယ်ပယ်တစ်ခုကို ရှာဖွေပါ
- MCP repository ကို fork ပြုလုပ်ပြီး တည်နေရာဖွံ့ဖြိုးရေး ပတ်ဝန်းကျင်ကို စနစ်တကျ ပြင်ဆင်ပါ
- အသိုင်းအဝိုင်းအတွက် အကျိုးရှိမည့် သေးငယ်သော တိုးတက်မှု၊ အမှားပြင်ဆင်ခြင်း သို့မဟုတ် ကိရိယာ တစ်ခု ဖန်တီးပါ
- ထောက်ပံ့မှုကို လိုအပ်သည့် စမ်းသပ်မှုများနှင့် စာရွက်စာတမ်းများအပြည့်နှင့် မှတ်တမ်းတင်ပါ
- သင့် PR ကို သက်ဆိုင်ရာ repository ထဲသို့ တင်ပါ
နောက်တစ်ပုဒ်: Lessons from Early Adoption
ကျူးလွန်ချက်: ဤစာရွက်စာတမ်းကို AI ဘာသာပြန် ဝန်ဆောင်မှုဖြစ်သည့် Co-op Translator ဖြင့် ဘာသာပြန်ထားပါသည်။ တိကျမှုအတွက် ကြိုးစားထားသော်လည်း အလိုအလျောက် ဘာသာပြန်မှုမှာ အမှားများ သို့မဟုတ် မမှန်ကန်မှုများ ပါဝင်နိုင်ကြောင်း သတိပြုပါရန် လိုအပ်ပါသည်။ မူရင်းစာရွက်စာတမ်းကို မူလဘာသာဖြင့်သာ အတည်ပြုရမည့်အရင်းအမြစ်အဖြစ် သတ်မှတ်ရန် လိုအပ်ပါသည်။ အရေးကြီးသော အချက်အလက်များအတွက် လူ့ဘာသာပြန်တစ်ဦး၏ အကျွမ်းတဝင် ဘာသာပြန်မှုကို အကြံပြုပါသည်။ ဒီဘာသာပြန်မှုကို အသုံးပြုခြင်းကြောင့် ဖြစ်ပေါ်နိုင်သည့် မလွဲမှားသော်လည်း ရှင်းလင်းချို့ယွင်းမှုများအတွက် ကျွန်တော်တို့ တာဝန်မရှိပါ။
