Sponsored by Deepsite.site

mcp-server-with-semantic-kernel

Created By
cnrishiraj8 months ago
Building Semantic Kernel Agents with Model Context Protocol (MCP) Plugins in Python
Content

mcp-server-with-semantic-kernel

Building Semantic Kernel Agents with Model Context Protocol (MCP) Plugins in Python

Using MCP Servers with Semantic Kernel in Python

What is Semantic Kernel?

Semantic Kernel (SK) is an open-source toolkit created by Microsoft that helps developers build powerful AI agents and apps that can talk, think, and act.

Think of it like this:

Imagine you're building a robot assistant. This assistant can:

  1. Talk using ChatGPT or other AI models (like asking questions or answering)
  2. Do tasks like checking your calendar, sending emails, or summarizing documents
  3. Remember things it has done or seen before
  4. Learn and follow workflows you teach it

SK is the brain behind this assistant. It connects the language part (like ChatGPT) with the tools and memory part (your calendar, files, APIs, etc.).


Key Building Blocks of SK

ConceptBeginner Explanation
KernelThe central piece that connects everything. It talks to the AI model and runs your instructions.
Plugins / SkillsThese are like apps for your assistant. For example: a calendar plugin, or an email plugin.
Prompt TemplatesPrewritten instructions that tell the AI how to behave. You give it some variables, it fills in the rest. Like: "Summarize this: {{text}}."
MemoryIt lets your assistant "remember" past things—like past conversations, or data.
Planner / OrchestratorIf your assistant has to do 5 steps to finish something (e.g. plan a trip), this part figures out the steps.

Example in Simple Terms

Let's say you're building a "Meeting Assistant" using Semantic Kernel:

  • You give it a plugin called CalendarSkill that knows how to read and create calendar events
  • You write a prompt: "Schedule a 30-minute meeting with John sometime next week."
  • The Semantic Kernel takes your prompt, sends it to the AI (like ChatGPT), figures out the intent ("create event"), and then runs the plugin to do it

So SK = AI (understands language) + Tools (do actions) + Memory (remembers stuff)

Semantic Kernel (SK) vs Model Context Protocol (MCP)

FeatureSemantic Kernel (SK)Model Context Protocol (MCP)
What it isA toolkit/framework to build intelligent AI agentsA standard/protocol for exposing tools to LLMs
Who created itMicrosoftOpen standard (inspired by tools like OpenAI tool calling, Claude tool use)
Main JobLet you connect an AI model with memory, tools, and promptsLet AI agents talk to tools via a common format
Think of it asThe brain + logic + app store of an AI agentThe interface/plug for tools to work with any AI agent
Does it have memory?Yes, SK can store and recall things (e.g. vector memory)No, it doesn't handle memory itself
Tool usageYou define and load "skills" (functions/tools) in codeTools are exposed as MCP Servers, any agent can connect
Language focusPython / C# SDKsLanguage-agnostic (focuses on the format, not the implementation)
ComplexityHigher-level abstraction (like a full toolkit)Lower-level protocol (like a wire format or spec)

Communication Methods

1. Server-Sent Events (SSE)

TL;DR: SSE is a way for a server to send real-time updates to your app over the web.

Think of it like: You're at a coffee shop. You give the barista your order (a request), and instead of checking back constantly, you just sit and relax. When your drink is ready, they call your name.

How it works:

  • The client makes a one-time request
  • The server keeps that connection open
  • Whenever there's data, the server sends it as a stream
  • The client gets updates in real time

In MCP or AI apps: When an AI tool talks to a tool server (via MCP), the server may stream results gradually — like partial answers, tokens, or logs.

2. Standard Input/Output (stdio)

TL;DR: stdio is how your computer's command-line tools read input and write output.

How it works:

  • stdin: You type or send data into a program
  • stdout: The program prints the result
  • stderr: Errors go here (so they don't mix with normal output)

In MCP: MCP Servers can be run as command-line programs. The agent talks to them by:

  • Writing JSON input into stdin
  • Reading the tool's response from stdout

Communication Methods Comparison

FeatureSSEstdio
TypeWeb protocolLocal program communication
Used forStreaming real-time data from serversTalking to command-line tools or subprocesses
Agent useWhen MCP tool is running as a web serverWhen MCP tool is a local process
ConnectionClient keeps a live HTTP connection openInput/output pipes (like running a script)
ExampleLive chat, streaming tokens from LLMShell script reading a prompt and printing answer

In AI Tooling (like MCP):

  • If a tool is deployed on a web server → use SSE to stream responses
  • If a tool is a local binary/script → use stdio to send/receive data
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Amap Maps高德地图官方 MCP Server
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Serper MCP ServerA Serper MCP Server
Tavily Mcp
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
DeepChatYour AI Partner on Desktop
WindsurfThe new purpose-built IDE to harness magic
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.