Skip to main content

Version 1

Auto-generated from config struct types and tags.

Config

Config is the root of .mcpsmithy.yaml. It has four top-level sections: project identifies the codebase and declares content sources; conventions map file-path patterns to docs and rules; tools define what the AI can call at runtime.

FieldTypeRequiredDefaultExclusivityDescription
versionstringyesConfig schema version. Must be "1".
projectProjectyesProject identity, description, and content sources.
conventionsmap[string]ConventionyesRules and docs the AI should follow, keyed by name.
toolsmap[string]ToolyesTools the AI can call, keyed by tool name (the name the AI sees).

Project

Project tells the AI what this codebase is. Name and description appear in tool responses (e.g. project_info). Sources declare where code, docs, and other content live — the AI uses them for search and orientation.

FieldTypeRequiredDefaultExclusivityDescription
namestringyesHuman-readable project name shown in tool responses.
descriptionstringyesBrief summary of what this project does. Shown alongside the name.
sourcesProjectSourcesnoContent sources that tell the AI where things live.
Sources with index: true (default) are searchable via search_for;
sources with index: false describe project structure without being searchable.

Convention

Convention maps a file-path pattern to documentation and rules. When the AI calls conventions_for with a file path, matching conventions return their description, linked docs, tags, and relations — giving the AI the context it needs before generating or reviewing code.

The map key is the convention's unique name, used in relations and tool responses.

FieldTypeRequiredDefaultExclusivityDescription
scopestringnoGlob pattern that matches file paths this convention applies to.
When the AI calls conventions_for with a file path, only conventions
whose scope matches are returned.

Supported patterns:
* — matches any path (use as a global/catch-all convention)
** — matches any number of path segments within a larger pattern
src/** — all files under src/
.go — Go files in the root only
**/
.go — all Go files at any depth

Omit scope entirely to make a convention search-only: it will never be
matched by file path but remains findable via search_for.
docsDocRef[]noDocumentation the AI should read when this convention is matched.
Each entry references a declared source by name, optionally narrowed to specific paths.
descriptionstringyesInline summary returned to the AI alongside matched docs.
Also used as the search corpus when the AI searches conventions by keyword.
tagsstring[]noKeywords that improve search relevance when the AI searches for conventions.
relationsConventionRelations[]noLinks to related conventions, so the AI discovers that changing one area
may require reading or following rules from another.

Tool

Tool defines an operation the AI can invoke. Each tool has a template that produces text output, optional input parameters the AI fills in per call, and optional static options the config author controls. The map key becomes the tool name the AI sees in tool listings.

FieldTypeRequiredDefaultExclusivityDescription
descriptionstringyesDescription the AI sees when listing available tools.
Write what the tool does and when to call it, not just what it returns.
templateTemplateStringyesTemplate body producing the tool's output.
paramsToolParam[]noInput parameters the LLM varies per call — queries, file paths, search terms.
optionsmap[string]anynoStatic key-value pairs set by the config author, invisible to the LLM.
Injected into the template context alongside params at runtime.

Use options for values fixed per tool: token budgets, result limits, base URLs, feature flags.
For example, wire maxResults from options (e.g. {{ search_for .query .maxResults }})
so the config author controls the budget, not the LLM.

Reserved option: urlAllowList ([]string) — when set, http_get, http_post, and http_put
reject any URL whose scheme://host is not in the list.
log_paramsbooleannoWhen false params are not logged at DEBUG level. Default (nil/unset) logs params.
maxOutputKBintegerno1024Maximum output size for this tool in KB. Defaults to 1024 (1 MB). (min: 1)

ProjectSources

ProjectSources groups content the AI can search or reference. Each source type (local, scrape, git, http) is a named map — the names are used in convention docs entries to link conventions to specific content.

Sources serve two purposes:

  • Structure — sources with index: false describe where things live.
  • Search — sources with index: true (default) are indexed for full-text search.
