mokei
by TairuFramework
Overview
TypeScript toolkit for building and orchestrating AI applications using the Model Context Protocol (MCP), providing server/client implementations, multi-context hosting, session management, agent loops, and integrations with various LLM providers (OpenAI, Anthropic, Ollama), including monitoring and CLI tools.
Installation
npx @mokei/mcp-fetchEnvironment Variables
- OPENAI_API_KEY
- ANTHROPIC_API_KEY
Security Notes
The toolkit includes example MCP servers and documentation that demonstrate patterns with significant security risks if deployed or used with untrusted inputs: - **SQL Injection**: The `@mokei/mcp-sqlite` server directly executes SQL statements provided as tool arguments (`db.prepare(req.arguments.sql)`). If tool arguments originate from an untrusted source (e.g., a malicious LLM prompt), this is a critical SQL injection vulnerability. - **Server-Side Request Forgery (SSRF)**: The `@mokei/mcp-fetch` server fetches URLs provided as tool arguments (`await fetch(req.arguments.url)`). If tool arguments are untrusted, this can be exploited for SSRF. - **Remote Code Execution (RCE) via child process spawning**: `ContextHost.addLocalContext` and `Session.addContext` allow spawning arbitrary child processes (`command`, `args`). If these parameters can be influenced by untrusted input (e.g., from an LLM generating tool calls), it can lead to RCE on the host system. - **RCE via `Function()` constructor (documentation example)**: The documentation for `Session`'s local tools includes an example `calculate` tool that uses `Function(`"use strict"; return (${expression})"`)()` to evaluate a math expression. While not directly `eval()`, the `Function` constructor still allows arbitrary code execution if the `expression` input is untrusted, posing an RCE risk on the client-side when an LLM is given control over this tool's arguments.
Similar Servers
mcp-use
A comprehensive framework for building full-stack Model Context Protocol (MCP) applications, including AI agents, MCP servers with UI widgets, and integrated debugging tools in both Python and TypeScript.
boilerplate-mcp-server
Provides a production-ready foundation for developing custom Model Context Protocol (MCP) servers in TypeScript to connect AI assistants with external APIs and data sources, exemplified by an IP geolocation tool.
mcp
An MCP server providing a set of mathematical tools (calculator functions) for remote execution via the Model Context Protocol.
mcp-typescript-starter
A feature-complete Model Context Protocol (MCP) server template in TypeScript demonstrating all major MCP features for AI assistant interaction.