Show Server Configuration
procore_get_configRetrieve current MCP server configuration including OAuth status, company ID, and project ID to debug context issues or verify settings before switching projects.
Instructions
Show the current MCP server configuration: OAuth/auth status, default company_id, the active runtime project_id, and other persisted settings. Use this to debug context issues or before switching projects. Takes no inputs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/handlers/get-config.ts:4-50 (handler)Main handler function for the procore_get_config tool. Reads runtime config and auth tokens, then formats a human-readable summary of the MCP server configuration state.
export async function handleGetConfig(): Promise<string> { const runtimeConfig = getRuntimeConfig(); const tokens = readTokens(); const lines: string[] = ["## Procore MCP Server Configuration\n"]; // Auth status if (tokens) { const expired = isTokenExpired(tokens); lines.push( `Auth: ${expired ? "Token expired (will auto-refresh on next call)" : "Authenticated"}` ); const expiresAt = new Date(tokens.expires_at).toISOString(); lines.push(`Token expires: ${expiresAt}`); } else { lines.push("Auth: Not authenticated. Run `npm run auth` to set up."); } // Company ID const companyId = runtimeConfig.company_id || process.env.PROCORE_COMPANY_ID; lines.push( `\nDefault Company ID: ${companyId || "Not set"}` ); // Runtime overrides if (runtimeConfig.project_id) { lines.push(`Default Project ID: ${runtimeConfig.project_id}`); } // Additional runtime config const otherKeys = Object.keys(runtimeConfig).filter( (k) => k !== "company_id" && k !== "project_id" ); if (otherKeys.length > 0) { lines.push("\nRuntime config:"); for (const key of otherKeys) { lines.push(` ${key}: ${runtimeConfig[key]}`); } } lines.push( "\nUse procore_set_config to change runtime settings (company_id, project_id)." ); return lines.join("\n"); } - src/tools/registry.ts:193-209 (registration)Registers the 'procore_get_config' tool with the MCP server, defining its title, description, empty inputSchema, and linking to the handleGetConfig handler.
// 6. Get Config server.registerTool( "procore_get_config", { title: "Show Server Configuration", description: "Show the current MCP server configuration: OAuth/auth status, default " + "company_id, the active runtime project_id, and other persisted settings. " + "Use this to debug context issues or before switching projects. Takes no inputs.", inputSchema: {}, annotations: { title: "Show Config", ...READ_ONLY }, }, async () => { const text = await handleGetConfig(); return { content: [{ type: "text" as const, text }] }; } ); - src/tools/registry.ts:202-203 (schema)Input schema for procore_get_config — defined as empty object (takes no inputs).
inputSchema: {}, annotations: { title: "Show Config", ...READ_ONLY }, - src/api/client.ts:212-216 (helper)Runtime config store used by handleGetConfig: getRuntimeConfig() returns the in-memory config (company_id, project_id, etc.) that is read to display configuration.
let runtimeConfig: Record<string, string | number> = {}; export function getRuntimeConfig(): Record<string, string | number> { return { ...runtimeConfig }; } - src/auth/token-store.ts:20-54 (helper)readTokens() and isTokenExpired() helpers used by handleGetConfig to display OAuth authentication status and token expiry.
export function readTokens(): TokenData | null { const tokenPath = getTokenPath(); try { const raw = readFileSync(tokenPath, "utf8"); const data = JSON.parse(raw) as TokenData; if (!data.access_token || !data.refresh_token || !data.expires_at) { return null; } return data; } catch { return null; } } export function writeTokens(tokens: TokenData): void { const tokenPath = getTokenPath(); const dir = dirname(tokenPath); mkdirSync(dir, { recursive: true, mode: 0o700 }); // Atomic write: write to temp file, then rename const tmpPath = tokenPath + ".tmp"; writeFileSync(tmpPath, JSON.stringify(tokens, null, 2), { mode: 0o600, }); renameSync(tmpPath, tokenPath); } export function isTokenExpired(tokens: TokenData): boolean { // 60-second buffer before actual expiry return Date.now() >= tokens.expires_at - 60_000; } export function tokensExist(): boolean { return readTokens() !== null; }