AIMock

v1.27.0Developer Toolsstable

Mock everything your AI app talks to — LLM APIs, MCP, A2A, AG-UI, vector DBs, search. One package, one port, zero dependencies.

ai-testingaimockllmmcpmock-server
Share:
598
Stars
0
Downloads
0
Weekly
0/5

What is AIMock?

AIMock is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mock everything your ai app talks to — llm apis, mcp, a2a, ag-ui, vector dbs, search. one package, one port, zero dependencies.

Mock everything your AI app talks to — LLM APIs, MCP, A2A, AG-UI, vector DBs, search. One package, one port, zero dependencies.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Mock everything your AI app talks to — LLM APIs, MCP, A2A, A

Use Cases

Mock LLM APIs and vector DBs
One package for all AI service mocking
Zero dependencies testing
CopilotKit

Maintainer

LicenseMIT
Languagetypescript
Versionv1.27.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @copilotkit/aimock

Manual Installation

npx -y @copilotkit/aimock

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use AIMock

AIMock is a zero-dependency local mock server that intercepts and simulates every AI service your application calls, including OpenAI Chat and Responses APIs, Anthropic Claude, Google Gemini, vector databases (Pinecone, Qdrant, ChromaDB), MCP tools, and agent-to-agent protocols. It runs on a single port and ships as a single npm package, letting teams write deterministic AI integration tests without real API credentials or costs. Developers use it to speed up CI pipelines and reproduce edge-case LLM responses reliably.

Prerequisites

  • Node.js 18 or higher installed
  • npm, npx, or yarn available on your PATH
  • An MCP client (Claude Desktop, Claude Code, or Cursor) for MCP server mode
  • No real AI API keys required for local testing
1

Install the package

Install AIMock globally or use npx to run it without a permanent install. The package name on npm is @copilotkit/aimock.

npm install @copilotkit/aimock
# or run directly without installing:
npx -y @copilotkit/aimock
2

Start the mock server via CLI

Launch the server with an optional config file. The server listens on a local port and exposes OpenAI-compatible endpoints by default.

npx @copilotkit/aimock --config aimock.json
3

Point your SDK clients at the mock

Set the OPENAI_BASE_URL environment variable to the local mock server before constructing any SDK clients. The API key value can be any non-empty string when mocking.

export OPENAI_BASE_URL=http://localhost:4010/v1
export OPENAI_API_KEY=mock
4

Use AIMock programmatically in tests

Import LLMock (or MCPMock, VectorMock, etc.) in your test suite, define fixture responses, and start the server before your test runs.

import { LLMock } from "@copilotkit/aimock";

const mock = new LLMock({ port: 0 });
mock.onMessage("hello", { content: "Hi there!" });
await mock.start();

process.env.OPENAI_BASE_URL = `${mock.url}/v1`;
process.env.OPENAI_API_KEY = "mock";

// ... run your tests ...
await mock.stop();
5

(Optional) Record real responses for replay

Use record mode to proxy real provider calls and save them as fixtures for later deterministic replay.

npx -p @copilotkit/aimock llmock --record --provider-openai https://api.openai.com
6

Configure as an MCP server

To use AIMock as an MCP server so Claude or Cursor can interact with mock AI services, add it to your MCP client configuration.

{
  "mcpServers": {
    "aimock": {
      "command": "npx",
      "args": ["-y", "@copilotkit/aimock"]
    }
  }
}

AIMock Examples

Client configuration

Add AIMock as an MCP server in your Claude Desktop or Claude Code configuration file.

{
  "mcpServers": {
    "aimock": {
      "command": "npx",
      "args": ["-y", "@copilotkit/aimock"]
    }
  }
}

Prompts to try

Use these prompts when AIMock is running as your local AI service mock during development and testing.

- "Start a mock OpenAI chat session and return a fixed greeting response"
- "Mock a Pinecone vector search returning the top 3 hardcoded results"
- "Simulate a Claude Anthropic streaming response for my integration test"
- "Set up a mock MCP tool that returns a fixed JSON payload when called"

Troubleshooting AIMock

SDK clients still call the real API instead of the mock

Ensure OPENAI_BASE_URL is set BEFORE the SDK client object is constructed in your code. Environment variable changes after client instantiation are not picked up by most SDKs.

Fixture URLs pointing to local addresses are blocked

Set the environment variable AIMOCK_ALLOW_PRIVATE_URLS=1 before starting the server. This lifts the default restriction on local and private IP address ranges in fixture responses.

Record mode fails with authentication errors

Record mode proxies real provider calls, so you need a valid API key for the target provider during recording. Set the real key (e.g. OPENAI_API_KEY) in your environment before running with --record.

Frequently Asked Questions about AIMock

What is AIMock?

AIMock is a Model Context Protocol (MCP) server that mock everything your ai app talks to — llm apis, mcp, a2a, ag-ui, vector dbs, search. one package, one port, zero dependencies. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install AIMock?

Install via npm with the command: npx -y @copilotkit/aimock. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with AIMock?

AIMock works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is AIMock free to use?

Yes, AIMock is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "aimock": { "command": "npx", "args": ["-y", "@copilotkit/aimock"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use AIMock?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides