Skip to content

Config Format

Place one of the following in your project root:

  • mcp-general.config.ts (recommended for TypeScript projects)
  • mcp-general.config.js
  • .mcp-generalrc.json
  • .mcp-generalrc.yaml
  • "mcp-general" key in package.json

If your project has a tsconfig.json:

import type { McpGeneralConfig } from 'mcp-general';
const config: McpGeneralConfig = {
namespaces: {
exampleui: {
tools: {
get_components: {
url: 'https://example.com/components.txt',
description: 'All available components',
},
get_styles: 'https://example.com/bla.md',
get_local: {
path: './docs/local-guide.md',
description: 'Read local guide',
},
},
},
tanstack: {
resources: {
documentation: 'https://tanstack.com/README.md',
},
prompts: {
do: 'https://tanstack.com/do.md',
},
},
},
};
export default config;

If your project has a package.json but no tsconfig.json:

/** @type {import("mcp-general").McpGeneralConfig} */
const config = {
namespaces: {
exampleui: {
tools: {
get_components: {
url: 'https://example.com/components.txt',
description: 'All available components',
},
get_styles: 'https://example.com/bla.md',
},
},
},
};
export default config;

If your project has neither tsconfig.json nor package.json:

{
"namespaces": {
"exampleui": {
"tools": {
"get_components": {
"url": "https://example.com/components.txt",
"description": "All available components"
},
"get_styles": "https://example.com/bla.md"
}
}
}
}

Values can be:

  • A string — URLs (starting with http:// or https://) are fetched, otherwise treated as a local file path
  • An object with either url or path (required) and description (optional)

For path entries, you can set execute to run the file as a script instead of reading its content:

  • execute: true — auto-detects the runner based on file extension
  • execute: { command, args? } — use a custom command

Default runners when execute: true:

ExtensionCommand
.jsnode
.tsnpx tsx
.pypython
.shsh
tools: {
// Auto-detect: runs with `node ./scripts/generate.js`
generate: {
path: "./scripts/generate.js",
execute: true,
description: "Run generate script",
},
// Custom command: runs with `deno run ./scripts/fetch.ts`
fetch: {
path: "./scripts/fetch.ts",
execute: { command: "deno", args: ["run"] },
description: "Run fetch script with Deno",
},
}

By default, all content is compressed before being returned — HTML/JSX tags, images, base64 blocks, import statements, and redundant whitespace are stripped to reduce token size for LLM consumption.

To disable compression for a specific entry, set compress: false:

tools: {
// Compression is ON by default — no need to set anything
get_llms: {
url: "https://example.com/llms-full.txt",
description: "Compressed documentation",
},
// Disable compression for entries where raw content matters
get_raw: {
path: "./docs/raw-template.html",
compress: false,
description: "Raw HTML template",
},
}

By default, all fetched content is cached to the .mcpg folder in your project root with a TTL of 1 day (86 400 000 ms). Cached files are plain text — you can inspect them at any time.

Cache can be configured at three levels, where the most specific level wins:

  1. Root — applies to all namespaces and entries
  2. Namespace — applies to all entries in that namespace
  3. Entry — applies to a single entry

Each level accepts true (default TTL), false (disabled), or { ttl: <ms> } for a custom TTL.

import type { McpGeneralConfig } from 'mcp-general';
const config: McpGeneralConfig = {
// Root level: default for everything
cache: { ttl: 7 * 24 * 60 * 60 * 1000 }, // 7 days
namespaces: {
docs: {
// Namespace level: override root for this namespace
cache: { ttl: 60 * 60 * 1000 }, // 1 hour
tools: {
// Entry level: disable cache for this specific tool
get_live_status: {
url: 'https://example.com/status',
cache: false,
},
// Uses namespace TTL (1 hour)
get_guide: 'https://example.com/guide.md',
},
},
static: {
// No namespace cache set → uses root TTL (7 days)
tools: {
get_reference: 'https://example.com/reference.md',
},
},
},
};
export default config;

The TypeScript example above would register:

TypeNameDescription
Toolexampleui_get_componentsAll available components
Toolexampleui_get_stylesFetch https://example.com/bla.md
Toolexampleui_get_localRead local guide
Resourcetanstack_documentationFetch https://tanstack.com/README.md
Prompttanstack_doFetch https://tanstack.com/do.md