WEIR

Dify MCP Server Setup: Headers, OAuth and Agent Tools

Add a remote Dify MCP server under Integrations: the /mcp URL rule, a Bearer header or OAuth sign-in, the self-hosted callback trap and a real X search.


Published · Updated · 6 min read

Cover image: X research inside Dify

Dify MCP support is native since v1.6.0: you add a remote MCP server under Integrations, and its tools work in agents and workflows.

This guide adds Weir, so your Dify apps can search X (Twitter) and read posts, threads and profiles. Weir only reads, so it never posts as you. We run Weir.

Server URL:         https://api.weirapp.io/mcp
Name:               Weir
Server Identifier:  weir
Header Name:        Authorization
Header Value:       Bearer weir_live_your_key

Dify MCP server setup: add Weir in five steps

You need Dify 1.9.0 or later, which added custom headers, and a free Weir account.

We read Dify v1.18.0, released 23 October 2026: its docs and its source.

  1. Create a keyIn your Weir dashboard, open API keys and create one. It starts with weir_live_ and shows once.
  2. Open MCPIn Dify, open Integrations, then MCP in the Tools group. Click Add MCP Server (HTTP).
  3. Fill in the formServer URL https://api.weirapp.io/mcp, name Weir, Server Identifier weir.
  4. Add the headerUnder Headers, add Authorization with the value Bearer, a space, then your key.
  5. SaveClick Add & Authorize. The Weir card should list its tools.

Why the URL matters. Dify reads the last part of the path. /mcp means Streamable HTTP and /sse means the older SSE transport. Any other ending tries SSE first.

Pick the identifier once. Apps find the server by it, Dify's docs say, so changing it later breaks every app that uses Weir.

Header or sign-in: which Dify MCP auth should you use?

Use the header unless you'd rather sign in through a browser than paste a key.

Route Works on With Weir
Authorization header Dify Cloud and self-hosted Bills the key's account
Dynamic Client Registration Cloud, HTTPS or localhost Bills whoever signed in
Your own Client ID Servers without registration Not needed

Don't mix the two. Dify's source adds the sign-in token to tool calls only when the Headers list is empty. One stray header, and calls go out without it.

Dify stores header values encrypted and shows them masked in the form.

Does Dify MCP support OAuth on self-hosted Dify?

Yes, but the callback address decides whether Weir accepts it.

Dify registers itself with dynamic client registration under the name "Dify". It asks Weir to send you back to CONSOLE_API_URL plus /console/api/mcp/oauth/callback.

  • Dify Cloud passes. Its console runs on HTTPS.
  • A default self-hosted Dify fails. Dify's docker/.env.example leaves CONSOLE_API_URL empty, so the callback is a bare path and Weir answers invalid_redirect_uri.
  • The fix is one line. Set CONSOLE_API_URL to your HTTPS address, or http://localhost on your own machine, and restart.
  • A plain LAN address fails. Weir accepts sign-in callbacks only over HTTPS or on localhost, so http://192.168.1.20 needs the header route.

Sign-in belongs to the workspace, not the person. Everyone in it spends the account that approved. The link shows as "Dify (MCP)" under API keys in that Weir dashboard.

How to use Dify MCP tools in an Agent or a workflow

Weir's tools appear in Dify's tool picker next to plugins, so you add them where you would add any tool.

  • Agent node. In a Workflow or Chatflow, add an Agent node, choose Classic Agent and the Function Calling strategy, then add search_x. ReAct suits models without native tool calls.
  • Tool node. It runs one tool with inputs you set, with no model choosing. Use it when the search is the same every run.
  • Agent apps. Dify's new Agent, still in beta, and the legacy Agent app both take Dify tools, MCP servers included.

Name the tools in your instructions. Dify's docs say this helps the model pick the right one.

A Dify MCP example: what did @dify_ai post last?

Ask your Agent node or app:

Use search_x: what's the latest @dify_ai post on X? Skip replies and reposts.

The model should call search_x. We ran that call through Weir's MCP server on 24 October 2026:

→ search_x {"fromUsers": ["dify_ai"], "query": "-filter:nativeretweets",
            "onlyOriginal": true, "since": "2026-10-01T00:00:00Z", "limit": 1}
← 1 post · 2 credits (1 + 1 × 1) · nextCursor set
  Oct 16  7 likes  1,611 views  "Agent or Workflow? The answer depends on the job."

Fittingly, Dify's post weighs the same choice as the section above. -filter:nativeretweets drops reposts, which X search returns by default, and onlyOriginal drops replies.

2credits for our 1-post search
11credits for a 10-post search
0credits for get_usage
5,000free Weir credits every month

Weir bills 1 credit per call plus 1 per X post, and failed calls are free. Packs start at $5 for 25,000 credits and never expire, as of October 2026. See every rate on our pricing page.

Can Dify be an MCP server too?

Yes. Each Dify app can publish itself as an MCP server from the MCP Server card on its Access Point tab. It's off by default.

Dify's docs warn that the generated URL holds credentials, so treat it like a key. That's the other direction from this guide: other clients call your Dify app.

What we haven't tested

We can't run Dify here. This guide comes from Dify's docs and source, plus a real call through Weir's MCP server.

  • Dify's sign-in against Weir. Its registration matches what Weir accepts, but we haven't clicked through it.
  • The header route inside Dify. We built the form values from Dify's source and haven't saved them in a live Dify.

If it doesn't work

  • Dify asks you to authorize after you added a key. Weir answered 401. Check the value reads Bearer weir_live_... with one space.
  • Sign-in stops at registration. Check CONSOLE_API_URL, or switch to the header.
  • Signed in, but tool calls fail. Delete every custom header, so Dify sends the sign-in token.
  • A tool returns 402. Your Weir credits ran out, and retrying won't help.

When not to use Weir

  • The agent has to post or DM. Weir is read-only.
  • Price per post matters most. TwitterAPI.io lists $0.15 per 1,000 tweets as of October 2026, less than our $5 pack.
  • You need a guarantee. Weir isn't licensed by X or affiliated with it, so access can change.

FAQ

Does Dify support MCP servers with stdio?

No. Dify's docs say only MCP servers with HTTP transport are supported. A local stdio server needs a bridge that serves it over HTTP first. Weir is remote, so it needs none.

Where are MCP tools in Dify?

Under Integrations, then MCP in the Tools group, in Dify 1.18.0. Once a server is added, its tools show in the tool picker of Agent nodes, Tool nodes and Agent apps.

Which Dify version has MCP support?

Dify 1.6.0, released 10 July 2025, added MCP both ways, as a client and as a server, its release notes say. Custom headers, which the key route needs, arrived in 1.9.0.

Can Dify post to X through Weir?

No. Weir only reads public X data, so nothing can post, like or follow through it.

Sources

All checked on 24 October 2026: