
python mcp example
一个使用 Python 编写的 MCP SDK 示例,展示如何运行和配置。
Repository Info
About This Server
一个使用 Python 编写的 MCP SDK 示例,展示如何运行和配置。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP Python SDK Example
試したところ
transportTypeはstdioにしてます。
- uv run mcp run server.pyを実行したまま
- cline_mcp_settings.jsonを設定
- その後task上で python-mcp-example-stdio を認識できるかとか聞くと使い方を教えてくれる。
- 実行例
-
add 1 2 と入れる -> 実行確認が出てくるから、Approveすると結果を返してくれる
-
自然言語でやりたいことを言うと自動的にadd toolを使ってくれる
では addツールを使って、 4つの数字を合計して 10, 20, 30, 40
-
cline_mcp_settings.jsonの例
commandのuvはフルパスがいいっぽいです。ここでは/opt/homebrew/bin/uvにしています。
{
"mcpServers": {
"python-mcp-example-stdio": {
"disabled": false,
"timeout": 60,
"command": "/opt/homebrew/bin/uv",
"args": [
"--directory",
"/path/to/server.py/",
"run",
"mcp",
"run",
"server.py"
],
"transportType": "stdio"
}
}
}
まだわかってない/やっていないこと
- SSEの使い方
- MCP Inspectorの使い方
- 外部のAPIを使う
参考
MCP Python SDK を使って、echoするだけのMCPサーバを作ってみた - メモ的な思考的な
Quick Start
Clone the repository
git clone https://github.com/hrsano645/python-mcp-exampleInstall dependencies
cd python-mcp-example
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.