FieldTypeRequiredDefaultExclusivityDescription
pullPolicyPullPolicynoifNotPresentGlobal pull policy for all sources. Per-source values override this.
syncIntervalintegerno0Background sync interval in minutes.
When > 0, the server starts immediately after indexing local sources;
remote sources load in the background. Re-fetch runs every N minutes. (min: 0)
localmap[string]LocalSourcenoFiles on disk, keyed by name. Reference these names in convention docs.
scrapemap[string]ScrapeSourcenoWeb pages to fetch and optionally follow links from, keyed by name.
gitmap[string]GitSourcenoGit repositories to clone, keyed by name.
httpmap[string]HTTPSourcenoHTTP endpoints to fetch (archives, APIs, artifact stores), keyed by name.

DocRef

DocRef links a convention to content from a declared source. The source field must match a key under project.sources (local, scrape, git, or http). Paths optionally narrow to specific files within that source.

FieldTypeRequiredDefaultExclusivityDescription
sourcestringyesSource name — must match a key in project.sources (local, scrape, git, or http). (must reference a declared key in: project.sources.local, project.sources.scrape, project.sources.git, project.sources.http)
pathsstring[]noOptional paths within the source to specific files.

ConventionRelations

ConventionRelations links two conventions so the AI discovers that working in one area may require awareness of another. For example, an API convention might relate to a testing convention because every endpoint needs integration tests.

FieldTypeRequiredDefaultExclusivityDescription
targetstringyesConvention name (must match a conventions map key). (must reference a declared key in: conventions)
descriptionstringnoHow this convention relates to the target.

ToolParam

ToolParam declares an input the AI provides when calling a tool. Params appear in the tool's input schema — the AI sees names, types, and descriptions before deciding what values to pass.

FieldTypeRequiredDefaultExclusivityDescription
namestringyesParameter name. (must not be a reserved engine name)
typeParamTypeyesParameter type.
requiredbooleannofalseWhether the parameter is mandatory.
descriptionstringnoShown to the AI. Use it to explain the expected format or how to
transform what the user provides into what the template expects.
defaultanynoDefault value when not supplied.
The YAML type must match the param type (e.g. integer for int, boolean for bool).
constraintsParamConstraintsnoConstraints on the parameter value (enum or min/max).

LocalSource

LocalSource points to files on disk relative to the project root. Commonly used for source code, docs, configs, and test files. Indexed for search by default; set index: false to expose them as structure without indexing.

FieldTypeRequiredDefaultExclusivityDescription
pathsstring[]yesGlob patterns relative to project root.
descriptionstringnoExplains what these files are. Shown to the AI in project overviews.
indexbooleannotrueWhen true (default), content is searchable via search_for.
Set to false for sources that describe structure only.
pullPolicyPullPolicynoPer-source pull policy override (falls back to global when unset).

ScrapeSource

ScrapeSource fetches web pages by URL. Useful for external API docs, wikis, or any HTML content. Set maxDepth > 0 to follow links from seed URLs and build a wider search corpus.

FieldTypeRequiredDefaultExclusivityDescription
urlsstring[]yesHTTP(S) URLs to fetch.
descriptionstringnoExplains what these pages are. Shown to the AI in project overviews.
indexbooleannotrueWhen true (default), content is searchable via search_for.
Set to false for sources that describe structure only.
maxDepthintegerno0Max link-following depth from seed URLs. (min: 0)
maxPageSizeintegerno2048Max KB per page. (min: 0)
maxPagesintegerno20Max URLs to fetch (seeds + discovered pages combined). (min: 0)
pullPolicyPullPolicynoPer-source pull policy override (falls back to global when unset).

GitSource

GitSource specifies a git repository to clone and optionally index. Requires the git binary on PATH. Credentials come from the environment (SSH keys, git credential helpers, .netrc).

For HTTP archive downloads without the git binary, use an HTTPSource with the forge's archive URL instead.

FieldTypeRequiredDefaultExclusivityDescription
repostringyesGit repository URL (HTTPS or SSH).
refstringnoBranch or tag to fetch.
pathsstring[]yesGlob patterns within the repo.
descriptionstringnoExplains what this repo provides. Shown to the AI in project overviews.
depthintegerno1Git clone depth. Use 1 (default) for content only; increase if history is needed. (min: 1)
indexbooleannotrueWhen true (default), content is searchable via search_for.
Set to false for sources that describe structure only.
pullPolicyPullPolicynoPer-source pull policy override (falls back to global when unset).

