Skip to content

Commit 533213c

Browse files
authored
Merge pull request #6762 from remix-project-org/more_mcp_context
More mcp context
2 parents b5c89b3 + 8f3c9c3 commit 533213c

File tree

5 files changed

+521
-8
lines changed

5 files changed

+521
-8
lines changed

apps/remix-ide/src/app/panels/terminal.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function register(api) { KONSOLES.push(api) }
1919
const profile = {
2020
displayName: 'Terminal',
2121
name: 'terminal',
22-
methods: ['log', 'logHtml', 'togglePanel', 'isPanelHidden', 'maximizePanel'],
22+
methods: ['log', 'logHtml', 'togglePanel', 'isPanelHidden', 'maximizePanel', 'getLogs'],
2323
events: [],
2424
description: 'Remix IDE terminal',
2525
version: packageJson.version
@@ -241,6 +241,15 @@ export default class Terminal extends Plugin {
241241
return this.isHidden
242242
}
243243

244+
getLogs() {
245+
// Return logs from terminalApi if available, otherwise return from _JOURNAL
246+
if (this.terminalApi && this.terminalApi.getJournal) {
247+
return this.terminalApi.getJournal()
248+
}
249+
// Fallback to _JOURNAL if terminalApi is not ready
250+
return this._JOURNAL || []
251+
}
252+
244253
async maximizePanel() {
245254
if (!this.isMaximized) {
246255
// Hide all main panel content except terminal

libs/remix-ai-core/src/inferencers/mcp/mcpInferencer.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -270,25 +270,25 @@ export class MCPInferencer extends RemoteInferencer implements ICompletions, IGe
270270
}))
271271
});
272272

273-
const workspaceResource: IMCPResource = {
274-
uri: 'project://structure',
275-
name: 'Project Structure',
276-
description: 'Hierarchical view of project files and folders',
273+
const contextResource: IMCPResource = {
274+
uri: 'context://workspace',
275+
name: 'Workspace Context',
276+
description: 'Complete IDE context including files, editor state, git status, and diagnostics',
277277
mimeType: 'application/json',
278278
};
279279

280280
// Always add project structure for internal remix MCP server
281281
const hasInternalServer = this.mcpClients.has('Remix IDE Server')
282282

283283
if (hasInternalServer) {
284-
const existingProjectStructure = selectedResources.find(r => r.resource.uri === 'project://structure');
284+
const existingProjectStructure = selectedResources.find(r => r.resource.uri === 'context://workspace');
285285
if (existingProjectStructure === undefined) {
286286
selectedResources.push({
287-
resource: workspaceResource,
287+
resource: contextResource,
288288
serverName: 'Remix IDE Server',
289289
score: 1.0, // High score to ensure it's included
290290
components: { keywordMatch: 1.0, domainRelevance: 1.0, typeRelevance:1, priority:1, freshness:1 },
291-
reasoning: 'Project structure always included for internal remix MCP server'
291+
reasoning: 'IDE context always included for internal remix MCP server'
292292
});
293293
}
294294
}

libs/remix-ai-core/src/remix-mcp-server/RemixMCPServer.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import { DeploymentResourceProvider } from './providers/DeploymentResourceProvid
4444
import { TutorialsResourceProvider } from './providers/TutorialsResourceProvider';
4545
import { AmpResourceProvider } from './providers/AmpResourceProvider';
4646
import { DebuggingResourceProvider } from './providers/DebuggingResourceProvider';
47+
import { ContextResourceProvider } from './providers/ContextResourceProvider';
4748

4849
// Import middleware
4950
import { SecurityMiddleware } from './middleware/SecurityMiddleware';
@@ -860,6 +861,10 @@ export class RemixMCPServer extends EventEmitter implements IRemixMCPServer {
860861
private async initializeDefaultResourceProviders(): Promise<void> {
861862
if (this._resources.list().length > 0) return
862863
try {
864+
// Register context resource provider (always included, highest priority)
865+
const contextProvider = new ContextResourceProvider(this._plugin);
866+
this._resources.register(contextProvider);
867+
863868
// Register project resource provider
864869
const projectProvider = new ProjectResourceProvider(this._plugin);
865870
this._resources.register(projectProvider);

0 commit comments

Comments
 (0)