No description
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .gitea/workflows | ||
| __pycache__ | ||
| example | ||
| src | ||
| tests | ||
| wiki | ||
| .gitignore | ||
| pyproject.toml | ||
| README.md | ||
| requirements.txt | ||
PCP
Program Context Protocol
Like MCP, but for general programming. PCP lets you run functions over the internet as if you imported them.
Instead of writing a new API wrapper for every service, expose a Python function once and call it from anywhere. One protocol, no boilerplate.
Quick start
Server
from pcp import server
@server.expose()
def greet(name: str) -> str:
return f"hello, {name}"
if __name__ == "__main__":
server.start(host="0.0.0.0", port=8000, auth="password")
Client
from pcp import client
remote = client("localhost", port=8000, auth="password")
print(remote.greet("carson")) # hello, carson
Install
pip install -r requirements.txt
How it works
- Mark any function with
@server.expose()(optionally with a custom name) and it becomes a remote endpoint - The client connects with the shared auth secret and calls
remote.<function>(*args, **kwargs)like a local import - Built on FastAPI + uvicorn, JSON in and JSON out
GET /healthplusPOST /listandPOST /callunder the hood
Security
Every call needs the shared auth secret. PCP itself is not TLS, so run behind HTTPS (or a tunnel) if you expose it outside your own network.
Examples
See example/ for working server/client pairs, including custom exposed names and error handling.