Add a short description here
Project description
MCP Auto Register
This package automates the registration of functions and classes from a python package into a FastMCP instance.
Installation
To install the package, run the following command:
pip install mcp-auto-register
Usage
Register functions from a package:
from mcp_auto_register.register import register_functions_from_package
from mcp.server.fastmcp import FastMCP
# Initialize MCP instance
mcp_instance = FastMCP()
register_functions_from_package('scipy.linalg', mcp_instance=mcp_instance, func_filter=['eigh', 'inv'])
if __name__ == "__main__":
mcp_instance.run()
Register classes from a package:
import inspect
from mcp_auto_register.register import register_classes_from_package
from mcp.server.fastmcp import FastMCP
from nba_api.stats.endpoints._base import Endpoint
# Create MCP instance
mcp = FastMCP()
def nba_endpoint_wrapper(endpoint: Endpoint):
init_params = inspect.signature(endpoint.__init__).parameters
required_args = {
p: param.annotation if param.annotation != inspect.Parameter.empty else "Any"
for p, param in init_params.items()
if p != "self" and param.default == inspect.Parameter.empty
}
def wrapper(**kwargs):
return endpoint(**kwargs).get_dict()
wrapper.__signature__ = inspect.Signature(
parameters=[
inspect.Parameter(arg, inspect.Parameter.POSITIONAL_OR_KEYWORD)
for arg, _ in required_args.items()
]
)
return wrapper
register_classes_from_package("nba_api.stats.endpoints", nba_endpoint_wrapper, mcp)
if __name__ == "__main__":
mcp.run(transport="stdio")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mcp_auto_register-1.0.1.tar.gz
(35.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_auto_register-1.0.1.tar.gz.
File metadata
- Download URL: mcp_auto_register-1.0.1.tar.gz
- Upload date:
- Size: 35.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46e57be553dcc693451e9182f07a9bf9a4a4ea2c51c4d1083814a4f3927acb21
|
|
| MD5 |
419b335f93755eebee7854e79ce7e6c8
|
|
| BLAKE2b-256 |
31c2a51e8900ed6248701cc2213b8f81dc1406e0f852009257f94f62ba70514a
|
File details
Details for the file mcp_auto_register-1.0.1-py3-none-any.whl.
File metadata
- Download URL: mcp_auto_register-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83ad5e6273db35d58e0fba76bb089b2bffa8ac9bff4ae7967979fcbd3dada455
|
|
| MD5 |
f1a9980341ac6b137d89e23e4404c1a3
|
|
| BLAKE2b-256 |
373fd3b6d656836e2342dbf1b07ffbfd39866b72bb6c5145a04271f8e607bf80
|