Workspace MCP resources using mcp sdk#229
Open
ghostflyby wants to merge 176 commits into
Open
Conversation
Add 4 new WorkspaceMcpFeature implementations: - NavigationFeature (14 tools) - QualityFeature (15 tools) - ScopeTextSearchFeature (6 tools) - ScopeSymbolSearchFeature (4 tools) Each feature registers typed SDK tools with @serializable DTOs, projectKey/projectPath resolution, and WorkspaceResourceException error handling. Old annotation-based toolsets remain in place.
Delete 6 old annotation McpToolset classes (fully replaced by SDK features + resources). Remove <mcpToolset> extensions and <depends> from plugin.xml. Replace mcpFail with WorkspaceResourceException in shared services. Remove @McpDescription annotations from ScopeDtos. Replace reportActivity with no-op stub (SDK server handles activity reporting).
- Add SegmentId (atomic unique id), ResourceSegment (StaticSegment / TemplateSegment), AncestorContext, ResourceSegmentBuilder DSL, and ResourceSegmentRegistry - Update WorkspaceMcpFeature with segment-based registration support - Migrate CoreResourceFeature to segment DSL, export PROJECT_SEGMENT anchor - Migrate VfsResourceFeature to under(PROJECT_SEGMENT) DSL - Integrate segment registry into WorkspaceMcpSdkServerService for URI matching, resource/template listing, dynamic feature add/remove
…t wrappers + invokeOnCompletion
- build.gradle.kts: change mcp.kotlin.sdk.server from implementation to api
- Delete WorkspaceMcpCallContext, WorkspaceMcpProjectContext, and all with* coroutine context wrappers
- Move ScopeProvider + Project.scope extension to WorkspaceMcpCoroutineContext.kt (kept as the file is now only lifecycle scope)
- Move WorkspaceProjectResolutionReason enum to WorkspaceProjectResolver.kt
- Replace async(project.scope.coroutineContext) { block }.await() with invokeOnCompletion pattern for proper structured concurrency
- Update WorkspaceMcpRequestRunner, WorkspaceMcpSdkServerService, WorkspaceResourceReader to use direct call paths without context wrappers
- Delete SdkToolDescriptor, SdkToolHandlerContext, Server.registerSdkTool - Rewrite registerTool() on WorkspaceMcpFeatureRegistrationContext: inline <reified T> with direct server.addTool() + JSON deserialization - Handler signatures: (args: T, sessionId: String?, runner: WorkspaceMcpRequestRunner): CallToolResult - Remove sessionId param from WorkspaceMcpRequestRunner.callToolWithProject - Migrate 9 handler files (Vfs, Document, Navigation, Quality, Scope*) - Migrate 7 feature files to inline registerTool<Type>(...) calls - Update tests to remove deleted factory function references
- RestServerInfoTest: server info returns metadata
- RestProjectTest: project list, detail, single-project fallback
- RestFileTest: content, meta, exists, compound, glob, 404
- Use Ktor testApplication {} with ContentNegotiation + Resources
- Use IntelliJ @TestApplication + projectFixture for IDE services
- Fix FileRoutes to use manual routing (nested @resource incompatible with route prefix)
- Auto-detect git diff vs Codex apply_patch by first line - text/x-patch Content-Type forces git format (400 if invalid) - Reuse EDT-safe update logic for git hunks - Test: git update/create/delete, Content-Type enforcement, unknown format
… MCP tools - New package dev.ghostflyby.mcp.patch with Types, CodexPatchParser, Applicator - Delete FileContentWriteTools.kt, DocumentPatchTypes.kt (MCP tools removed) - Delete empty FileContentFeature from plugin.xml - FilePatchRoutes.kt imports updated to new package
…ry params - Move nested Ktor @resource classes from modules to plugins/WorkspaceMcpTools/.../rest/RestResources.kt (modules unchanged) - Resource classes use nested declaration: Api.Project, Api.Project.Root, etc. - All query params strongly typed via FileQuery helper class (call.request.queryParameters eliminated from handlers) - RestApi.kt: remove route(/api/v1) wrapper (handled by Api @resource) - Update route handlers to use full type names like Api.Project.Root.File
- Update existing globstar text test to expect prefix block format - Add tests: mixed root/nested, multiple files same directory
Replace tab-indented glob text with Prefix Block format: - @ <prefix>/ lines declare the current directory context - Subsequent lines are filenames relative to that prefix - Max 16 entries per prefix block before repeating - Reduces repeated path tokens in long listings
…i route blocks - Api no longer has @resource("/api/v1"); path prefix moved to RestApi.kt route string - All parent: Api fields removed (Api contributes no path to child URLs) - Parent fields on resource classes with @resource retained (Root, File, GlobEntry, etc.) - RestApi.kt restored route("/api/v1") wrapping - Sibling classes (ServerInfo, Projects, Project, Vfs) no longer carry Api parent
Resolved conflicts in CocoaRecentProjectsService.kt and CocoaRecentProjectsCoordinatorTest.kt. Kept mcp-sdk branch design: injectable startupProjectLookupDispatcher + nanoTime for virtual-time testability (runTest with advanceTimeBy/advanceUntilIdle).
…ojectsCoordinator - Replace private val nanoTime: () -> Long with private val timeSource: TimeSource = TimeSource.Monotonic - Replace scheduledSyncAtNanos: Long with scheduledSyncDeadline: TimeMark = timeSource.markNow() - Use hasPassedNow() + elapsedNow() for deadline checking - Use timeSource.markNow() + debounceMillis.milliseconds for deadline setting - WorkerStep.Delay takes Duration instead of Long millis - Test: use (coroutineScope as? TestScope)?.testTimeSource in coordinator() helper, removing manual nanoTime translation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.