
maximerivest/mcp2py
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
maximerivest/mcp2pyは、https://github.com/maximerivest/mcp2py.からインポートされたMCPサーバー候補です。
概要
maximerivest/mcp2pyは、https://github.com/maximerivest/mcp2py.からインポートされたMCPサーバー候補です。
概要(AI 翻訳)
MCP(モデルコンテキストプロトコル)は、AIツールの新たな標準となっています。 リソース。この標準は通常のREST APIサーバーと互換性がありますが、 ツール、リソース、プロンプトを説明するための追加のメタデータを追加します 機械読み可能な方法です。これにより、 これらのMCPに完全かつ自動的にマッピングするPythonモジュールを作成しましょう サーバーです。この方法の最大の利点は、どのものでも使えることです MCPサーバーはネイティブのPythonライブラリのように扱い、ゼロ 設定。これはPythonソフトウェアの作成と同じくらい大きな問題になり得ます REST APIにマッピングされた開発キットは非常に一般的で、かなり一般的でした 手動のプロセスです。そして、REST APIをホストする組織も同様に扱います MCPインターフェースを提供し、自動的にPython SDKを生成できます 全く努力せずに!もし理解できなくても心配しないでください。 mcp2pyのパワーを活用することは、すべてのことを知らなくても可能です MCPの詳細です。知っておくべきことは、プログラム的にやりたい場合だけです ウェブサイトとやり取りする場合、APIを持っている可能性が高く、時折 さらに、そのAPI用のMCPインターフェースを持っている可能性が非常に高いです。 もしそうなら、ウェブプログラミングの全セットを学ぶ必要はありません
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
mcp2py: Turn any MCP server into a python module
MCP (Model Context Protocol) is an emerging standard for AI tools and resources. The standard is compatible with normal REST API servers, but adds extra metadata to describe tools, resources, and prompts in a machine-readable way. This provides us with a great opportunity to create Python modules that completely and automatically map to these MCP servers. The biggest advantage of this approach is that we can use any MCP server as if it were a native Python library, with zero configuration. This can be quite a big deal as creating Python software development kits that map to REST APIs is extremely common and was quite a manual process. Now, if the organization hosting the REST API also provides an MCP interface, we can automatically generate a Python SDK for it with zero effort! Don’t worry if this is not all clear to you. You can still leverage the power of mcp2py without knowing all the details of MCP. All you need to know is: if you want to programmatically interact with a website, it is likely that they have an API and as time goes on it is very likely that they have an MCP interface for that API. If they do, you don’t have to learn a whole set of web programming skills, you can just use mcp2py to load the MCP server and start calling functions right away as if it were a native Python library!
Another cool thing to note is that servers don’t have to be running remotely. You can (and have) a lot of servers running on your own personal computer right now. This is useful to have different programs, possibly in different programming languages, talking to each other. As apps that you install will more and more open up a small local server on your machine to let LLMs interact with them, you will also be able to leverage mcp2py to interact with these local servers. That could look like Slack opening a server that lets you query your messages. If so, you could then use mcp2py and have a Python module (a library in essence) that lets you query your Slack messages directly from Python. Super powerful!
Overview
Here is a very simple example of using mcp2py to interact with your local filesystem. That is not very useful as you could just use the built-in Python libraries to do that, but it serves as a very simple example to illustrate how mcp2py works. In this snippet of code we use load to both start the MCP server (which is a Node.js server in this case) and connect to it. Once connected we can call the list_directory tool as if it were a native Python function:
from mcp2py import load
fstools = load("npx -y @modelcontextprotocol/server-filesystem /home")
fstools.list_directory("/home")
[DIR] maxime
This is similar to using the os library in Python:
import os
os.listdir("/home")
['maxime']
The main difference is that instead of going directly from Python to the system, we send commands to a local Node (JavaScript) server and that
インストール
This server does not publish a one-line install command.
Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →