Skip to content

feat(mcp): directory config#12131

Open
Mooncake911 wants to merge 4 commits into
Kilo-Org:mainfrom
Mooncake911:feat/mcp-directory-config
Open

feat(mcp): directory config#12131
Mooncake911 wants to merge 4 commits into
Kilo-Org:mainfrom
Mooncake911:feat/mcp-directory-config

Conversation

@Mooncake911

Copy link
Copy Markdown

Issue

Implements feature discussed in kilocode#3579 (comment)

Context

Add support for .kilocode/mcp/ directory-based MCP server configuration. Each .json file inside mcp/ defines one MCP server (filename without .json extension becomes the server name). This allows users to drop individual MCP server configs as separate files rather than editing a single mcp.json. Also adds home-level global MCP config from ~/.kilocode/ and ~/.kilo/ for consistency with other migrators (rules, workflows, etc.).

Implementation

  • New readMcpDirectory() reads individual .json files from an mcp/ subdirectory, skipping non-JSON files and gracefully handling parse errors
  • New loadMcpFromDir() helper loads both mcp.json (file) and mcp/ (directory) from a given base directory — directory entries override file entries for the same server name via deduplication
  • Refactored migrate() to load home-level global configs (~/.kilocode/ and ~/.kilo/) alongside the existing VS Code global storage and project-level configs
  • Precedence: .kilocode < .kilo < project-level .kilocode < project-level .kilo

Screenshots / Video

N/A (config-only change, no UI)

How to Test

Manual/local verification

  • All 50 MCP migrator tests pass: bun test ./test/kilocode/mcp-migrator.test.ts
  • Typecheck passes: bun run typecheck
  • Create .kilocode/mcp/ directory in a project with a .json file and verify the MCP server loads

Reviewer test steps

  1. Checkout branch, run bun test ./test/kilocode/mcp-migrator.test.ts — all 50 tests should pass
  2. Verify .changeset/mcp-directory-config.md exists and is correct
  3. Review packages/opencode/src/kilocode/mcp-migrator.ts for correctness of the loading order

Blocked checks and substitute verification

  • Full bun test suite was run; several pre-existing failures are unrelated to these changes (effect library compatibility, missing node in PATH, timeout-sensitive tests)

Checklist

  • Issue linked above (discussion reference)
  • Tests/verification described
  • Screenshots/video N/A
  • Changeset added (commit 79ad350c614f3b7497595bb2d117d6f0cc95854d)
  • I personally reviewed the diff and can explain the changes, including any AI-assisted work.

Comment thread packages/opencode/src/kilocode/mcp-migrator.ts Outdated
Comment thread packages/opencode/src/kilocode/mcp-migrator.ts Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • packages/opencode/src/kilocode/mcp-migrator.ts
Previous Review Summaries (2 snapshots, latest commit fff646a)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit fff646a)

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/mcp-migrator.ts 71 Structurally invalid object entries can still abort migration and discard all MCP servers
Files Reviewed (2 files)
  • packages/opencode/src/kilocode/mcp-migrator.ts - 1 issue
  • packages/opencode/test/kilocode/mcp-migrator.test.ts - 0 issues

Fix these issues in Kilo Cloud

Previous review (commit 79ad350)

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
packages/opencode/src/kilocode/mcp-migrator.ts 70 Structurally invalid JSON entries can abort migration and discard all MCP servers
packages/opencode/src/kilocode/mcp-migrator.ts 153 Ordinary CLI and JetBrains clients skip the newly advertised home-level configs
Files Reviewed (3 files)
  • .changeset/mcp-directory-config.md - 0 issues
  • packages/opencode/src/kilocode/mcp-migrator.ts - 2 issues
  • packages/opencode/test/kilocode/mcp-migrator.test.ts - 0 issues

Fix these issues in Kilo Cloud


Reviewed by gpt-5.6-sol · Input: 41.6K · Output: 4.4K · Cached: 147.2K

Review guidance: REVIEW.md from base branch main

@Mooncake911 Mooncake911 changed the title Feat/mcp directory config feat(mcp) directory config Jul 12, 2026
@Mooncake911 Mooncake911 changed the title feat(mcp) directory config feat(mcp): directory config Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant