Back to blog

Show HN

Show HN: PolyMCP – Expose Python/TS functions as MCP tools easily

I made PolyMCP so I could quickly turn normal functions (Python or TypeScript) into MCP tools without much extra work. Python example: from polymcp.polymcp_toolkit import expose_tools

def greet(name: str) -> str: """Say hello.""" return f"Hello, {name}!"

def add(a: int, b: int) -> int: """Add two numbers.""" return a + b

app = expose_tools([greet, add], title="My MCP Tools") Run with: uvicorn server:app --reload MCP endpoints appear at /mcp/list_tools and /mcp/invoke/. TypeScript example: import { z } from 'zod'; import { tool, exposeTools } 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 = exposeTools([uppercaseTool], { title: "Text Tools" }); app.listen(3000); Business example (Python): import pandas as pd from polymcp.polymcp_toolkit import expose_tools

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([calculate_commissions], title="Business Tools") What you get: • Reuse existing code with minimal changes • Compatible with MCP clients (Claude Desktop, agents, Ollama, etc.) • HTTP and stdio and Wasm support • Automatic validation • Basic production features (budgets, retries, redaction, logs) • Inspector: polymcp inspector for testing/monitoring Install: • Python: pip install polymcp • TypeScript: clone repo → cd polymcp-ts → npm install → npm run build Repo: https://github.com/poly-mcp/Polymcp

Curious what kind of function people would expose first if it was this simple. Feedback welcome.

Choose your language

Elige tu idioma

You can change this anytime from the language menu.

Puedes cambiarlo cuando quieras desde el menú de idioma.