Package Exports
- @getmcp/core
Readme
@getmcp/core
Core types, schemas, and validation for the getmcp canonical configuration format. Aligned with FastMCP's standard.
Install
npm install @getmcp/coreUsage
Schema Validation
All schemas use Zod for runtime validation:
import { StdioServerConfig, RemoteServerConfig, CanonicalMCPConfig } from "@getmcp/core";
// Validate a stdio server config
const result = StdioServerConfig.safeParse({
command: "npx",
args: ["-y", "@modelcontextprotocol/server-github"],
env: { GITHUB_TOKEN: "..." },
});
if (result.success) {
console.log(result.data); // typed StdioServerConfigType
}
// Validate a remote server config
RemoteServerConfig.parse({
url: "https://mcp.example.com/sse",
headers: { Authorization: "Bearer token" },
});
// Validate a full canonical config
CanonicalMCPConfig.parse({
mcpServers: {
github: { command: "npx", args: ["-y", "@modelcontextprotocol/server-github"] },
sentry: { url: "https://mcp.sentry.dev/sse" },
},
});Type Guards
import { isStdioConfig, isRemoteConfig, inferTransport } from "@getmcp/core";
const config = { command: "npx", args: ["server"] };
isStdioConfig(config); // true
isRemoteConfig(config); // false
inferTransport(config); // "stdio"TypeScript Types
Types are inferred from Zod schemas:
import type {
StdioServerConfigType,
RemoteServerConfigType,
ServerConfigType,
RegistryEntryType,
AppIdType,
ConfigGenerator,
AppMetadata,
} from "@getmcp/core";Schemas
| Schema | Description |
|---|---|
StdioServerConfig |
Local server with command, args, env |
RemoteServerConfig |
Remote server with url, headers |
ServerConfig |
Union of stdio and remote |
LooseServerConfig |
Passthrough schema for unknown fields |
CanonicalMCPConfig |
Top-level { mcpServers: { ... } } |
RegistryEntry |
Server definition for the registry |
AppId |
Enum of supported app identifiers |
TransportType |
`"stdio" |
Supported Apps
AppId includes: claude-desktop, claude-code, vscode, cursor, cline, roo-code, goose, windsurf, opencode, zed
License
MIT