Skip to main content

Open Protocol for AI friendly

Project description

OpenProtocal

A flexible protocol adaptation utility that supports multiple LLM-friendly protocols and deployment frameworks, with initial support for MCP and FastAPI.

Installation

pip install openprotocal

Quick Start

from fastapi import FastAPI
from protocals.mcp import mcp

app = FastAPI()

@app.get("/hello")
@mcp(hello)
async def hello(request, name: str = "World"):
    return f"Hello, {name}!"

# MCP routes will be automatically registered to the FastAPI application

Features

  • JSON-RPC 2.0 specification compliant MCP implementation
  • Automatic route registration with FastAPI integration
  • Comprehensive exception handling
  • Full type hint support
  • Flexible protocol adaptation framework
  • Support for multiple deployment frameworks

Example

Check out demo.py for a complete example showing:

  • Path parameter handling
  • Request body validation with Pydantic models
  • Mixed parameter types support
  • Error handling

Requirements

  • Python >= 3.7
  • FastAPI >= 0.68.0
  • Pydantic >= 1.8.0

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openprotocol-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openprotocol-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file openprotocol-0.1.0.tar.gz.

File metadata

  • Download URL: openprotocol-0.1.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for openprotocol-0.1.0.tar.gz
Algorithm Hash digest
SHA256 836e3a84f41ef1bbe50b3868194dd79f0edd64272f0991b3c68be21544116c2a
MD5 85000a423172734a58c297143ce66406
BLAKE2b-256 20bffaf2a7dcb0802acc8da22b8d8ebfd51a13a77edc46f3c83bbb7b43a6300b

See more details on using hashes here.

File details

Details for the file openprotocol-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openprotocol-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for openprotocol-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20afdc26d4a56e2cd09c9258770f7d203ebef02bf14ae2ce375041d71f34484d
MD5 0cb5f88ad0d3792ef713e3e749cdbac4
BLAKE2b-256 711ded7d4c44724c32fd9ca231b44638b6e902e94978f0dfda11ee460f3f810e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page