Back to list
pablosalvador10

mcp-server

by pablosalvador10

The 101s: Build AI agents in Azure AI Foundry.

2🍴 3📅 Jan 22, 2026

SKILL.md


name: mcp-server description: Helps build MCP (Model Context Protocol) servers that expose tools to AI agents like GitHub Copilot. Use this skill when creating MCP tools, configuring MCP clients, debugging MCP connections, or integrating with VS Code Copilot Agent Mode.

MCP Server Development Skill

Overview

The Model Context Protocol (MCP) is an open standard for connecting AI agents to external tools. This skill helps you build MCP servers using Azure Functions.

Architecture

┌─────────────────┐     ┌──────────────────────┐     ┌─────────────────┐
│  AI Agent       │     │  MCP Server          │     │  Your Logic     │
│  (Copilot)      │────▶│  (Azure Functions)   │────▶│  (Python)       │
│                 │◀────│  SSE Transport       │◀────│                 │
└─────────────────┘     └──────────────────────┘     └─────────────────┘

Creating an MCP Tool

Tool Definition Pattern

import json
import azure.functions as func

app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)

# Define tool properties (JSON schema for parameters)
tool_properties = json.dumps([
    {
        "propertyName": "query",
        "propertyType": "string",
        "description": "The search query to execute"
    },
    {
        "propertyName": "limit",
        "propertyType": "number",
        "description": "Maximum number of results (default: 10)"
    }
])

@app.generic_trigger(
    arg_name="context",
    type="mcpToolTrigger",
    toolName="search_data",
    description="Search the database for records matching the query. Use when the user asks to find or search for specific data.",
    toolProperties=tool_properties
)
def search_data(context) -> str:
    """Search tool implementation."""
    content = json.loads(context)
    query = content["arguments"].get("query", "")
    limit = content["arguments"].get("limit", 10)
    
    # Your search logic here
    results = perform_search(query, limit)
    
    return json.dumps({
        "results": results,
        "count": len(results),
        "query": query
    })

Tool Property Types

TypeDescriptionExample
stringText input"hello world"
numberInteger or float42, 3.14
booleanTrue/falsetrue, false
arrayJSON array (as string)"[1, 2, 3]"
objectJSON object (as string)'{"key": "value"}'

VS Code MCP Configuration

Local Development (.vscode/mcp.json)

{
    "servers": {
        "my-mcp-server": {
            "type": "http",
            "url": "http://localhost:7071/runtime/webhooks/mcp"
        }
    }
}

Production (with authentication)

{
    "servers": {
        "my-mcp-server-prod": {
            "type": "http",
            "url": "https://my-app.azurewebsites.net/runtime/webhooks/mcp",
            "headers": {
                "x-functions-key": "${MCP_FUNCTION_KEY}"
            }
        }
    }
}

Testing MCP Tools

Via VS Code Copilot

  1. Press F1MCP: List Servers
  2. Verify your server is connected
  3. Open Copilot Chat → Switch to Agent Mode
  4. Your tools appear in the tools panel

Test Prompts

ToolTest Prompt
hello_mcp"Say hello"
analyze_data"Analyze [1, 2, 3, 4, 5]"
search_data"Search for Python tutorials"

Writing Good Tool Descriptions

The description field is critical — it's how Copilot decides when to use your tool.

Good Descriptions ✅

description="Analyze a list of numbers and return statistics including count, sum, mean, min, and max. Use when the user asks for data analysis or statistics."

Poor Descriptions ❌

description="Analyzes data"  # Too vague

Common Patterns

Tool with No Parameters

@app.generic_trigger(
    arg_name="context",
    type="mcpToolTrigger",
    toolName="get_status",
    description="Get the current system status",
    toolProperties="[]"  # Empty array for no parameters
)
def get_status(context) -> str:
    return json.dumps({"status": "healthy"})

Tool with Optional Parameters

# Mark as optional in description
tool_properties = json.dumps([{
    "propertyName": "format",
    "propertyType": "string",
    "description": "Output format: 'json' or 'text' (optional, default: json)"
}])

Error Handling

def my_tool(context) -> str:
    try:
        content = json.loads(context)
        # ... tool logic ...
        return json.dumps({"status": "success", "data": result})
    except json.JSONDecodeError:
        return json.dumps({"error": "Invalid JSON input"})
    except KeyError as e:
        return json.dumps({"error": f"Missing required parameter: {e}"})
    except Exception as e:
        logging.error(f"Tool error: {e}")
        return json.dumps({"error": str(e)})

Debugging Tips

  1. Check func start output — Tools should be listed
  2. View logslogging.info() appears in terminal
  3. Test JSON parsing — Context comes as JSON string
  4. Verify MCP configF1MCP: List Servers
  5. Restart Copilot — After config changes

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon