Skip to main content

Configuring MCP Tools and Resources

1. Enabling MCP Servers in IDE Settings

Setting Description Default Value Notes
mcp.enabled Enables or disables MCP server support in the IDE false Set to true to enable MCP integration
mcp.serverPath Path to the MCP server executable or script null Required if MCP is enabled
mcp.port Port number for MCP server communication 3000 Must be available and not in use
mcp.timeout Timeout in milliseconds for MCP server responses 5000 Adjust based on server response times

Example: Enabling MCP in VS Code settings.json

{
  "mcp.enabled": true,
  "mcp.serverPath": "/usr/local/bin/mcp-server",
  "mcp.port": 3000,
  "mcp.timeout": 5000
}
Note: Ensure the MCP server executable has proper permissions and is accessible from your IDE's environment.

2. Selecting Available MCP Tools per Session

Tool Description Availability Configuration
mcp.tool.name Name of the MCP tool to be used in session NEW "toolName"
mcp.tool.version Version of the MCP tool to use NEW "v1.0"
mcp.tool.enabled Boolean flag to enable or disable tool in session NEW true or false

Example: Enabling a Tool in Session

{
  "mcp": {
    "tools": [
      {
        "name": "CodeAssistant",
        "version": "v2.0",
        "enabled": true
      }
    ]
  }
}
Note: Tool selection is session-specific and does not persist across sessions.

3. Restricting MCP Tool Permissions

Permission Description Restriction Level Notes
mcp.tool.execute Execute a tool command DEPRECATED Replaced by specific permission scopes
mcp.tool.read Read tool metadata and configuration Standard Required for tool discovery
mcp.tool.write Modify tool configuration and metadata High Can alter tool behavior or access
mcp.tool.delete Delete tools from the system Very High Can remove critical tools
mcp.tool.invoke Invoke a tool with specific parameters Standard Used for executing tools in workflows

Example: Setting Tool Permissions in MCP Config

{
  "tools": [
    {
      "name": "data-analyzer",
      "permissions": [
        "mcp.tool.read",
        "mcp.tool.invoke"
      ]
    }
  ]
}
Note: Permissions can be scoped to specific tools or groups of tools. Use mcp.tool.* for broad access control.
Warning: Granting mcp.tool.write or mcp.tool.delete permissions to untrusted users can lead to system compromise.

4. Managing Multiple MCP Server Connections

Connection Configuration Status Notes
server-1 { "url": "http://localhost:3000", "auth": "token123" } ACTIVE Primary MCP server for code generation
server-2 { "url": "https://mcp.example.com", "auth": "bearer abcdef" } INACTIVE Legacy server, deprecated since v2.0
server-3 { "url": "wss://ws.mcp.dev", "auth": "oauth2" } BETA Experimental server for AI-assisted debugging

Example: Connecting to Multiple Servers

const mcpClient = new MCPClient({
  servers: [
    { id: 'server-1', url: 'http://localhost:3000', auth: 'token123' },
    { id: 'server-2', url: 'https://mcp.example.com', auth: 'bearer abcdef' },
    { id: 'server-3', url: 'wss://ws.mcp.dev', auth: 'oauth2' }
  ]
});

Workflow: Switching Between Servers

  1. Initialize MCP client with multiple server configurations
  2. Set default server using setDefaultServer('server-1')
  3. Query specific server using queryServer('server-3', 'debug')
  4. Monitor connection status via getConnectionStatus('server-2')

Server Management Summary

  • Primary server is used for default operations
  • Legacy servers can be kept for migration paths
  • Beta servers are for experimental features only

5. Debugging MCP Tool Call Failures

Issue Description Solution
Invalid Tool Response Tool returns malformed or unexpected data Validate response schema before processing. Log raw responses for inspection.
Timeout Errors Tool takes longer than allowed to respond Increase timeout limits or optimize tool logic. Use async handling.
Authentication Failures Tool access denied due to invalid credentials Verify token validity and permissions. Refresh tokens if needed.
Network Errors Connection issues during tool invocation Implement retry logic with exponential backoff. Check network connectivity.

Example: Logging Tool Call Errors

const toolCall = async (toolName, params) => {
  try {
    const response = await fetch(`/api/tools/${toolName}`, {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(params)
    });
    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    console.error(`Tool call failed for ${toolName}:`, error);
    throw error;
  }
};
Note: Use structured logging to capture tool call metadata including input parameters, response times, and error codes for effective debugging.

6. Monitoring MCP Server Logs

Log Level Description Usage
trace Most detailed logging, includes all internal operations and data flow For debugging complex issues or performance bottlenecks
debug Includes debug information, such as internal state changes and method calls Use during development or troubleshooting specific components
info General operational messages, including startup and shutdown events Standard monitoring for production environments
warn Warning messages indicating potential issues that don't stop execution Alerts for non-critical conditions or deprecated features
error Error messages indicating failures or exceptions that halt execution Immediate attention required for system stability

Example: Configuring Log Level in MCP Server

{
  "logging": {
    "level": "info",
    "file": "/var/log/mcp-server.log"
  }
}
Note: Log levels can be adjusted dynamically without restarting the server.
Warning: Enabling trace logging in production can significantly impact performance and disk space usage.

Log Level Summary

  • trace: For in-depth diagnostics and debugging
  • debug: For development and component-specific issues
  • info: Standard operational visibility
  • warn: Non-critical issues that require attention
  • error: Critical failures requiring immediate action

7. Versioning MCP Server Configurations

Configuration Element Description Versioning Strategy Notes
mcp.config.version Version identifier for the MCP server configuration NEW in v1.2 Used to track configuration changes and ensure compatibility
mcp.config.schemaVersion Schema version of the configuration file Incremented on schema changes Ensures backward compatibility and migration paths
mcp.config.metadata Metadata section for version control and tracking NEW in v1.2 Includes timestamps, author, and change logs

Example: Versioned Configuration File

{
  "version": "1.2.0",
  "schemaVersion": "1.2",
  "metadata": {
    "author": "dev-team",
    "lastModified": "2026-04-05T10:00:00Z",
    "changeLog": [
      {
        "version": "1.2.0",
        "description": "Updated server config for new toolset"
      }
    ]
  },
  "server": {
    "port": 3000,
    "host": "localhost"
  }
}
Note: Versioning ensures that configuration changes can be tracked, rolled back if necessary, and validated for compatibility with the MCP server version.

8. Disabling Unused MCP Servers

Server ID Status Notes
mcp-server-1 Enabled Default server for code completion
mcp-server-2 Disabled Unused for current project

Example: Disable MCP Server via Configuration

{
  "mcp": {
    "servers": {
      "mcp-server-1": {
        "enabled": true
      },
      "mcp-server-2": {
        "enabled": false,
        "reason": "Not required for current project"
      }
    }
  }
}
Note: Disabling unused servers reduces resource consumption and improves performance.

Was this article helpful?