mcp-adapter
- 对mcp sdk的二次封装
- 以python类继承的方式,非侵入式封装function到mcp tool的转化
- FastAPI支持,快速挂载在FastAPI服务中
Getting started
1. 继承McpServerAdapterBase,实现功能
from mcp_adapter.core.server_base import McpServerAdapterBase
class MockMcpServerSse(McpServerAdapterBase):
name = 'MockMcpServerSse'
description = 'MockMcpServerSse Service'
@staticmethod
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@staticmethod
def sub(a: int, b: int) -> int:
"""Sub two numbers"""
return a - b
@staticmethod
def multiply(a: int, b: int) -> int:
"""Multiply two numbers"""
return a * b
class MockMcpServerHttpStreamable(McpServerAdapterBase):
name = 'MockMcpServerHttpStreamable'
description = 'MockMcpServerHttpStreamable Service'
@staticmethod
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
@staticmethod
def sub(a: int, b: int) -> int:
"""Sub two numbers"""
return a - b
@staticmethod
def multiply(a: int, b: int) -> int:
"""Multiply two numbers"""
return a * b
2. 在FastAPI项目中加载mcp server
请参考: 脚手架项目
Metadata
Release files for mcp-adapter 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcp_adapter-0.0.6.tar.gz | 4.0 kB | Without provenance | Details for mcp_adapter-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcp_adapter-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for mcp_adapter-0.0.6-py3-none-any.whl |
Total release size: 8.6 kB
Release files / mcp_adapter-0.0.6.tar.gz
| Download URL | mcp_adapter-0.0.6.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7271113380cb9003e5cf8ab18dd92127ffeb5c63b2dc991f64b9b33ed7788432
|
|
BLAKE2b-256 checksum How to use checksums |
c9de1ea0dea6a66c2de59cc2c419c875c643a384f8500481e4636ae49e0715b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / mcp_adapter-0.0.6-py3-none-any.whl
| Download URL | mcp_adapter-0.0.6-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a4e20d0c661ac6292b04ec32be9ec8a984160a4c01196ce21b89b6db29f65e4
|
|
BLAKE2b-256 checksum How to use checksums |
489dde92ebfdd7d8366830d6fdd32972e622ca53c809aba16891a84d9c294114
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Security for mcp-adapter 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.