Skip to content

MCP Servers

Learn how to use Model Context Protocol (MCP) modules in VJSP to achieve external tool integration, database connections, and extend the development environment.

Model Context Protocol (MCP) servers enable VJSP to connect to external tools, systems, and databases by running MCP servers.

These servers support the following functions:

  • Implement external integration: Connect to external tools and systems

  • Create extensible interfaces: Support custom function extensions

  • Support complex interactions: Deep integration with the development environment

  • Support partner contributions: Accept third-party proprietary function modules

How to Configure Model Context Protocol (MCP) in VJSP

Using and customizing MCP configuration

As AI systems continue to evolve, they remain limited by training data and cannot access real-time information or call specialized tools. The Model Context Protocol (MCP) solves this problem by enabling AI models to connect to external data sources, tools, and environments. This mechanism facilitates seamless information sharing and capability exchange between AI systems and the broader digital world. This standard, introduced by Anthropic, unifies the interaction logic for prompts, context, and tool calls, and is core to building truly practical AI experiences - experiences that can be flexibly configured with custom tools.

How MCP Works in VJSP

Currently, custom tools can be configured through the Model Context Protocol standard to achieve unified management of prompts, context, and tool usage.

MCP servers can be added to the central configuration via the mcpServers field. You can browse available MCP servers here.

ⓘ MCP is only supported in Agent mode.

Quick Start: Configure Your First MCP Server

Here's a quick example of configuring a new MCP server and applying it to the configuration file:

  1. Create a folder named .vjsp/mcpServers in your workspace root directory

  2. Add a file named playwright-mcp.yaml to this folder

  3. Write the following content and save

yaml
name: Playwright mcpServer
version: 0.0.1
schema: v1
mcpServers:
  - name: Browser Search
    command: npx
    args:
      - "@playwright/mcp@latest"

Now, test your MCP server by entering the following command:

plaintext
Open the browser and visit Baidu News.

How to Configure Document Search via MCP

You can configure MCP servers to search documents directly from the configuration. This is particularly useful for obtaining configuration and function-related help.

The VJSP documentation MCP server allows you to directly search and retrieve relevant information from VJSP documentation during agent conversations.

Configuration Steps

Configuring VJSP

  1. Create a folder named .vjsp/mcpServers in your workspace root directory

  2. Add a file named vjsp-docs-mcp.yaml to this folder

  3. Write the following content and save:

yaml
name: VJSP Documentation MCP
version: 0.0.1
schema: v1
mcpServers:
  - uses: dev/vjsp-docs-mcp

Enable Agent Mode

MCP servers only work in Agent mode. Make sure to switch to Agent mode in VJSP before testing.

Usage Examples

After configuration, you can use the MCP server to search VJSP documentation in the following ways:

plaintext
How to add Claude 4 Sonnet from Bedrock as a model in VJSP?
plaintext
Which context providers does VJSP support?
plaintext
How to add custom rules to VJSP configuration?

Built-in Tool Configuration Description

ToolDescription
read_fileUse this tool to view existing file content.
create_new_fileCreate new folders. Use only when files don't exist and need to be created.
run_terminal_commandRun terminal commands in the current directory. Shell is stateless and doesn't remember previous commands. If running commands in the background, be sure to wrap the command in a shell function and place it in a shell command block in the format sh -c '...'. Do not perform operations that require special terminal permissions. Choose terminal command scripts optimized for x86 and arm64 architectures, and shell syntax.
file_glob_searchRecursively search for files in the project using wildcard patterns. Supports "*" for recursive directory search. Won't display large numbers of build, cache, or key files (use cache tool instead). Output may be truncated, use precise matching patterns.
view_diffView differences in current work content.
read_currently_open_fileRead currently open files in the IDE. If the user mentions files you cannot view, or the requested content seems missing, try using this tool.
lsList files and folders in the specified directory.
create_rule_blockCreate "rules" that can be referenced in subsequent conversations. Use this tool when you want to establish code standards/preferences that should be consistently followed, or when you want to avoid repeating mistakes. To modify existing rules, use the edit tool instead.
Rule Types:
Always: Contains only "rule" (always included in model context)
Auto Attached: Contains "rule", "glob" and/or "regex" (triggered when files match patterns)
Agent Requested: Contains "rule" and "description" (AI decides whether to apply based on description)
Manual: Contains only "rule" (only included when manually invoked...)
fetch_url_contentView website content via URL. Do not use for files.
request_ruleUse this tool to retrieve additional "rules" containing more context/instructions (based on their description). Available rules: No available rules.
search_webPerform web searches and return top results. Use cautiously - only for questions requiring professional, external and/or up-to-date knowledge. Ordinary programming questions don't require web searches.
multi_editUse this tool to perform multiple edit operations on a single file, efficiently completing multiple find-and-replace operations. To perform multiple edits on a file, provide the following:
File Path: Path to the file to modify (relative to project workspace root, verify directory exists)
Edit Content: Array of edit operations to perform, each containing:
    old_string: Text to replace (must exactly match target content, including all spaces/indentation)
    new_string: Text to replace old_string with
