npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@tmcp/adapter-arktype

v0.2.2

Published

ArkType adapter for TMCP JSON Schema conversion

Readme

@tmcp/adapter-arktype

ArkType adapter for TMCP JSON Schema conversion.

Installation

pnpm add @tmcp/adapter-arktype arktype tmcp

Usage

import { ArktypeJsonSchemaAdapter } from '@tmcp/adapter-arktype';
import { type } from 'arktype';

const adapter = new ArktypeJsonSchemaAdapter();

// Define an ArkType schema
const userSchema = type({
	name: 'string',
	age: 'number',
	email: 'string.email',
});

// Convert to JSON Schema
const jsonSchema = await adapter.toJsonSchema(userSchema);
console.log(jsonSchema);

Usage with TMCP Server

import { McpServer } from 'tmcp';
import { ArktypeJsonSchemaAdapter } from '@tmcp/adapter-arktype';
import { type } from 'arktype';

const adapter = new ArktypeJsonSchemaAdapter();
const server = new McpServer(
	{
		name: 'my-server',
		version: '1.0.0',
		description: 'Server with ArkType schemas',
	},
	{
		adapter,
		capabilities: {
			tools: { listChanged: true },
		},
	},
);

// Define a tool with ArkType schema
server.tool(
	{
		name: 'create_user',
		description: 'Create a new user',
		schema: type({
			name: 'string',
			age: 'number',
			email: 'string.email',
		}),
	},
	async ({ name, age, email }) => {
		return {
			content: [
				{
					type: 'text',
					text: `Created user: ${name}, age ${age}, email ${email}`,
				},
			],
		};
	},
);

Advanced Usage

Complex Type Definitions

import { ArktypeJsonSchemaAdapter } from '@tmcp/adapter-arktype';
import { type } from 'arktype';

const adapter = new ArktypeJsonSchemaAdapter();

// Complex nested types
const userSchema = type({
	name: 'string>0',
	age: 'number>=0',
	email: 'string.email',
	preferences: {
		theme: "'light' | 'dark'",
		notifications: 'boolean',
	},
	tags: 'string[]',
});

const jsonSchema = await adapter.toJsonSchema(userSchema);

Union Types and Constraints

import { type } from 'arktype';

// Union types with constraints
const contactSchema = type({
	type: "'email' | 'phone'",
	value: 'string',
});

// Conditional types
const eventSchema = type({
	type: "'click' | 'hover' | 'scroll'",
	timestamp: 'number',
	data: 'unknown',
});

API

ArktypeJsonSchemaAdapter

A class that extends the base JsonSchemaAdapter from TMCP and provides ArkType-specific schema conversion.

Methods

  • toJsonSchema(schema) - Converts an ArkType schema to JSON Schema format

Dependencies

  • arktype - Peer dependency for schema validation and type definitions (^2.0.0)
  • tmcp - Peer dependency for the base adapter

Features

  • Built-in conversion - Uses ArkType's native toJsonSchema() method
  • Type safety - Full TypeScript support with proper type inference
  • Easy integration - Drop-in replacement for other TMCP adapters
  • Runtime validation - Leverages ArkType's powerful runtime type checking
  • String-based types - Intuitive string-based type definitions

Acknowledgments

Huge thanks to Sean O'Bannon that provided us with the @tmcp scope on npm.