Skip to main content

Overview

VS Code can connect to Pylar MCP tools using Python scripts. This allows you to programmatically access your data views from VS Code or any Python environment.

Prerequisites

  • ✅ VS Code installed
  • ✅ Python installed
  • requests library installed (pip install requests)
  • ✅ Pylar project with published MCP tools
  • ✅ MCP HTTP Stream URL and Bearer Token from Pylar

Step 1: Get Your Pylar Credentials

  1. In Pylar, navigate to your project
  2. Click “Publish” in the right sidebar
  3. Copy both:
    • MCP HTTP Stream URL: https://mcp.publish.pylar.ai/mcp
    • Authorization Bearer Token: Your unique token

Step 2: Create Python Script

Create a new Python file in VS Code (e.g., mcp_jsonrpc_client.py) and add the following code:

Step 3: Add Your Bearer Token

Replace "Bearer xxxx" on line 2 with your actual Bearer Token:
The MCP URL is already in the code. You only need to add your Authorization Bearer Token.

Step 4: Run the Script

  1. In VS Code, open the terminal
  2. Run the script:
The script will:
  1. Initialize the connection to Pylar
  2. List all available tools
  3. Prompt you to select a tool
  4. Ask for tool parameters
  5. Call the tool and display results

Using the Script

List Available Tools

When you run the script, it will automatically list all available Pylar tools:

Select and Use a Tool

  1. Enter the tool number or name when prompted
  2. The script will show the tool’s input schema
  3. Enter required parameters
  4. The tool will be called and results displayed

Example Usage

Integrating into Your Code

You can also use the functions directly in your Python code:

Benefits

  • Programmatic Access: Use Pylar tools from Python code
  • Interactive Testing: Test tools from command line
  • Easy Integration: Use functions in your projects
  • Type Safety: Automatic parameter type conversion
  • Full Control: Access all MCP protocol features

Troubleshooting

Issue: “Module not found” error

Solution: Install required packages:

Issue: Connection errors

Solutions:
  • Verify Bearer Token is correct
  • Check MCP URL is correct
  • Ensure network connectivity
  • Test connection with curl first

Issue: Tool not found

Solutions:
  • Verify tool name matches exactly
  • Check tools are published in Pylar
  • List tools first to see available options

Next Steps