3 ms·
Show HN: PolyMCP – Expose Python and TypeScript Functions as MCP Tools
I built PolyMCP, a framework that lets you transform any Python or TypeScript function into an MCP (Model Context Protocol) tool ready to be used by AI agents — no rewriting, no complex integrations.
Examples
Python function:
from polymcp.polymcp_toolkit import expose_tools_http
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
app = expose_tools_http([add], title="Math Tools")
Run with:
uvicorn server_mcp:app --reload
AI agents can now call add(3, 4) directly.
TypeScript function:
import { z } from 'zod';
import { tool, exposeToolsHttp } from 'polymcp';
const uppercaseTool = tool({
name: 'uppercase',
description: 'Convert text to uppercase',
inputSchema: z.object({ text: z.string() }),
function: async ({ text }) => text.toUpperCase(),
});
const app = exposeToolsHttp([uppercaseTool], { title: "Text Tools" });
app.listen(3000);
Agents can call uppercase("hello") and get "HELLO" instantly.
Business workflow function (Python example):
import pandas as pd
from polymcp.polymcp_toolkit import expose_tools_http
def calculate_commissions(sales_data: list[dict]):
df = pd.DataFrame(sales_data)
df["commission"] = df["sales_amount"] * 0.05
return df.to_dict(orient="records")
app = expose_tools_http([calculate_commissions], title="Business Tools")
Now AI agents can generate reports automatically.
Why it matters
• Reuse existing code immediately: legacy scripts, internal libraries, APIs.
• Automate workflows: AI can orchestrate multiple tools reliably.
• Cross-language: expose Python and TypeScript functions on the same MCP server.
• Plug-and-play: no custom wrappers or middleware needed.
• Built-in reliability: input/output validation and error handling included.
PolyMCP makes any Python or TypeScript function immediately usable by AI agents, standardizing integration across enterprise software.
Repo: https://github.com/poly-mcp/Polymcp https://github.com/poly-mcp/Polymcp