npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

tune-mcp

v0.1.6

Published

MCP support for tune

Readme

Tune MCP

MCP (Model Context Protocol) middleware for Tune - connect to MCP servers via stdio, HTTP, or SSE.

Setup for Text Editor

Install in your ~/.tune folder:

cd ~/.tune
npm install tune-mcp

Add to ~/.tune/default.ctx.js:

const tuneMCP = require('tune-mcp')

module.exports = [
    ...
    tuneMCP({ 
        // accepts claude like and vscode like configs
        config: "path/to/config.json",
    })
    // OR single inline mcp config 
    tuneMCP({ 
        command: "npx",
        args: ["-y", "@playwright/mcp@latest"],
        mount: "playwright"
    })
    // OR multiple inline mcp configs
    tuneMCP({
        playwright: {
            command: "npx",
            args: ["-y", "@playwright/mcp@latest"],
        },
        chrome: {
            type: "streamable-http",
            url: "http://127.0.0.1:12306/mcp"
        }
    }),
    ...
]

Setup for JavaScript Project

npm install tune-mcp tune-sdk
const tune = require('tune-sdk')
const tuneMCP = require('tune-mcp')

const ctx = tune.makeContext(
    tuneMCP({ 
        command: "npx",
        args: ["-y", "@playwright/mcp@latest"],
        mount: "playwright"
    })
)

const result = await ctx.text2run(`
system: @playwright
user: navigate to https://example.com
`)

Usage Examples

Per-Chat Connection

system:
connect through stdio
@{| mcp npx -y @playwright/mcp@latest }
@{| mcp stdio npx -y @playwright/mcp@latest }

connect with HTTP streaming
@{| mcp http://localhost:8931/mcp }
@{| mcp streamable-http http://localhost:8931/mcp }

connect with Server-Sent Events
@{| mcp http://localhost:8931/sse }
@{| mcp sse http://localhost:8931/sse }

connect using config file
@{| mcp @path/to/config.json }
@{| mcp config @path/to/config.json }

user:

open https://google.com and make screenshot 
assistant:

tool_call: browser_navigate {"url":"https://google.com"}
tool_result:
### Ran Playwright code
```js
await page.goto('https://google.com');
...

Configuration Options

Single MCP Server

tuneMCP({
    // Command to run MCP server
    command: "npx",
    args: ["-y", "@playwright/mcp@latest"],
    
    // Mount point prefix for accessing tools
    mount: "playwright",  // Access tools as @playwright/toolname
    
    // Environment variables for the server
    env: {
        "API_KEY": "your-api-key"
    },
    
    // HTTP/SSE connection
    url: "http://localhost:8931/mcp",
    type: "streamable-http", // or "sse"
    
    // Headers for HTTP connections
    headers: {
        "Authorization": "Bearer token"
    },
    
    // Expose only specific tools
    expose: ["navigate", "click", "type"]
})

Multiple MCP Servers

tuneMCP({
    "playwright": {
        "command": "npx",
        "args": ["-y", "@playwright/mcp@latest"],
        "env": { "HEADLESS": "true" }
    },
    "filesystem": {
        "command": "npx",
        "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/files"]
    },
    "api-server": {
        "url": "http://localhost:8080/mcp",
        "headers": { "Authorization": "Bearer token" }
    }
})

Config File Format

Create a config file (Claude Desktop format):

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@playwright/mcp@latest"]
    },
    "filesystem": {
      "command": "npx", 
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Documents"]
    }
  }
}

Or VS Code format:

{
  "mcp": {
    "servers": {
      "playwright": {
        "command": "npx",
        "args": ["-y", "@playwright/mcp@latest"]
      }
    }
  }
}

Connection Types

stdio (Default)

tuneMCP({
    command: "npx",
    args: ["-y", "@playwright/mcp@latest"],
    mount: "playwright"
})

HTTP Streaming

tuneMCP({
    url: "http://localhost:8931/mcp",
    type: "streamable-http",
    mount: "api"
})

Server-Sent Events (SSE)

tuneMCP({
    url: "http://localhost:8931/sse", 
    type: "sse",
    mount: "events"
})

Tool Access Patterns

user: @playwright/navigate                # Use specific tool
user: @playwright                         # connect all available tools
user: @{| mcp stdio some-mcp-server }     # Connect dynamically in chat

Advanced Usage

Regex Tool Matching

const tools = await ctx.resolve("playwright/.*", { 
    match: "regex", 
    output: "all" 
})

Filtered Tool Access

tuneMCP({
    command: "npx",
    args: ["-y", "@modelcontextprotocol/server-everything"],
    mount: "everything",
    expose: ["echo", "add"]  // Only expose specific tools
})

Multiple Configurations

const ctx = tune.makeContext(
    tuneMCP({ command: "npx", args: ["-y", "server1"], mount: "s1" }),
    tuneMCP({ command: "npx", args: ["-y", "server2"], mount: "s2" }),
    tuneMCP({ url: "http://api.example.com/mcp", mount: "api" })
)

Error Handling

The middleware will throw errors for:

  • Missing command or URL configuration
  • MCP server connection failures
  • Tool execution errors
  • Invalid configuration files
try {
    const result = await tool.exec({ arg: "value" }, ctx)
} catch (error) {
    console.error("MCP tool error:", error.message)
}

Environment Variables

In configuration:

tuneMCP({
    command: "your-mcp-server",
    env: {
        "API_KEY": process.env.API_KEY,
        "DEBUG": "true"
    }
})

TODO

  • image as tool result
  • resources
  • auth