Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1307,15 +1307,15 @@
"group": "Tools and integrations",
"pages": [
"langsmith/agent-builder-tools",
"langsmith/agent-builder-mcp-framework",
"langsmith/agent-builder-slack-app"
]
},
{
"group": "Advanced",
"pages": [
"langsmith/agent-builder-auth-format",
"langsmith/agent-builder-code"
"langsmith/agent-builder-code",
"langsmith/agent-builder-mcp-framework"
]
}
]
Expand Down
92 changes: 41 additions & 51 deletions src/langsmith/agent-builder-mcp-framework.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,20 @@ title: LangSmith Tool Server
sidebarTitle: MCP framework
---

The LangSmith Tool Server is our MCP Framework that powers the tools available in the LangSmith Agent Builder. This framework enables you to build and deploy custom tools that can be integrated with your agents. It provides a standardized way to create, deploy, and manage tools with built-in authentication and authorization.
The LangSmith Tool Server is a standalone MCP framework for building and deploying tools with built-in authentication and authorization. Use the Tool Server when you want to:

The PyPi package that defines the framework is available [here](https://pypi.org/project/langsmith-tool-server/).
- [Create custom tools](#create-a-custom-toolkit) that integrate with LangSmith's [Agent Auth](/langsmith/agent-auth) for OAuth authentication
- [Build an MCP gateway](#use-as-an-mcp-gateway) for agents you're building yourself (outside of Agent Builder)

## Quick start
<Note>
If you're using [Agent Builder](/langsmith/agent-builder), you don't need to interact with the Tool Server directly. Agent Builder provides [built-in tools](/langsmith/agent-builder-tools) and supports [remote MCP servers](/langsmith/agent-builder-tools#using-remote-mcp-servers) without requiring Tool Server setup.

However, you can configure the associated tool server instance as an MCP server, which will allow you to use your custom MCP servers in your agent.
</Note>

Download the [PyPi package](https://pypi.org/project/langsmith-tool-server/) to get started.

## Create a custom toolkit

Install the LangSmith Tool Server and LangChain CLI:

Expand Down Expand Up @@ -63,9 +72,9 @@ langchain tools serve

Your tool server will start on `http://localhost:8000`.

## Simple client example
## Call tools via MCP protocol

Here's a simple example that lists available tools and calls the `add` tool:
Below is an example that lists available tools and calls the `add` tool:

```python
import asyncio
Expand All @@ -89,7 +98,32 @@ async def main():
asyncio.run(main())
```

## Adding OAuth authentication
## Use as an MCP gateway

The LangSmith Tool Server can act as an MCP gateway, aggregating tools from multiple MCP servers into a single endpoint. Configure MCP servers in your `toolkit.toml`:

```toml
[toolkit]
name = "my-toolkit"
tools = "./my_toolkit/__init__.py:TOOLS"

[[mcp_servers]]
name = "weather"
transport = "streamable_http"
url = "http://localhost:8001/mcp/"

[[mcp_servers]]
name = "math"
transport = "stdio"
command = "python"
args = ["-m", "mcp_server_math"]
```

All tools from connected MCP servers are exposed through your server's `/mcp` endpoint. MCP tools are prefixed with their server name to avoid conflicts (e.g., `weather_get_forecast`, `math_add`).

## Authenticate

### OAuth for third-party APIs

For tools that need to access third-party APIs (like Google, GitHub, Slack, etc.), you can use OAuth authentication with [Agent Auth](/langsmith/agent-auth).

Expand Down Expand Up @@ -120,30 +154,7 @@ Tools with `auth_provider` must:
- Specify at least one scope
- Use `context.token` to make authenticated API calls

## Using as an MCP gateway

The LangSmith Tool Server can act as an MCP gateway, aggregating tools from multiple MCP servers into a single endpoint. Configure MCP servers in your `toolkit.toml`:

```toml
[toolkit]
name = "my-toolkit"
tools = "./my_toolkit/__init__.py:TOOLS"

[[mcp_servers]]
name = "weather"
transport = "streamable_http"
url = "http://localhost:8001/mcp/"

[[mcp_servers]]
name = "math"
transport = "stdio"
command = "python"
args = ["-m", "mcp_server_math"]
```

All tools from connected MCP servers are exposed through your server's `/mcp` endpoint. MCP tools are prefixed with their server name to avoid conflicts (e.g., `weather.get_forecast`, `math.add`).

## Custom authentication
### Custom request authentication

Custom authentication allows you to validate requests and integrate with your identity provider. Define an authentication handler in your `auth.py` file:

Expand All @@ -170,24 +181,3 @@ async def authenticate(authorization: str = None) -> dict:

The handler runs on every request and must return a dict with `identity` (and optionally `permissions`).

## Using remote MCP servers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there should still probably be a link to the MCP server config info. Maybe there should be a new section here? Like the following:

## Related

- [MCP server tools](/langsmith/agent-builder-tools#mcp-server-tools)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can add a note that if you are using the agent builder, you can configure the tool server instance we set up for you as part of the agent builder in order to use your custom MCP servers


Agent Builder can discover and use tools from remote [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers. This lets you connect to external MCP servers and use their tools in your agents.

### Configuration

Configure remote MCP servers in your LangSmith [workspace](/langsmith/administration-overview#workspaces):

1. Navigate to your workspace settings in the [LangSmith UI](https://smith.langchain.com).
2. Add your MCP server URL and any required headers (for example, `Authorization: Bearer {{MCP_TOKEN}}`).
3. Agent Builder automatically discovers tools from the server and applies the configured headers when calling tools.

<Note>
Use workspace secret placeholders like `{{MCP_TOKEN}}` in headers. The platform resolves these from your workspace secrets at runtime.
</Note>

### How it works

- Agent Builder discovers tools from remote MCP servers via the standard MCP protocol.
- Headers configured in your workspace are automatically attached when fetching tools or calling them.
- Tools from remote servers are available alongside built-in tools in Agent Builder.
29 changes: 27 additions & 2 deletions src/langsmith/agent-builder-tools.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
title: Supported tools
sidebarTitle: Tools
title: Tools
---

You can access a variety of tools in Agent Builder, including [built-in tools](#built-in-tools) and [tools from remote MCP servers](#remote-mcp-server-tools).

## Built-in tools

Use these built-in tools to give your agents access to email, calendars, chat, project management, code hosting, spreadsheets/BI, search, social, and general web utilities.

<Info icon="circle-info" color="#DCFCE7" iconType="regular">
Expand Down Expand Up @@ -132,3 +135,25 @@ Use these built-in tools to give your agents access to email, calendars, chat, p
</ul>
</Card>
</CardGroup>

## Remote MCP server tools

Agent Builder can discover and use tools from remote [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) servers. This lets you connect to external MCP servers and use their tools in your agents.

### How it works

- Agent Builder discovers tools from remote MCP servers via the standard MCP protocol.
- Headers configured in your workspace are automatically attached when fetching tools or calling them. Headers can be used for authentication.
- Tools from remote servers are available alongside built-in tools in Agent Builder.

### Configuration

Configure remote MCP servers in your LangSmith [workspace](/langsmith/administration-overview#workspaces):

1. Navigate to your workspace settings in the [LangSmith UI](https://smith.langchain.com).
2. Add your MCP server URL and any required headers (for example, `Authorization: Bearer {{MCP_TOKEN}}`).
3. Agent Builder automatically discovers tools from the server and applies the configured headers when calling tools.

<Note>
Use workspace secret placeholders like `{{MCP_TOKEN}}` in headers. The platform resolves these from your workspace secrets at runtime.
</Note>