Skip to content
apcore-mcp logo

apcore-mcp

License Python Version TypeScript Version Rust Version

Build once, invoke by Code or AI. Same modules, same pipeline — an AI caller gets no shortcut.

apcore-mcp turns any apcore-based project into an MCP Server and OpenAI tool provider — with zero code changes to your existing project.

┌──────────────────┐
│  django-apcore   │  ← your existing apcore project (unchanged)
│  nestjs-apcore   │
│  tiptap-apcore   │
│  ...             │
└────────┬─────────┘
         │  extensions directory
         ▼
┌──────────────────┐
│    apcore-mcp    │  ← just install & point to extensions dir
└───┬──────────┬───┘
    │          │
    ▼          ▼
  MCP       OpenAI
 Server      Tools

Installation

pip install apcore-mcp
Requires Python 3.11+, apcore == 0.34.0, and apcore-toolkit == 0.16.0. The optional [markdown] extra adds Markdown tool descriptions.

npm install apcore-mcp
Requires Node.js 20+, [email protected], and [email protected].

cargo add apcore-mcp
Requires Rust 1.86+, apcore = "=0.34.0", and apcore-toolkit = "=0.16.0".


Quick Start

1. Serve your modules via MCP

from apcore_mcp import APCoreMCP

mcp = APCoreMCP("./extensions")

# Launch as MCP Server over stdio
mcp.serve()

# Or with HTTP + Explorer UI
mcp.serve(transport="streamable-http", port=8000, explorer=True)
import { serve } from "apcore-mcp";

// Launch MCP server over stdio
await serve("./extensions");

// Launch over Streamable HTTP with Explorer UI
await serve("./extensions", {
  transport: "streamable-http",
  port: 8000,
  explorer: true,
});
use apcore::{APCore, ModulePack};
use apcore_mcp::APCoreMCP;

fn serve_pack(core: &APCore, pack: &ModulePack) -> Result<(), Box<dyn std::error::Error>> {
    pack.register(core)?;
    APCoreMCP::builder().backend(core.executor_arc()).build()?.serve()?;
    Ok(())
}

The ModulePack API requires the Core macros feature. The Rust CLI serves OpenAPI backends through --from-openapi and rejects --extensions-dir.

# stdio (default)
apcore-mcp --extensions-dir ./extensions

# Streamable HTTP with Explorer UI
apcore-mcp --extensions-dir ./extensions --transport streamable-http --port 8000 --explorer

The commands above use the Python or TypeScript CLI. With the Rust CLI, use apcore-mcp --from-openapi ./openapi.yaml.

2. Export as OpenAI Tools

from apcore_mcp import APCoreMCP

mcp = APCoreMCP("./extensions")
tools = mcp.to_openai_tools()
import { APCoreMCP } from "apcore-mcp";

const mcp = new APCoreMCP("./extensions");
const tools = mcp.toOpenaiTools();
use apcore_mcp::APCoreMCP;

let mcp = APCoreMCP::builder()
    .backend(executor)
    .build()?;
//                          embed_annotations, strict
let tools = mcp.to_openai_tools(false,             true)?;

Python and TypeScript default to strict OpenAI schemas. Rust's positional API requires an explicit strict argument. Use strict=False in Python or { strict: false } in TypeScript to request permissive schemas.


Key Features

  • 🚀 Zero Intrusion: Your apcore project needs no code changes, no imports, and no extra dependencies.
  • 🔍 Auto-discovery: Point to an extensions directory, and everything is automatically discovered and exposed (Python and TypeScript; the Rust bridge needs a Registry you build in code — see the Quick Start note).
  • 🌐 Triple Transport: Supports stdio (for local LLMs), Streamable HTTP, and SSE.
  • 🛠️ Tool Explorer: Browser-based UI to browse schemas and test tools interactively (like Swagger UI for MCP).
  • 🛡️ Security: Built-in JWT authentication, PEM key support, and runtime approval elicitation.
  • 🤖 AI Optimized: Enriched metadata (x-when-to-use), error sanitization with AI guidance, and strict mode for OpenAI.
  • 🔄 Dynamic: Reflects module registrations/unregistrations at runtime without restarting.
  • 📄 OpenAPI Backend: Point the bridge at an openapi.json and every operation becomes an MCP tool, proxied over HTTP — no apcore project required (0.20+; the first backend source with full Rust parity).

Architecture

apcore-mcp acts as a protocol-specific adapter on top of the apcore Registry, mapping its metadata to MCP and OpenAI standards:

apcore Concept MCP Mapping OpenAI Mapping
module_id Tool name, verbatim — dots and all (image.resize); overridable via display.mcp.alias name (dash-normalized: image-resize)
description Tool description description
input_schema inputSchema parameters
annotations ToolAnnotations hints Description suffixes (optional)
metadata _meta fields —

MCP input contract

MCP input schemas preserve the module runtime's optionality, nullable values, defaults, references and free-form object behavior across Python, TypeScript and Rust. Arguments pass through unchanged. OpenAI strict schema projection remains specific to OpenAI tool exports. See the factory contract.

Features & Specifications

The project is architected as a set of modular features, each with its own specification to ensure consistency across languages:


Documentation


Implementations

Language Repository Package Status
Python apcore-mcp-python pip install apcore-mcp ✅ Available
TypeScript apcore-mcp-typescript npm install apcore-mcp ✅ Available
Rust apcore-mcp-rust cargo add apcore-mcp ✅ Available
Go apcore-mcp-go — Planned

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.