HTTPSource

HTTPSource fetches content from a URL and optionally extracts tar.gz archives. Works with any authenticated HTTP(S) endpoint: forge archive URLs, private APIs, artifact stores, etc.

Authentication is automatic via .netrc; custom headers can be added for bearer tokens or API keys.

FieldTypeRequiredDefaultExclusivityDescription
urlstringyesHTTP(S) URL to fetch.
headersmap[string]stringnoCustom HTTP headers (e.g. Authorization).
Applied alongside .netrc credentials; explicit headers take precedence.
pathsstring[]yesGlob patterns within the fetched content.
For archives these match extracted files; for single files they match the saved filename.
descriptionstringnoExplains what this endpoint provides. Shown to the AI in project overviews.
extractbooleannoExtract tar.gz archives.
Auto-detected from Content-Type or URL suffix (.tar.gz/.tgz) when unset.
indexbooleannotrueWhen true (default), content is searchable via search_for.
Set to false for sources that describe structure only.
pullPolicyPullPolicynoPer-source pull policy override (falls back to global when unset).

ParamConstraints

ParamConstraints limits what the AI can supply for a parameter. Use enum for a fixed set of valid values, or min/max for numeric bounds. Constraints are enforced server-side and surfaced in the tool's input schema so the AI knows the valid range upfront.

FieldTypeRequiredDefaultExclusivityDescription
enumany[]nomutually exclusive with min; mutually exclusive with maxFixed set of valid values.
Compatible with string, integer, and number param types.
minnumbernomutually exclusive with enumMinimum value (inclusive).
Applies to integer and number param types only.
maxnumbernomutually exclusive with enumMaximum value (inclusive).
Applies to integer and number param types only.

Enum Reference

PullPolicy

PullPolicy controls when remote sources are fetched.

ValueDescription
alwaysFetch sources on every server start.
ifNotPresentFetch only when the local cache is missing.
neverNever fetch — only use sources already on disk.

ParamType

ParamType names the valid parameter types for tool definitions. Use one of these as the type: value in a tool parameter.

The classification methods (IsNumeric, IsStringLike, IsBoolean) and Compatible implement TypeClassifier, enabling the schema engine to validate typed-as constraints without per-version logic.

ValueDescription
stringJSON Schema string.
numberJSON Schema number (float64).
boolJSON Schema boolean.
arrayJSON Schema array.
project_file_pathString validated as a file path inside the project sandbox.

BuiltinFunc

BuiltinFunc names a template function available inside tool templates. These are the only functions callable from template bodies — they cover convention lookup, content search, file reading, HTTP fetching, and text filtering.

ValueDescription
conventions_forfunc(path string) string — Returns conventions matching a file path, including description and linked docs.
file_readfunc(path string, [maxFileSize int]) string — Reads local files matching a glob pattern within the project sandbox.
grepfunc(pattern string, before float64, after float64, input string) string — Filters input by regex pattern with context lines.
http_getfunc(url string, [maxReadKB int]) (string, error) — HTTP GET with .netrc auth and ANSI stripping. Caps the response body at maxReadKB KB (default 10240). Set the urlAllowList option to restrict which hosts can be reached.
http_postfunc(url string, body string, [contentType string], [maxReadKB int]) (string, error) — HTTP POST with .netrc auth. Sends body with the given content type (default "application/json"), accepts any 2xx response, caps the response body at maxReadKB KB (default 10240). Set the urlAllowList option to restrict which hosts can be reached.
http_putfunc(url string, body string, [contentType string], [maxReadKB int]) (string, error) — HTTP PUT with .netrc auth. Sends body with the given content type (default "application/json"), accepts any 2xx response, caps the response body at maxReadKB KB (default 10240). Set the urlAllowList option to restrict which hosts can be reached.
search_forfunc(query string, [maxResults int], [maxResultSize int]) string — Full-text search over indexed sources.

Type Reference

TemplateString

TemplateString is the template body for a tool. It uses Go text/template syntax with access to the project context via {{ .mcpsmithy }}, declared params and options as {{ .paramName }}, and built-in functions like conventions_for, search_for, file_read, http_get, and grep.