Table of contents
← Back to blog

Connect to external MCPs and make their tools yours

xmcp now let's you generate tools for external clients.

Add your clients

You need to create the clients.ts in the /src directory and then add the MCP servers. HTTP entries can forward headers; STDIO entries spawn npm packages.

Adding HTTP clients

For HTTP clients, this is the type you have to follow:

Adding STDIO clients

For STDIO clients, this is the type you have to follow:

You need to have the npm package installed in your app if you want to use STDIO.

Generate typed clients

Run the generator from your project root. By default it looks for src/clients.ts and writes to src/generated.

You can also specify the output directory and the clients file path, check out the CLI documentation for more details.

Using the new tools

We will now have the tools from our external clients in the client.index.ts file, now you only have to import and use them.

Web Navigation

Get Library Docs

Autocomplete is available for the tools and their arguments, for easier usage.

Build and run the example

If you want to see an example of how to generate clients and use them, you can checkout the external-clients example.

Contributing

Share your feedback and help shape the future of xmcp: GitHub

One framework to rule them all

    Connect to external MCPs and make their tools yours | xmcp Blog