Open
Description
Currently, thv list
is able to output the list of MCP servers running in the system.
if you use the --format
flag, it's able to format it according to a certain expected output. e.g. thv list --format mcpservers
will output something like the following:
{
"mcpServers": {
"brave-search": {
"url": "http://localhost:43154/sse#brave-search"
},
"fetch": {
"url": "http://localhost:48641/sse#fetch"
},
"github": {
"url": "http://localhost:47218/sse#github"
},
"sequentialthinking": {
"url": "http://localhost:57929/sse#sequentialthinking"
}
}
}
It would be handy for Agent/client authors, to extract snippets for calling MCP tools for their preferred programming language and library.
e.g.
$ thv list --format mcptypescript
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
let client: Client | undefined = undefined;
// Use only SSE transport for simplicity and reliability
client = new Client({
name: 'sse-client',
version: '1.0.0',
});
// MCP Github
const sseTransportGithub = new SSEClientTransport(
new URL('http://localhost:59710/sse#github'),
);
await client.connect(sseTransportGithub);