WI

Wikifunctions MCP Server for AI Function Execution

Enable AI models to discover and execute functions from the Wikifunctions library using the MCP server for seamless function execution.

Quick Install
npx -y @Fredibau/wikifunctions-mcp-fredibau

Overview

This MCP (Model Context Protocol) server exposes the Wikifunctions function library to AI models and toolchains, enabling automated discovery and execution of functions. By presenting a machine-readable manifest and execution endpoints, the server lets language models query available functions, get signature/metadata, and execute functions hosted in the Wikifunctions ecosystem with minimal glue code.

For developers building LLM-based agents, assistants, or pipelines, the server simplifies the integration point between a model and a large public function catalog. Instead of hard-coding function signatures or building ad-hoc adapters, models can discover capabilities at runtime and invoke functions via a consistent MCP-compatible interface.

Features

  • MCP-compatible manifest for model-driven discovery of available functions and tools
  • Runtime execution proxy to call Wikifunctions functions and return structured results
  • Configurable endpoints and backend Wikifunctions API URL
  • Lightweight HTTP server suitable for local development or containerized deployment
  • Example client requests and clear response shapes to integrate with LLM tool-usage flows
  • Basic health and metadata endpoints for orchestration/monitoring

Installation / Configuration

Clone the repository and install dependencies (Node.js example):

git clone https://github.com/Fredibau/wikifunctions-mcp-fredibau.git
cd wikifunctions-mcp-fredibau
npm install

Run locally using environment variables to configure runtime behavior:

# Example environment variables
export PORT=8080
export WIKIFUNCTIONS_API_URL=https://wikifunctions.toolforge.org
export MCP_BASE_PATH=/mcp

# Start the server
npm start

Docker example:

# build
docker build -t wikifunctions-mcp .

# run
docker run -e PORT=8080 -e WIKIFUNCTIONS_API_URL=https://wikifunctions.toolforge.org -p 8080:8080 wikifunctions-mcp

Common environment variables

VariablePurposeDefault
PORTHTTP port to listen on8080
WIKIFUNCTIONS_API_URLBase URL for Wikifunctions backend(required)
MCP_BASE_PATHBase path for MCP endpoints (e.g. /mcp)/mcp

The server configuration is intentionally minimal; other settings (timeouts, logging) can be extended in the code or via container orchestration.

Available Resources

The MCP server exposes a small set of HTTP endpoints that models and agents typically use:

  • GET {MCP_BASE_PATH}/manifest
    • Returns a machine-readable manifest describing available functions/tools, signatures, and metadata.
  • GET {MCP_BASE_PATH}/catalog
    • Optionally returns a searchable catalog of Wikifunctions entries exposed by the server.
  • POST {MCP_BASE_PATH}/execute
    • Accepts an execution request (target function id + input arguments) and returns the function result.
  • GET /health
    • Basic health check for orchestration and readiness probes.

Note: Endpoint paths can be adjusted via MCP_BASE_PATH in configuration. The exact payload shapes are JSON and designed to be simple to integrate into LLM tool invocation flows.

Example Requests

Discover manifest:

curl http://localhost:8080/mcp/manifest

Execute a function (example payload — adapt keys to the function signature exposed in the manifest):

curl -X POST http://localhost:8080/mcp/execute \
  -H "Content-Type: application/json" \
  -d '{
    "tool_id": "wikifunctions/function/ExampleFunction",
    "arguments": {
      "input": "Calculate 2+2"
    },
    "context": {
      "caller": "agent-123"
    }
  }'

Typical response shape:

{
  "tool_id": "wikifunctions/function/ExampleFunction",
  "status": "success",
  "result": {
    "value": 4,
    "type": "number"
  },
  "metadata": {
    "execution_time_ms": 120
  }
}

Use Cases

  • LLM tool invocation: Enable an LLM to browse function capabilities, select an appropriate Wikifunction, and execute it to get structured outputs instead of relying on text parsing.
  • Programmatic data enrichment: Pipelines that need canonical computations, lookups or reusable functions can call Wikifunctions via MCP to ensure consistent behaviour.
  • Assistants with action execution: Virtual assistants can call specific functions (e.g., unit conversion, date math, data transformation) to return deterministic results to users.
  • Chained function workflows: Build multi-step agents where outputs from one Wikifunction feed into another, orchestrated by model-driven decision logic.

Concrete example: An LLM identifies that a user request requires a canonical name transformation. The model queries the manifest for functions matching “normalize name”, selects the best candidate, calls POST /mcp/execute with the raw name, and returns the normalized value in the assistant response.

Tips, Troubleshooting & Security

  • Ensure WIKIFUNCTIONS_API_URL is reachable from the host/container where the MCP server runs.
  • Use health and readiness endpoints in Kubernetes to manage restarts and rolling updates.
  • Validate and sanitize inputs where possible; the server proxies function execution and should enforce size/time limits to avoid abuse.
  • Consider adding authentication (API keys or mTLS) in front of the MCP endpoints if exposing to third parties.
  • Monitor logs for execution errors and instrument latency metrics to identify slow functions.

Repository and issues: https://github.com/Fredibau/wikifunctions-mcp-fredibau — consult the README and source for the exact payload schemas and additional runtime knobs.