(Trigger method: Ask first)
grep_searchUse ripgrep to execute this regex search in the repository. Won't include results from large numbers of build, cache, or key files. Output may be truncated, use precise query conditions.

Troubleshooting

MCP Server Not Loading

  1. Check Configuration File: Ensure the uses field in the YAML configuration is correctly set to dev/vjsp-docs-mcp

  2. Confirm Mode Switch: MCP servers only support Agent mode, need to switch before use

  3. Restart VJSP: Try restarting the VJSP extension

No Search Results Returned

  1. Verify Network Connection: MCP servers require internet connection to search documentation

  2. Adjust Query Format: Try reorganizing the way search statements are phrased

  3. Test Known Topics: Search for functions clearly covered in documentation (like "model configuration") for verification

How to Configure MCP Servers

If you need to build custom MCP servers, please read the MCP Quick Start documentation first, then create mcpServers configuration, or add local MCP server configuration blocks to your configuration file:

yaml
# ...
mcpServers:
  - name: SQLite MCP
    command: npx
    args:
      - "-y"
      - "mcp-sqlite"
      - "/path/to/your/database.db"  # Your database file path
# ...

ⓘ If creating separate configuration files in the .vjsp/mcpServers/ directory, include necessary metadata fields (name, version, schema), as shown in the quick start example above.

MCP Server Property Configuration Description

MCP components include several additional properties specific to MCP servers:

  • name: Display name of the MCP server

  • type: MCP server type, optional values are sse, stdio, streamable-http

  • command: Command to start the MCP server

  • args: Arguments passed to the startup command

  • env: Environment variables injected into the command (for storing sensitive information like keys)

How to Choose MCP Transport Type

MCP currently supports HTTP-based transport methods to achieve remote server connections, breaking through the limitations of traditional local standard input/output (stdio) transport. This feature supports integration of cloud-hosted MCP servers and distributed architectures.

How to Use Server-Sent Events (SSE) Transport

For real-time streaming communication, use the SSE transport method:

yaml
# ...
mcpServers:
  - name: Server Name
    type: sse
    url: https://....  # Remote SSE server address
# ...

How to Use Standard Input/Output (stdio) Transport

For local MCP servers communicating via standard input/output:

yaml
# ...
mcpServers:
  - name: Server Name
    type: stdio
    command: npx
    args:
      - "@modelcontextprotocol/server-sqlite"
      - "/path/to/your/database.db"  # Your database file path
# ...

How to Use Streamable HTTP Transport

For standard HTTP communication supporting streaming:

yaml
# ...
mcpServers:
  - name: Server Name
    type: streamable-http
    url: https://....  # Remote HTTP server address
# ...

These remote transport options allow you to connect to MCP servers deployed on remote infrastructure, supporting more flexible deployment architectures and enabling multiple clients to share server resources.

How to Manage Keys in MCP Servers

Some MCP servers require the use of API keys or other sensitive information. You can utilize locally stored environment keys or access keys hosted in the Agent Hub. To use Hub keys, you can use the inputs property instead of secrets in the MCP's env configuration block.

yaml
# ...
mcpServers:
  - name: Supabase MCP
    command: npx
    args:
      - -y
      - "@supabase/mcp-server-supabase@latest"
      - --access-token
      - ${{ secrets.SUPABASE_TOKEN }}
    env:
      SUPABASE_TOKEN: ${{ secrets.SUPABASE_TOKEN }}
  - name: GitHub
    command: npx
    args:
      - "-y"
      - "@modelcontextprotocol/server-github"
    env:
      GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_PERSONAL_ACCESS_TOKEN }}
# ...