-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add initial support for MCP #14598
Merged
Merged
Add initial support for MCP #14598
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
4e5f65d
Add initial support for MCP
JonasHelming efa6e9a
Update packages/ai-mcp/src/node/mcp-server-manager-impl.ts
JonasHelming aef0084
Update packages/ai-mcp/src/node/mcp-server-manager-impl.ts
JonasHelming 327b404
Update packages/ai-mcp/src/node/mcp-server-manager-impl.ts
JonasHelming cf3e971
Update packages/ai-mcp/src/node/mcp-server-manager-impl.ts
JonasHelming a331f13
Update packages/ai-mcp/package.json
JonasHelming 8fb5bf4
Update packages/ai-mcp/src/browser/mcp-command-contribution.ts
JonasHelming c0e74c5
Adressed review comments
JonasHelming 1c3e23a
fix types, only use valid servers and make args optional
sdirix 1c2f228
Apply suggestions from code review
sdirix 6248785
replace remaining any types, use string instead of String
sdirix 1641ecd
typeguard fix
sdirix c1a9e86
Merge remote-tracking branch 'upstream/master' into GH-14523-2
sdirix 2e9236c
Fix two remaining bugs:
JonasHelming 0596240
remove casting in type check and protect against deepEqual fail
sdirix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import('eslint').Linter.Config} */ | ||
module.exports = { | ||
extends: [ | ||
'../../configs/build.eslintrc.json' | ||
], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: 'tsconfig.json' | ||
} | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Model Context Server (MCP) Integration | ||
|
||
The AI MCP package provides an integration that allows users to start and use MCP servers to provide additional tool functions to LLMs, e.g. search or file access (outside of the workspace). | ||
|
||
## Features | ||
- Add MCP servers via settings.json | ||
- Start and stop MCP servers. | ||
- Use tool functions provided by MCP servers in prompt templates | ||
|
||
## Commands | ||
|
||
### Start MCP Server | ||
|
||
- **Command ID:** `mcp.startserver` | ||
- **Label:** `MCP: Start MCP Server` | ||
- **Functionality:** Allows you to start a MCP server by selecting from a list of configured servers. | ||
|
||
### Stop MCP Server | ||
|
||
- **Command ID:** `mcp.stopserver` | ||
- **Label:** `MCP: Stop MCP Server` | ||
- **Functionality:** Allows you to stop a running MCP server by selecting from a list of currently running servers. | ||
|
||
## Usage | ||
|
||
1. **Starting a MCP Server:** | ||
|
||
- Use the command palette to invoke `MCP: Start MCP Server`. | ||
- A quick pick menu will appear with a list of configured MCP servers. | ||
- Select a server to start. | ||
|
||
2. **Stopping a MCP Server:** | ||
- Use the command palette to invoke `MCP: Stop MCP Server`. | ||
- A quick pick menu will display a list of currently running MCP servers. | ||
- Select a server to stop. | ||
|
||
3. **Using provided tool functions** | ||
- Only functions of started MCP servers can be used | ||
- Open a prompt template and add the added tool functions | ||
- Type '~{' to open the auto completion | ||
|
||
## Configuration | ||
|
||
Make sure to configure your MCP servers properly within the preference settings. | ||
|
||
Example Configuration: | ||
|
||
```json | ||
{ | ||
"ai-features.mcp.mcpServers": { | ||
"memory": { | ||
"command": "npx", | ||
"args": [ | ||
"-y", | ||
"@modelcontextprotocol/server-memory" | ||
] | ||
}, | ||
"brave-search": { | ||
"command": "npx", | ||
"args": [ | ||
"-y", | ||
"@modelcontextprotocol/server-brave-search" | ||
], | ||
"env": { | ||
"BRAVE_API_KEY": "YOUR_API_KEY" | ||
} | ||
}, | ||
"filesystem": { | ||
"command": "npx", | ||
"args": [ | ||
"-y", | ||
"@modelcontextprotocol/server-filesystem", | ||
"ABSOLUTE_PATH_TO_ALLOWED_DIRECTORY", | ||
] | ||
}, | ||
} | ||
} | ||
``` | ||
|
||
Example prompt (for search) | ||
```md | ||
~{mcp_brave-search_brave_web_search} | ||
``` | ||
|
||
Example User query | ||
```md | ||
Search the internet for XYZ | ||
``` | ||
|
||
## More Information | ||
[List of available MCP servers](https://github.com/modelcontextprotocol/servers) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "@theia/ai-mcp", | ||
"version": "1.56.0", | ||
"description": "Theia - MCP Integration", | ||
"dependencies": { | ||
"@theia/core": "1.56.0", | ||
"@theia/ai-core": "1.56.0", | ||
"@modelcontextprotocol/sdk": "1.0.1" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"theiaExtensions": [ | ||
{ | ||
"frontend": "lib/browser/mcp-frontend-module", | ||
"backend": "lib/node/mcp-backend-module" | ||
} | ||
], | ||
"keywords": [ | ||
"theia-extension" | ||
], | ||
"license": "EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/eclipse-theia/theia.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/eclipse-theia/theia/issues" | ||
}, | ||
"homepage": "https://github.com/eclipse-theia/theia", | ||
"files": [ | ||
"lib", | ||
"src" | ||
], | ||
"scripts": { | ||
"build": "theiaext build", | ||
"clean": "theiaext clean", | ||
"compile": "theiaext compile", | ||
"lint": "theiaext lint", | ||
"test": "theiaext test", | ||
"watch": "theiaext watch" | ||
}, | ||
"devDependencies": { | ||
"@theia/ext-scripts": "1.56.0" | ||
}, | ||
"nyc": { | ||
"extends": "../../configs/nyc.json" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be simplified
Since a few versions Typescript is smart enough to allow access to fields when they were checked via the
in
parameter before. If your IDE complains here then you are somehow not consuming the Typescript version of the repo.