About Execution Sampling
Execution Sampling is an MCP server in the AI category: mCP sampling provider for AI generation - no API keys needed.
Install
claude mcp add execution-sampling -- npx -y @kjerneverk/execution-samplingnpx -y @kjerneverk/execution-samplingThis server has no ConduID identity, so agent calls to it are not receipted. Pin the version you install and review the source before granting it credentials.
Ask AI
Ask AI about Execution Sampling
Powered by Claude · Grounded in docs
Security checks
- ✓README presentThe repository ships documentation.
5 checks have not been run yet.
README
@kjerneverk/execution-sampling
MCP sampling provider for AI generation - no API keys needed!
Overview
execution-sampling is a provider implementation that uses MCP (Model Context Protocol) sampling to delegate AI generation to the calling client. This eliminates the need for duplicate API keys when your tool is used via MCP in IDEs like Cursor, GitHub Copilot, or other MCP-enabled environments.
Key Benefits:
- No server-side API keys required
- Seamless integration with MCP clients
- Drop-in replacement for direct providers
- Implements standard Provider interface
- Automatic capability detection
Installation
npm install @kjerneverk/execution-sampling
Quick Start
import { createSamplingProvider } from '@kjerneverk/execution-sampling';
// Create provider with session context
const provider = createSamplingProvider({
sessionId: 'session-123',
clientName: 'Cursor',
supportsTools: false,
});
// Use like any other provider
const response = await provider.execute({
model: 'claude-sonnet-4-5',
messages: [
{ role: 'user', content: 'Generate a plan for...' }
],
responseFormat: { type: 'json_schema', /* ... */ }
});
How It Works
- Your MCP server detects the client supports sampling
- Instead of using direct API calls, you create a SamplingProvider
- When
execute()is called, it sends asampling/createMessagerequest to the client - The client (Cursor, Copilot, etc.) generates the response using its AI
- The response is returned to your server
No duplicate API keys needed!
Requirements
- Client must support MCP sampling capability
- Client must have AI/LLM access
- MCP SDK version 1.0.4 or higher
API Reference
See full API documentation in docs/api.md
Error Handling
The provider handles common sampling errors:
- User rejection (
-1) - Invalid parameters (
-32602) - Timeouts
- Unsupported capabilities
See docs/error-handling.md for details.
Examples
See examples/ directory for complete usage examples.
License
Apache-2.0
Part of @kjerneverk Ecosystem
This package is part of the @kjerneverk ecosystem of execution providers and AI tools.
README copy captured when this server was indexed; it may lag the repository. The original is authoritative.